gyptest-all.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env python
  2. # Copyright (c) 2011 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 simple rules when using an explicit build target of 'all'.
  7. """
  8. import TestGyp
  9. test = TestGyp.TestGyp()
  10. test.run_gyp('no_action_with_rules_fails.gyp', chdir='src/noaction', status=1,
  11. stderr=None)
  12. test.run_gyp('actions.gyp', chdir='src')
  13. test.relocate('src', 'relocate/src')
  14. test.build('actions.gyp', test.ALL, chdir='relocate/src')
  15. expect = """\
  16. Hello from program.c
  17. Hello from function1.in
  18. Hello from function2.in
  19. """
  20. if test.format == 'xcode':
  21. chdir = 'relocate/src/subdir1'
  22. else:
  23. chdir = 'relocate/src'
  24. test.run_built_executable('program', chdir=chdir, stdout=expect)
  25. expect = """\
  26. Hello from program.c
  27. Hello from function3.in
  28. """
  29. if test.format == 'xcode':
  30. chdir = 'relocate/src/subdir3'
  31. else:
  32. chdir = 'relocate/src'
  33. test.run_built_executable('program2', chdir=chdir, stdout=expect)
  34. test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n')
  35. test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n')
  36. test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n')
  37. test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n')
  38. test.must_match('relocate/src/external/file1.external_rules.out',
  39. 'Hello from file1.in\n')
  40. test.must_match('relocate/src/external/file2.external_rules.out',
  41. 'Hello from file2.in\n')
  42. expect = """\
  43. Hello from program.c
  44. Got 41.
  45. """
  46. if test.format == 'xcode':
  47. chdir = 'relocate/src/subdir4'
  48. else:
  49. chdir = 'relocate/src'
  50. test.run_built_executable('program4', chdir=chdir, stdout=expect)
  51. test.pass_test()