tdb/wscript: maintain a global list of unit tests
authorStefan Metzmacher <metze@samba.org>
Mon, 3 Feb 2014 09:40:45 +0000 (10:40 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 2 Apr 2014 07:03:42 +0000 (09:03 +0200)
This makes sure a new test is also added to 'make test'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/tdb/wscript

index fc396d6d0698df6425dba39bcea2f3c641c4ba35..70196938ed2e9c6c8fc7645c9f224b6a0676b741 100644 (file)
@@ -17,6 +17,31 @@ import wafsamba, samba_dist, Options, Logs
 
 samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
 
+tdb1_unit_tests = [
+    'run-3G-file',
+    'run-bad-tdb-header',
+    'run',
+    'run-check',
+    'run-corrupt',
+    'run-die-during-transaction',
+    'run-endian',
+    'run-incompatible',
+    'run-nested-transactions',
+    'run-nested-traverse',
+    'run-no-lock-during-traverse',
+    'run-oldhash',
+    'run-open-during-transaction',
+    'run-readonly-check',
+    'run-rescue',
+    'run-rescue-find_entry',
+    'run-rwlock-check',
+    'run-summary',
+    'run-transaction-expand',
+    'run-traverse-in-transaction',
+    'run-wronghash-fail',
+    'run-zero-append'
+]
+
 def set_options(opt):
     opt.BUILTIN_DEFAULT('replace')
     opt.PRIVATE_EXTENSION_DEFAULT('tdb', noextension='tdb')
@@ -115,50 +140,11 @@ def build(bld):
                             'replace',
                             includes='include')
 
-        bld.SAMBA_BINARY('tdb1-run-3G-file', 'test/run-3G-file.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-bad-tdb-header', 'test/run-bad-tdb-header.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run', 'test/run.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-check', 'test/run-check.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-corrupt', 'test/run-corrupt.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-die-during-transaction', 'test/run-die-during-transaction.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-endian', 'test/run-endian.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-incompatible', 'test/run-incompatible.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-nested-transactions', 'test/run-nested-transactions.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-nested-traverse', 'test/run-nested-traverse.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-no-lock-during-traverse', 'test/run-no-lock-during-traverse.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-oldhash', 'test/run-oldhash.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-open-during-transaction', 'test/run-open-during-transaction.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-readonly-check', 'test/run-readonly-check.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-rescue', 'test/run-rescue.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-rescue-find_entry', 'test/run-rescue-find_entry.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-rwlock-check', 'test/run-rwlock-check.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-summary', 'test/run-summary.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-transaction-expand', 'test/run-transaction-expand.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-traverse-in-transaction', 'test/run-traverse-in-transaction.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-wronghash-fail', 'test/run-wronghash-fail.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
-        bld.SAMBA_BINARY('tdb1-run-zero-append', 'test/run-zero-append.c',
-                         'replace tdb-test-helpers', includes='include', install=False)
+        for t in tdb1_unit_tests:
+            b = "tdb1-" + t
+            s = "test/" + t + ".c"
+            bld.SAMBA_BINARY(b, s, 'replace tdb-test-helpers',
+                             includes='include', install=False)
 
     if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
         bld.SAMBA_PYTHON('pytdb',
@@ -189,7 +175,8 @@ def testonly(ctx):
         if not os.path.exists(link):
             os.symlink(os.path.abspath(os.path.join(env.cwd, 'test')), link)
 
-        for f in 'tdb1-run-3G-file', 'tdb1-run-bad-tdb-header', 'tdb1-run', 'tdb1-run-check', 'tdb1-run-corrupt', 'tdb1-run-die-during-transaction', 'tdb1-run-endian', 'tdb1-run-incompatible', 'tdb1-run-nested-transactions', 'tdb1-run-nested-traverse', 'tdb1-run-no-lock-during-traverse', 'tdb1-run-oldhash', 'tdb1-run-open-during-transaction', 'tdb1-run-readonly-check', 'tdb1-run-rescue', 'tdb1-run-rescue-find_entry', 'tdb1-run-rwlock-check', 'tdb1-run-summary', 'tdb1-run-transaction-expand', 'tdb1-run-traverse-in-transaction', 'tdb1-run-wronghash-fail', 'tdb1-run-zero-append':
+        for t in tdb1_unit_tests:
+            f = "tdb1-" + t
             cmd = "cd " + testdir + " && " + os.path.abspath(os.path.join(Utils.g_module.blddir, f)) + " > test-output 2>&1"
             print("..." + f)
             ret = samba_utils.RUN_COMMAND(cmd)