build: waf test now works (at least for some tests)
[kamenim/samba.git] / source4 / selftest / wscript
1 # selftest main code.
2
3 import Scripting, os, Options, Utils, Environment, optparse
4
5
6 ########################################################################
7 # main test entry point
8 def cmd_test(opt):
9     '''Run the quick test suite'''
10     print "Starting quick test"
11     Scripting.commands += ['build']
12     env = Environment.Environment()
13
14     env.TESTS = Options.options.TESTS
15
16     env.OPTIONS = ''
17     if Options.options.QUICKTEST:
18         env.OPTIONS += '--exclude=./selftest/slow --quick --include=./selftest/quick'
19
20     SELFTEST = 'PYTHON=/usr/bin/python perl -W ../selftest/selftest.pl --prefix=./st --builddir=. --srcdir=. --exclude=./selftest/skip --testlist="./selftest/tests.sh|" ${OPTIONS} --socket-wrapper ${TESTS} | perl -W ../selftest/filter-subunit.pl --expected-failures=./selftest/knownfail | /usr/bin/perl -W ../selftest/format-subunit.pl --prefix=./st --format=plain --immediate'
21
22     cmd = Utils.subst_vars(SELFTEST, env)
23     print "test: running %s" % cmd
24     ret = os.system(cmd)
25
26 def set_options(opt):
27     opt.ADD_COMMAND('test', cmd_test)
28
29     gr = opt.add_option_group('test options')
30
31     gr.add_option('--tests',
32                   help=("wildcard pattern of tests to run"),
33                   action="store", dest='TESTS', default='')
34     gr.add_option('--quick',
35                   help=("enable only quick tests"),
36                   action="store_true", dest='QUICKTEST', default=False)