gyptest-all.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # Copyright (c) 2009 Google Inc. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """
  6. Verifies that a rule that generates multiple outputs rebuilds
  7. correctly when the inputs change.
  8. """
  9. import TestGyp
  10. test = TestGyp.TestGyp(workdir='workarea_all')
  11. test.run_gyp('same_target.gyp', chdir='src')
  12. test.relocate('src', 'relocate/src')
  13. test.build('same_target.gyp', test.ALL, chdir='relocate/src')
  14. expect = """\
  15. Hello from main.c
  16. Hello from prog1.in!
  17. Hello from prog2.in!
  18. """
  19. test.run_built_executable('program', chdir='relocate/src', stdout=expect)
  20. test.up_to_date('same_target.gyp', 'program', chdir='relocate/src')
  21. test.sleep()
  22. contents = test.read(['relocate', 'src', 'prog1.in'])
  23. contents = contents.replace('!', ' AGAIN!')
  24. test.write(['relocate', 'src', 'prog1.in'], contents)
  25. test.build('same_target.gyp', test.ALL, chdir='relocate/src')
  26. expect = """\
  27. Hello from main.c
  28. Hello from prog1.in AGAIN!
  29. Hello from prog2.in!
  30. """
  31. test.run_built_executable('program', chdir='relocate/src', stdout=expect)
  32. test.up_to_date('same_target.gyp', 'program', chdir='relocate/src')
  33. test.sleep()
  34. contents = test.read(['relocate', 'src', 'prog2.in'])
  35. contents = contents.replace('!', ' AGAIN!')
  36. test.write(['relocate', 'src', 'prog2.in'], contents)
  37. test.build('same_target.gyp', test.ALL, chdir='relocate/src')
  38. expect = """\
  39. Hello from main.c
  40. Hello from prog1.in AGAIN!
  41. Hello from prog2.in AGAIN!
  42. """
  43. test.run_built_executable('program', chdir='relocate/src', stdout=expect)
  44. test.up_to_date('same_target.gyp', 'program', chdir='relocate/src')
  45. test.pass_test()