wscript 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #! /usr/bin/env python
  2. def options(ctx):
  3. pass
  4. def configure(ctx):
  5. ctx.load('mem_reducer')
  6. pass
  7. def build(bld):
  8. bld(features='make_a_lot')
  9. """
  10. Testcase for the mem_reducer.py tool
  11. """
  12. import itertools, random
  13. from waflib import Utils, Task, TaskGen, Runner
  14. random.seed(0)
  15. class a(Task.Task):
  16. def run(self):
  17. self.outputs[0].write('a')
  18. class b(Task.Task):
  19. after = ['a']
  20. def run(self):
  21. self.outputs[0].write('b')
  22. class c(Task.Task):
  23. after = ['b', 'c']
  24. def run(self):
  25. self.outputs[0].write('c')
  26. class d(Task.Task):
  27. after = ['c', 'a']
  28. def run(self):
  29. self.outputs[0].write('d')
  30. @TaskGen.feature('make_a_lot')
  31. def make_a_lot_of_tasks(self):
  32. src = self.path.find_resource('wscript')
  33. for x in range(9000):
  34. anode = self.path.find_or_declare('a%d' % x)
  35. self.create_task('a', [src], [anode])
  36. bnode = self.path.find_or_declare('b%d' % x)
  37. self.create_task('b', [src], [bnode])
  38. cnode = self.path.find_or_declare('c%d' % x)
  39. self.create_task('c', [src], [cnode])
  40. dnode = self.path.find_or_declare('d%d' % x)
  41. self.create_task('d', [src], [dnode])
  42. # shuffle the tasks, but in the same order
  43. #random.seed(0)
  44. #random.shuffle(self.tasks)