summaryrefslogtreecommitdiff
path: root/source4/selftest/wscript
blob: e6628fd0a4e994ba5c5cc0c74c9531976236dc04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# selftest main code.

import Scripting, os, Options, Utils, Environment, optparse


def cmd_testonly(opt):
    env = Environment.Environment()

    env.TESTS = Options.options.TESTS

    env.OPTIONS = ''
    if Options.options.QUICKTEST:
        env.OPTIONS += '--exclude=./selftest/slow --quick --include=./selftest/quick'

    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'

    cmd = Utils.subst_vars(SELFTEST, env)
    print "test: running %s" % cmd
    ret = os.system(cmd)

########################################################################
# main test entry point
def cmd_test(opt):
    '''Run the quick test suite'''
    print "Starting quick test"
    Scripting.commands.append('build')
    Scripting.commands.append('testonly')

def set_options(opt):
    opt.ADD_COMMAND('test', cmd_test)
    opt.ADD_COMMAND('testonly', cmd_testonly)

    gr = opt.add_option_group('test options')

    gr.add_option('--tests',
                  help=("wildcard pattern of tests to run"),
                  action="store", dest='TESTS', default='')
    gr.add_option('--quick',
                  help=("enable only quick tests"),
                  action="store_true", dest='QUICKTEST', default=False)