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