wscript 764 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2012 (ita)
  4. VERSION='0.0.1'
  5. APPNAME='preproc_test'
  6. top = '.'
  7. out = 'build'
  8. from waflib import Utils
  9. from waflib.Logs import pprint
  10. def configure(conf):
  11. pass
  12. def build(bld):
  13. bld.failure = 0
  14. def disp(color, result):
  15. pprint(color, result)
  16. if color == 'RED':
  17. bld.failure=1
  18. def stop_status(bld):
  19. if bld.failure:
  20. bld.fatal('One or several test failed, check the outputs above')
  21. bld.add_post_fun(stop_status)
  22. def test_shell(inp, expected):
  23. ret = Utils.shell_escape(inp)
  24. if ret == expected:
  25. color = "GREEN"
  26. else:
  27. color = "RED"
  28. disp(color, "%r -> %r\t\texpected: %r" % (inp, ret, expected))
  29. test_shell("ls -l", "ls -l")
  30. test_shell(['ls', '-l', 'a space'], "ls -l 'a space'")