Debian Codegraph @

tests/SConscript

raw
1 Import('env')
2
3 tests = Split('prepare.sh \
4 run-tests.pl \
5 cleanup.sh')
6
7 extra_dist = Split(' \
8 condition.conf \
9 core-condition.t \
10 fastcgi-responder.conf \
11 LightyTest.pm \
12 lighttpd.conf \
13 lighttpd.htpasswd \
14 lighttpd.user \
15 mod-fastcgi.t \
16 mod-scgi.t \
17 proxy.conf \
18 request.t \
19 scgi-responder.conf \
20 var-include-sub.conf \
21 wrapper.sh \
22 ')
23
24 fcgi_responder = env.Program("fcgi-responder", "fcgi-responder.c")
25 scgi_responder = env.Program("scgi-responder", "scgi-responder.c")
26
27 def CopyTestBinary(env, binary):
28 return env.Command(target = env['ENV']['top_builddir'] + '/tests/' + binary, source = binary, action = Copy("$TARGET", "$SOURCE"))
29
30 def BuildTestEnv(env, build_type):
31 builddir = build_type
32 dependencies = [build_type]
33 if build_type == 'dynamic':
34 builddir = '.'
35 dependencies += ['modules']
36
37 testenv = env.Clone()
38 testenv['ENV']['srcdir']='tests'
39 testenv['ENV']['top_builddir']='sconsbuild/' + builddir
40 prepare = testenv.AlwaysBuild(testenv.Command(build_type + '/prepare', 'prepare.sh', 'tests/prepare.sh'))
41 runtests = testenv.AlwaysBuild(testenv.Command(build_type + '/run-tests', 'run-tests.pl', 'tests/run-tests.pl'))
42 cleanup = testenv.AlwaysBuild(testenv.Command(build_type + '/cleanup', 'cleanup.sh', 'tests/cleanup.sh'))
43 testenv.Depends(runtests, prepare)
44 testenv.Depends(cleanup, runtests)
45 SideEffect('dummy-file-prevent-running-tests-in-parallel', runtests)
46
47 testenv.Depends(runtests, dependencies)
48
49 fcgis = [CopyTestBinary(testenv, 'fcgi-responder'), CopyTestBinary(testenv, 'scgi-responder')]
50 testenv.Depends(runtests, fcgis)
51
52 return [prepare, runtests, cleanup]
53
54 check_dynamic = env.Alias('check_dynamic', BuildTestEnv(env, 'dynamic'))
55 env.Depends(check_dynamic, 'modules')
56 check_static = env.Alias('check_static', BuildTestEnv(env, 'static'))
57 check_fullstatic = env.Alias('check_fullstatic', BuildTestEnv(env, 'fullstatic'))
58
59 checks = []
60
61 if env['build_dynamic']:
62 checks += check_dynamic
63
64 if env['build_static']:
65 checks += check_static
66
67 if env['build_fullstatic']:
68 checks += check_fullstatic
69
70 env.Alias('check', checks)