gyptest-all.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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',
  13. '-G', 'xcode_ninja_target_pattern=^pull_in_all_actions$',
  14. chdir='src')
  15. test.relocate('src', 'relocate/src')
  16. test.build('actions.gyp', test.ALL, chdir='relocate/src')
  17. expect = """\
  18. Hello from program.c
  19. Hello from function1.in
  20. Hello from function2.in
  21. """
  22. if test.format == 'xcode':
  23. chdir = 'relocate/src/subdir1'
  24. else:
  25. chdir = 'relocate/src'
  26. test.run_built_executable('program', chdir=chdir, stdout=expect)
  27. expect = """\
  28. Hello from program.c
  29. Hello from function3.in
  30. """
  31. if test.format == 'xcode':
  32. chdir = 'relocate/src/subdir3'
  33. else:
  34. chdir = 'relocate/src'
  35. test.run_built_executable('program2', chdir=chdir, stdout=expect)
  36. test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n')
  37. test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n')
  38. test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n')
  39. test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n')
  40. test.must_match('relocate/src/subdir2/file1.out4', 'Hello from file1.in\n')
  41. test.must_match('relocate/src/subdir2/file2.out4', 'Hello from file2.in\n')
  42. test.must_match('relocate/src/subdir2/file1.copy', 'Hello from file1.in\n')
  43. test.must_match('relocate/src/external/file1.external_rules.out',
  44. 'Hello from file1.in\n')
  45. test.must_match('relocate/src/external/file2.external_rules.out',
  46. 'Hello from file2.in\n')
  47. expect = """\
  48. Hello from program.c
  49. Got 41.
  50. """
  51. if test.format == 'xcode':
  52. chdir = 'relocate/src/subdir4'
  53. else:
  54. chdir = 'relocate/src'
  55. test.run_built_executable('program4', chdir=chdir, stdout=expect)
  56. test.pass_test()