SConscript 2.0 KB

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