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-compress.t \ 21 mod-compress.conf \ 22 mod-fastcgi.t \ 23 request.t \ 24 mod-ssi.t \ 25 LightyTest.pm \ 26 mod-setenv.t') 27 28fcgi_auth = None 29fcgi_responder = None 30scgi_responder = env.Program("scgi-responder", "scgi-responder.c") 31 32if env['LIBFCGI']: 33 fcgi_auth = env.Program("fcgi-auth", "fcgi-auth.c", LIBS=[env['LIBFCGI'], env['APPEND_LIBS']]) 34 fcgi_responder = env.Program("fcgi-responder", "fcgi-responder.c", LIBS=[env['LIBFCGI'], env['APPEND_LIBS']]) 35 36def CopyTestBinary(env, binary): 37 return env.Command(target = env['ENV']['top_builddir'] + '/tests/' + binary, source = binary, action = Copy("$TARGET", "$SOURCE")) 38 39def BuildTestEnv(env, build_type): 40 builddir = build_type 41 dependencies = [build_type] 42 if build_type == 'dynamic': 43 builddir = '.' 44 dependencies += ['modules'] 45 46 testenv = env.Clone() 47 testenv['ENV']['srcdir']='tests' 48 testenv['ENV']['top_builddir']='sconsbuild/' + builddir 49 prepare = testenv.AlwaysBuild(testenv.Command(build_type + '/prepare', 'prepare.sh', 'tests/prepare.sh')) 50 runtests = testenv.AlwaysBuild(testenv.Command(build_type + '/run-tests', 'run-tests.pl', 'tests/run-tests.pl')) 51 cleanup = testenv.AlwaysBuild(testenv.Command(build_type + '/cleanup', 'cleanup.sh', 'tests/cleanup.sh')) 52 testenv.Depends(runtests, prepare) 53 testenv.Depends(cleanup, runtests) 54 SideEffect('dummy-file-prevent-running-tests-in-parallel', runtests) 55 56 testenv.Depends(runtests, dependencies) 57 58 if env['LIBFCGI']: 59 fcgis = [CopyTestBinary(testenv, 'fcgi-auth'), CopyTestBinary(testenv, 'fcgi-responder')] 60 testenv.Depends(runtests, fcgis) 61 62 return [prepare, runtests, cleanup] 63 64check_dynamic = env.Alias('check_dynamic', BuildTestEnv(env, 'dynamic')) 65env.Depends(check_dynamic, 'modules') 66check_static = env.Alias('check_static', BuildTestEnv(env, 'static')) 67check_fullstatic = env.Alias('check_fullstatic', BuildTestEnv(env, 'fullstatic')) 68 69checks = [] 70 71if env['build_dynamic']: 72 checks += check_dynamic 73 74if env['build_static']: 75 checks += check_static 76 77if env['build_fullstatic']: 78 checks += check_fullstatic 79 80env.Alias('check', checks) 81