python/samba/netcmd/schema.py: add schema show_oc for attribute
[kai/samba-autobuild/.git] / selftest / wscript
index 2299195428f24a60d26cd991d38cd01f6a98f375..6a6dcb5c644c42c1627136ebb14dbdd808b76cdb 100644 (file)
@@ -121,7 +121,11 @@ def cmd_testonly(opt):
             env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit-json --prefix=${SELFTEST_PREFIX}'
         else:
             env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate'
-    env.FILTER_XFAIL = '${PYTHON} -u ${srcdir}/selftest/filter-subunit --expected-failures=${srcdir}/selftest/knownfail --flapping=${srcdir}/selftest/flapping'
+    env.FILTER_XFAIL = ('${PYTHON} -u ${srcdir}/selftest/filter-subunit '
+                        '--expected-failures=${srcdir}/selftest/knownfail '
+                        '--expected-failures=${srcdir}/selftest/knownfail.d '
+                        '--flapping=${srcdir}/selftest/flapping '
+                        '--flapping=${srcdir}/selftest/flapping.d')
 
     if Options.options.FAIL_IMMEDIATELY:
         env.FILTER_XFAIL += ' --fail-immediately'
@@ -198,6 +202,9 @@ def cmd_testonly(opt):
     # tell build system where to find config.h
     os.environ['CONFIG_H'] = 'bin/default/include/config.h'
 
+    # tell the test system where perl is
+    os.environ['PERL'] = env.PERL
+
     st_done = os.path.join(env.SELFTEST_PREFIX, 'st_done')
     if os.path.exists(st_done):
         os.unlink(st_done)
@@ -209,6 +216,10 @@ def cmd_testonly(opt):
         env.TESTLISTS = '--testlist=%r' % Options.options.TEST_LIST
     elif Options.options.PERF_TEST:
         env.TESTLISTS = '--testlist="${PYTHON} ${srcdir}/selftest/perf_tests.py|" '
+    elif CONFIG_SET(opt, 'EXTRA_PYTHON'):
+        env.TESTLISTS = ('--testlist="EXTRA_PYTHON=${EXTRA_PYTHON} ${PYTHON} ${srcdir}/selftest/tests.py|" ' +
+                         '--testlist="EXTRA_PYTHON=${EXTRA_PYTHON} ${PYTHON} ${srcdir}/source3/selftest/tests.py|" ' +
+                         '--testlist="EXTRA_PYTHON=${EXTRA_PYTHON} ${PYTHON} ${srcdir}/source4/selftest/tests.py|"')
     else:
         env.TESTLISTS = ('--testlist="${PYTHON} ${srcdir}/selftest/tests.py|" ' +
                          '--testlist="${PYTHON} ${srcdir}/source3/selftest/tests.py|" ' +
@@ -238,9 +249,32 @@ def cmd_testonly(opt):
         # GSS_KRB5_CRED_NO_CI_FLAGS_X
         env.OPTIONS += " --exclude=${srcdir}/selftest/skip.no-GSS_KRB5_CRED_NO_CI_FLAGS_X"
 
+    if env.ADDRESS_SANITIZER:
+        # We try to find the correct libasan automatically
+        libasan = Utils.cmd_output('ldd bin/texpect | grep libasan| cut -f 3 -d \ ',
+                                   silent=True).strip()
+
+        # Have the selftest.pl LD_PRELOAD libasan in the right spot
+        env.OPTIONS += " --asan_so_path=" + libasan
+
     subunit_cache = None
     # We use the full path rather than relative path to avoid problems on some platforms (ie. solaris 8).
     env.CORE_COMMAND = '${PERL} ${srcdir}/selftest/selftest.pl --target=${SELFTEST_TARGET} --prefix=${SELFTEST_PREFIX} --srcdir=${srcdir} --exclude=${srcdir}/selftest/skip ${TESTLISTS} ${OPTIONS} ${TESTS}'
+
+    if env.ADDRESS_SANITIZER:
+        # For now we cannot run with leak detection
+        no_leak_check = "ASAN_OPTIONS=detect_leaks=0"
+        env.CORE_COMMAND = no_leak_check + " " + env.CORE_COMMAND
+
+        # We need to have the subunit filter and formatter preload
+        # libasan otherwise the tests fail at startup.
+        #
+        # Also, we do not care about leaks in python
+
+        asan_envs = no_leak_check + " LD_PRELOAD=" + libasan + ' '
+        env.FILTER_OPTIONS = asan_envs + env.FILTER_OPTIONS
+        env.SUBUNIT_FORMATTER = asan_envs + env.SUBUNIT_FORMATTER
+
     if Options.options.LIST:
         cmd = '${CORE_COMMAND} --list'
     else:
@@ -252,6 +286,7 @@ def cmd_testonly(opt):
             cmd += ' | tee %s | ${FORMAT_TEST_OUTPUT}' % subunit_cache
         else:
             cmd += ' | ${FILTER_OPTIONS}'
+
     runcmd = EXPAND_VARIABLES(opt, cmd)
 
     print("test: running %s" % runcmd)