wscript 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2016-2018 (ita)
  4. top = '.'
  5. out = 'build'
  6. import inspect
  7. from waflib import Utils, Logs, TaskGen
  8. @TaskGen.taskgen_method
  9. def log(self):
  10. fname = inspect.stack()[1][3]
  11. try:
  12. self.called.append(fname)
  13. except AttributeError:
  14. self.called = [fname]
  15. @TaskGen.taskgen_method
  16. def check(self):
  17. self.post()
  18. result = ''.join(self.called)
  19. if result == self.expected:
  20. color = 'GREEN'
  21. else:
  22. color = 'RED'
  23. result = 'got %r but expected %r' % (result, self.expected)
  24. self.bld.failure = 1
  25. Logs.pprint(color, result)
  26. @TaskGen.feature('test1')
  27. @TaskGen.after('d')
  28. def a(self):
  29. self.log()
  30. @TaskGen.feature('test1')
  31. @TaskGen.after('c')
  32. def b(self):
  33. self.log()
  34. @TaskGen.feature('test1')
  35. def c(self):
  36. self.log()
  37. @TaskGen.feature('test1')
  38. def d(self):
  39. self.log()
  40. @TaskGen.feature('test1')
  41. @TaskGen.after('f')
  42. def e(self):
  43. self.log()
  44. @TaskGen.feature('test1')
  45. def f(self):
  46. self.log()
  47. def configure(conf):
  48. pass
  49. def build(bld):
  50. bld.failure = 0
  51. def stop_status(bld):
  52. if bld.failure:
  53. bld.fatal('One or several test failed, check the outputs above')
  54. bld.add_post_fun(stop_status)
  55. bld(features='test1', expected='cbdafe').check()