Skip to content

Commit

Permalink
qa: do not use automake for workunit makefiles
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jun 14, 2011
1 parent 40f5ab9 commit 954e096
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ core.*
vgcore.*
src/Makefile
Makefile.in
Makefile
/Makefile
aclocal.m4
autom4te.cache
config.log
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
AUTOMAKE_OPTIONS = gnu
EXTRA_DIST = autogen.sh ceph.spec.in
# the "." here makes sure check-local builds gtest before it is used
SUBDIRS = . src qa man
SUBDIRS = . src man

EXTRA_DIST += \
src/test/run-cli-tests \
src/test/cli \
src/test/downloads \
udev/50-rbd.rules

check-local:
# Build gtest before we build our own tests. Doing this instead
# of SUBDIRS because with that, gtest's own tests would be run
Expand Down
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,5 @@ AC_CONFIG_HEADERS([src/acconfig.h])
AC_CONFIG_FILES([Makefile
src/Makefile
man/Makefile
qa/Makefile
qa/workunits/Makefile
qa/workunits/direct_io/Makefile
ceph.spec])
AC_OUTPUT
4 changes: 4 additions & 0 deletions qa/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DIRS= workunits

all:
for d in $(DIRS) ; do ( cd $$d ; $(MAKE) all ) ; done
3 changes: 0 additions & 3 deletions qa/Makefile.am

This file was deleted.

4 changes: 4 additions & 0 deletions qa/workunits/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DIRS = direct_io

all:
for d in $(DIRS) ; do ( cd $$d ; $(MAKE) all ) ; done
2 changes: 0 additions & 2 deletions qa/workunits/Makefile.am

This file was deleted.

11 changes: 11 additions & 0 deletions qa/workunits/direct_io/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CFLAGS=-Wall -Wextra

TARGETS= direct_io_test test_sync_io test_short_dio_read

.c:
$(CC) $(CFLAGS) $@.c -o $@

all: $(TARGETS)

clean:
rm $(TARGETS)
14 changes: 0 additions & 14 deletions qa/workunits/direct_io/Makefile.am

This file was deleted.

6 changes: 3 additions & 3 deletions qa/workunits/direct_io/test_short_dio_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#include <fcntl.h>
#include <stdio.h>

int main(int argc, char **argv)
int main()
{
char buf[409600];
int fd = open("shortfile", O_WRONLY|O_CREAT, 0644);
ssize_t r;

printf("writing first 3 bytes of 10k file\n");
write(fd, "foo", 3);
ftruncate(fd, 10000);
r = write(fd, "foo", 3);
r = ftruncate(fd, 10000);
fsync(fd);
close(fd);

Expand Down
30 changes: 16 additions & 14 deletions qa/workunits/direct_io/test_sync_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ void write_pattern()

int fd = open("foo", O_CREAT|O_WRONLY, 0644);
uint64_t i;
int r;

for (i=0; i<1048576 * sizeof(i); i += sizeof(i)) {
write(fd, &i, sizeof(i));
r = write(fd, &i, sizeof(i));
}

close(fd);
Expand Down Expand Up @@ -66,12 +67,12 @@ int read_direct(int buf_align, uint64_t offset, int len)
(unsigned long long)offset, len);
int fd = open("foo", O_RDONLY|O_DIRECT);
void *rawbuf;
posix_memalign(&rawbuf, 4096, len + buf_align);
int r = posix_memalign(&rawbuf, 4096, len + buf_align);
void *buf = (char *)rawbuf + buf_align;
memset(buf, 0, len);
pread(fd, buf, len, offset);
r = pread(fd, buf, len, offset);
close(fd);
int r = verify_pattern(buf, len, offset);
r = verify_pattern(buf, len, offset);
free(rawbuf);
return r;
}
Expand All @@ -83,12 +84,12 @@ int read_sync(int buf_align, uint64_t offset, int len)
int fd = open("foo", O_RDONLY);
ioctl(fd, CEPH_IOC_SYNCIO);
void *rawbuf;
posix_memalign(&rawbuf, 4096, len + buf_align);
int r = posix_memalign(&rawbuf, 4096, len + buf_align);
void *buf = (char *)rawbuf + buf_align;
memset(buf, 0, len);
pread(fd, buf, len, offset);
r = pread(fd, buf, len, offset);
close(fd);
int r = verify_pattern(buf, len, offset);
r = verify_pattern(buf, len, offset);
free(rawbuf);
return r;
}
Expand All @@ -101,19 +102,20 @@ int write_direct(int buf_align, uint64_t offset, int len)
void *rawbuf;
posix_memalign(&rawbuf, 4096, len + buf_align);
void *buf = (char *)rawbuf + buf_align;
int r;

generate_pattern(buf, len, offset);

pwrite(fd, buf, len, offset);
r = pwrite(fd, buf, len, offset);
close(fd);

fd = open("foo", O_RDONLY);
void *buf2 = malloc(len);
memset(buf2, 0, len);
pread(fd, buf2, len, offset);
r = pread(fd, buf2, len, offset);
close(fd);

int r = verify_pattern(buf2, len, offset);
r = verify_pattern(buf2, len, offset);

unlink("foo");
free(rawbuf);
Expand All @@ -128,21 +130,21 @@ int write_sync(int buf_align, uint64_t offset, int len)
int fd = open("foo", O_WRONLY|O_CREAT, 0644);
ioctl(fd, CEPH_IOC_SYNCIO);
void *rawbuf;
posix_memalign(&rawbuf, 4096, len + buf_align);
int r = posix_memalign(&rawbuf, 4096, len + buf_align);
void *buf = (char *)rawbuf + buf_align;

generate_pattern(buf, len, offset);

pwrite(fd, buf, len, offset);
r = pwrite(fd, buf, len, offset);
close(fd);

fd = open("foo", O_RDONLY);
void *buf2 = malloc(len);
memset(buf2, 0, len);
pread(fd, buf2, len, offset);
r = pread(fd, buf2, len, offset);
close(fd);

int r = verify_pattern(buf2, len, offset);
r = verify_pattern(buf2, len, offset);

unlink("foo");
free(buf2);
Expand Down
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ crush/CrushWrapper_wrap.cxx
/psim
/sample.fetch_config

Makefile

/gtest/build-aux/config.h
/gtest/build-aux/config.h.in
/gtest/lib/
Expand Down

0 comments on commit 954e096

Please sign in to comment.