diff mbox

[ndctl,02/13] ndctl: move tests to their own directory

Message ID 20160128225208.17855.14038.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 562930fb3229
Headers show

Commit Message

Dan Williams Jan. 28, 2016, 10:52 p.m. UTC
Make it easier to find all the test code since it is not apparent for
some files.

Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
[ross: fix up some missed paths and O_CREAT]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Makefile.am            |   58 ++++++++++++++++++++++++------------------------
 test/blk_namespaces.c  |    0 
 test/core.c            |    0 
 test/dax-dev.c         |    2 +-
 test/dax-pmd.c         |    3 ++
 test/dax.sh            |    6 ++---
 test/dpa-alloc.c       |    0 
 test/libndctl.c        |    0 
 test/mmap.c            |    0 
 test/mmap.sh           |    4 ++-
 test/parent-uuid.c     |    0 
 test/pcommit.c         |    0 
 test/pmem_namespaces.c |    0 
 13 files changed, 37 insertions(+), 36 deletions(-)
 rename lib/blk_namespaces.c => test/blk_namespaces.c (100%)
 rename lib/test-core.c => test/core.c (100%)
 rename lib/test-dax-dev.c => test/dax-dev.c (97%)
 rename lib/test-dax-pmd.c => test/dax-pmd.c (97%)
 rename lib/test-dax.sh => test/dax.sh (82%)
 rename lib/test-dpa-alloc.c => test/dpa-alloc.c (100%)
 rename lib/test-libndctl.c => test/libndctl.c (100%)
 rename lib/test-mmap.c => test/mmap.c (100%)
 rename lib/test-mmap.sh => test/mmap.sh (97%)
 rename lib/test-parent-uuid.c => test/parent-uuid.c (100%)
 rename lib/test-pcommit.c => test/pcommit.c (100%)
 rename lib/pmem_namespaces.c => test/pmem_namespaces.c (100%)

diff --git a/lib/test-parent-uuid.c b/test/parent-uuid.c
similarity index 100%
rename from lib/test-parent-uuid.c
rename to test/parent-uuid.c
diff --git a/lib/test-pcommit.c b/test/pcommit.c
similarity index 100%
rename from lib/test-pcommit.c
rename to test/pcommit.c
diff --git a/lib/pmem_namespaces.c b/test/pmem_namespaces.c
similarity index 100%
rename from lib/pmem_namespaces.c
rename to test/pmem_namespaces.c
diff mbox

Patch

diff --git a/Makefile.am b/Makefile.am
index 7fee9c688c84..1a0d294dd34d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,16 +73,16 @@  ndctl_SOURCES = ndctl.c \
 		util/wrapper.c
 
 if ENABLE_TEST
-ndctl_SOURCES += lib/test-libndctl.c \
-		 lib/test-dpa-alloc.c \
-		 lib/test-parent-uuid.c \
-		 lib/test-core.c
+ndctl_SOURCES += test/libndctl.c \
+		 test/dpa-alloc.c \
+		 test/parent-uuid.c \
+		 test/core.c
 endif
 
 if ENABLE_DESTRUCTIVE
-ndctl_SOURCES += lib/blk_namespaces.c \
-		 lib/pmem_namespaces.c \
-		 lib/test-pcommit.c
+ndctl_SOURCES += test/blk_namespaces.c \
+		 test/pmem_namespaces.c \
+		 test/pcommit.c
 ndctl_SOURCES += builtin-bat.c
 endif
 
@@ -116,37 +116,37 @@  pkgconfig_DATA = lib/libndctl.pc
 EXTRA_DIST += lib/libndctl.pc.in
 CLEANFILES += lib/libndctl.pc
 
-TESTS = lib/test-libndctl lib/test-dpa-alloc lib/test-parent-uuid
-check_PROGRAMS = lib/test-libndctl lib/test-dpa-alloc lib/test-parent-uuid
+TESTS = test/libndctl test/dpa-alloc test/parent-uuid
+check_PROGRAMS = test/libndctl test/dpa-alloc test/parent-uuid
 
 if ENABLE_DESTRUCTIVE
-TESTS += lib/test-blk-ns lib/test-pmem-ns lib/test-pcommit
-check_PROGRAMS += lib/test-blk-ns lib/test-pmem-ns lib/test-pcommit
+TESTS += test/blk-ns test/pmem-ns test/pcommit
+check_PROGRAMS += test/blk-ns test/pmem-ns test/pcommit
 
-TESTS += lib/test-dax-dev lib/test-dax.sh lib/test-mmap.sh
-check_PROGRAMS += lib/test-dax-dev lib/test-dax-pmd lib/test-mmap
+TESTS += test/dax-dev test/dax.sh test/mmap.sh
+check_PROGRAMS += test/dax-dev test/dax-pmd test/mmap
 endif
 
-lib_test_libndctl_SOURCES = lib/test-libndctl.c lib/test-core.c
-lib_test_libndctl_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
+test_libndctl_SOURCES = test/libndctl.c test/core.c
+test_libndctl_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
 
-lib_test_pcommit_SOURCES = lib/test-pcommit.c
-lib_test_pcommit_LDADD = lib/libndctl.la $(KMOD_LIBS)
+test_pcommit_SOURCES = test/pcommit.c
+test_pcommit_LDADD = lib/libndctl.la $(KMOD_LIBS)
 
-lib_test_blk_ns_SOURCES = lib/blk_namespaces.c
-lib_test_blk_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
+test_blk_ns_SOURCES = test/blk_namespaces.c
+test_blk_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
 
-lib_test_pmem_ns_SOURCES = lib/pmem_namespaces.c
-lib_test_pmem_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
+test_pmem_ns_SOURCES = test/pmem_namespaces.c
+test_pmem_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
 
-lib_test_dpa_alloc_SOURCES = lib/test-dpa-alloc.c lib/test-core.c
-lib_test_dpa_alloc_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
+test_dpa_alloc_SOURCES = test/dpa-alloc.c test/core.c
+test_dpa_alloc_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
 
-lib_test_parent_uuid_SOURCES = lib/test-parent-uuid.c lib/test-core.c
-lib_test_parent_uuid_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
+test_parent_uuid_SOURCES = test/parent-uuid.c test/core.c
+test_parent_uuid_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
 
-lib_test_dax_dev_SOURCES = lib/test-dax-dev.c lib/test-core.c
-lib_test_dax_dev_LDADD = lib/libndctl.la
+test_dax_dev_SOURCES = test/dax-dev.c test/core.c
+test_dax_dev_LDADD = lib/libndctl.la
 
-lib_test_dax_pmd_SOURCES = lib/test-dax-pmd.c
-lib_test_mmap_SOURCES = lib/test-mmap.c
+test_dax_pmd_SOURCES = test/dax-pmd.c
+test_mmap_SOURCES = test/mmap.c
diff --git a/lib/blk_namespaces.c b/test/blk_namespaces.c
similarity index 100%
rename from lib/blk_namespaces.c
rename to test/blk_namespaces.c
diff --git a/lib/test-core.c b/test/core.c
similarity index 100%
rename from lib/test-core.c
rename to test/core.c
diff --git a/lib/test-dax-dev.c b/test/dax-dev.c
similarity index 97%
rename from lib/test-dax-dev.c
rename to test/dax-dev.c
index 47d98ddd15a9..afc9e5211eb3 100755
--- a/lib/test-dax-dev.c
+++ b/test/dax-dev.c
@@ -70,7 +70,7 @@  static int emit_e820_device(int loglevel, struct ndctl_test *test)
 
 	/*
 	 * Note, if the bdev goes active after this check we'll still
-	 * clobber it in the following tests, see lib/test-dax.sh.
+	 * clobber it in the following tests, see test/dax.sh.
 	 */
 	fd = open(path, O_RDWR | O_EXCL);
 	if (fd < 0)
diff --git a/lib/test-dax-pmd.c b/test/dax-pmd.c
similarity index 97%
rename from lib/test-dax-pmd.c
rename to test/dax-pmd.c
index bf21160016fd..ff0c70e9ea47 100644
--- a/lib/test-dax-pmd.c
+++ b/test/dax-pmd.c
@@ -89,7 +89,8 @@  static int test_pmd(int fd)
 			break;
 		}
 
-		fd2 = open(TEST_FILE, O_CREAT|O_TRUNC|O_DIRECT|O_RDWR);
+		fd2 = open(TEST_FILE, O_CREAT|O_TRUNC|O_DIRECT|O_RDWR,
+				DEFFILEMODE);
 		if (fd2 < 0) {
 			faili(i);
 			munmap(addr, 2*HPAGE_SIZE);
diff --git a/lib/test-dax.sh b/test/dax.sh
similarity index 82%
rename from lib/test-dax.sh
rename to test/dax.sh
index 048d82975d92..c5fce475afce 100755
--- a/lib/test-dax.sh
+++ b/test/dax.sh
@@ -19,16 +19,16 @@  set -e
 mkdir -p $MNT
 trap 'err $LINENO' ERR
 
-DEV=$(lib/test-dax-dev)
+DEV=$(test/dax-dev)
 
 mkfs.ext4 $DEV
 mount $DEV $MNT -o dax
 fallocate -l 1GiB $MNT/$FILE
-lib/test-dax-pmd $MNT/$FILE
+test/dax-pmd $MNT/$FILE
 umount $MNT
 
 mkfs.xfs -f $DEV
 mount $DEV $MNT -o dax
 fallocate -l 1GiB $MNT/$FILE
-lib/test-dax-pmd $MNT/$FILE
+test/dax-pmd $MNT/$FILE
 umount $MNT
diff --git a/lib/test-dpa-alloc.c b/test/dpa-alloc.c
similarity index 100%
rename from lib/test-dpa-alloc.c
rename to test/dpa-alloc.c
diff --git a/lib/test-libndctl.c b/test/libndctl.c
similarity index 100%
rename from lib/test-libndctl.c
rename to test/libndctl.c
diff --git a/lib/test-mmap.c b/test/mmap.c
similarity index 100%
rename from lib/test-mmap.c
rename to test/mmap.c
diff --git a/lib/test-mmap.sh b/test/mmap.sh
similarity index 97%
rename from lib/test-mmap.sh
rename to test/mmap.sh
index f0e16b60240a..745962b0c059 100755
--- a/lib/test-mmap.sh
+++ b/test/mmap.sh
@@ -2,7 +2,7 @@ 
 MNT=test_mmap_mnt
 FILE=image
 DEV=""
-TEST=lib/test-mmap
+TEST=test/mmap
 
 err() {
 	rc=1
@@ -46,7 +46,7 @@  set -e
 mkdir -p $MNT
 trap 'err $LINENO' ERR
 
-DEV=$(lib/test-dax-dev)
+DEV=$(test/dax-dev)
 
 mkfs.ext4 $DEV
 mount $DEV $MNT -o dax