Skip to contentSkip to conversation

gfs2-utils tests: Switch to autotest

PATCH New Andrew Price 1 participant 1 message Aug 19, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2-utils tests: Switch to autotest

Replaces the custom tool_tests.sh test harness with the Autotest framework provided by Autoconf. See doc/README.tests for details.

This is just a straight rework of the existing tests as Autotest test groups.

---
 .gitignore          |  8 ++++-
 configure.ac        |  2 ++
 doc/README.tests    | 42 ++++++++++++++++++++++++
 tests/Makefile.am   | 71 +++++++++++++++++++++++++++++++++-------
 tests/atlocal.in    |  7 ++++
 tests/libgfs2.at    |  5 +++
 tests/mkfs.at       | 64 ++++++++++++++++++++++++++++++++++++
 tests/testsuite.at  | 16 +++++++++
 tests/tool_tests.sh | 94 -----------------------------------------------------
 9 files changed, 203 insertions(+), 106 deletions(-)
 create mode 100644 doc/README.tests
 create mode 100644 tests/atlocal.in
 create mode 100644 tests/libgfs2.at
 create mode 100644 tests/mkfs.at
 create mode 100644 tests/testsuite.at
 delete mode 100755 tests/tool_tests.sh
.gitignore +7 -1
index 26d89d0..ae72f2b 100644
@@ -44,7 +44,13 @@ gfs2/tune/tunegfs2
 test-driver
 tests/check_libgfs2
 tests/testvol
-tests/tests.log
+tests/testsuite.log
+tests/testsuite.dir
+tests/testsuite.trs
+tests/atconfig
+tests/atlocal
+tests/package.m4
+tests/testsuite
 ABOUT-NLS
 po/Makevars.template
 po/POTFILES
configure.ac +2 -0
index 911dd88..628d85e 100644
@@ -203,6 +203,7 @@ CPPFLAGS="-I\$(top_builddir)/make -I\$(top_srcdir)/make \
 	  -I. $ENV_CPPFLAGS"
 LDFLAGS="$ENV_LDFLAGS"
 
+AC_CONFIG_TESTDIR([tests], [gfs2/libgfs2:gfs2/mkfs:gfs2/fsck:gfs2/edit:gfs2/convert:gfs2/tune:tests])
 AC_CONFIG_FILES([Makefile
 		 gfs2/Makefile
 		 gfs2/include/Makefile
@@ -216,6 +217,7 @@ AC_CONFIG_FILES([Makefile
 		 gfs2/scripts/Makefile
 		 doc/Makefile
 		 tests/Makefile
+		 tests/atlocal
 		 po/Makefile.in
 		 ])
 
doc/README.tests new file +42 -0

42 lines not on this page · raw message

tests/Makefile.am +60 -11

75 lines not on this page · raw message

tests/atlocal.in new file +7 -0
new file mode 100644
index 0000000..660c87a
@@ -0,0 +1,7 @@
+GFS_TGT="$abs_builddir/testvol"
+GFS_TGT_SZ=10
+
+gfs_max_blocks()
+{
+	printf $((GFS_TGT_SZ*1073741824/$1))
+}
tests/libgfs2.at new file +5 -0
new file mode 100644
index 0000000..a6b478a
@@ -0,0 +1,5 @@
+AT_BANNER([libgfs2 unit tests])
+
+AT_SETUP([Metadata check])
+AT_CHECK([check_libgfs2], 0, [ignore], [ignore])
+AT_CLEANUP
tests/mkfs.at new file +64 -0

64 lines not on this page · raw message

tests/testsuite.at new file +16 -0
new file mode 100644
index 0000000..2c74985
@@ -0,0 +1,16 @@
+# Regenerate the sparse file used for testing and skip the test if it fails
+m4_define([GFS_TGT_REGEN],
+[AT_CHECK([rm -f $GFS_TGT && truncate -s ${GFS_TGT_SZ}G ${GFS_TGT}], [ignore], [ignore], [ignore])
+AT_SKIP_IF([test ! -f ${GFS_TGT}])])
+
+# Regenerate, check, fsck is used a lot so combine it into one macro
+m4_define([GFS_FSCK_CHECK],
+[GFS_TGT_REGEN
+AT_CHECK($1, 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])])
+
+AT_INIT([])
+AT_COLOR_TESTS
+
+m4_include([mkfs.at])
+m4_include([libgfs2.at])
tests/tool_tests.sh deleted +0 -94

94 lines not on this page · raw message

Signature · 1 line
1.8.3.1