PageRenderTime 57ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/src/3rdparty/webkit/Source/ThirdParty/gyp/test/actions/gyptest-all.py

https://bitbucket.org/jjgod/qt-vtl
Python | 94 lines | 84 code | 3 blank | 7 comment | 0 complexity | 9e44916685a8fd120260602da03f8ff6 MD5 | raw file
Possible License(s): LGPL-3.0, BSD-3-Clause, CC0-1.0, CC-BY-SA-4.0, LGPL-2.1, GPL-3.0, Apache-2.0, LGPL-2.0
  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 simple actions when using an explicit build target of 'all'.
  7. """
  8. import glob
  9. import os
  10. import TestGyp
  11. test = TestGyp.TestGyp()
  12. test.run_gyp('actions.gyp', chdir='src')
  13. test.relocate('src', 'relocate/src')
  14. # Test that an "always run" action increases a counter on multiple invocations,
  15. # and that a dependent action updates in step.
  16. test.build('actions.gyp', test.ALL, chdir='relocate/src')
  17. test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
  18. test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
  19. test.build('actions.gyp', test.ALL, chdir='relocate/src')
  20. test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
  21. test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
  22. # The "always run" action only counts to 2, but the dependent target will count
  23. # forever if it's allowed to run. This verifies that the dependent target only
  24. # runs when the "always run" action generates new output, not just because the
  25. # "always run" ran.
  26. test.build('actions.gyp', test.ALL, chdir='relocate/src')
  27. test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
  28. test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
  29. expect = """\
  30. Hello from program.c
  31. Hello from make-prog1.py
  32. Hello from make-prog2.py
  33. """
  34. if test.format == 'xcode':
  35. chdir = 'relocate/src/subdir1'
  36. else:
  37. chdir = 'relocate/src'
  38. test.run_built_executable('program', chdir=chdir, stdout=expect)
  39. test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
  40. expect = "Hello from generate_main.py\n"
  41. if test.format == 'xcode':
  42. chdir = 'relocate/src/subdir3'
  43. else:
  44. chdir = 'relocate/src'
  45. test.run_built_executable('null_input', chdir=chdir, stdout=expect)
  46. # Clean out files which may have been created if test.ALL was run.
  47. def clean_dep_files():
  48. for file in (glob.glob('relocate/src/dep_*.txt') +
  49. glob.glob('relocate/src/deps_all_done_*.txt')):
  50. if os.path.exists(file):
  51. os.remove(file)
  52. # Confirm our clean.
  53. clean_dep_files()
  54. test.must_not_exist('relocate/src/dep_1.txt')
  55. test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
  56. # Make sure all deps finish before an action is run on a 'None' target.
  57. # If using the Make builder, add -j to make things more difficult.
  58. arguments = []
  59. if test.format == 'make':
  60. arguments = ['-j']
  61. test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src',
  62. arguments=arguments)
  63. test.must_exist('relocate/src/deps_all_done_first_123.txt')
  64. # Try again with a target that has deps in reverse. Output files from
  65. # previous tests deleted. Confirm this execution did NOT run the ALL
  66. # target which would mess up our dep tests.
  67. clean_dep_files()
  68. test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src',
  69. arguments=arguments)
  70. test.must_exist('relocate/src/deps_all_done_first_321.txt')
  71. test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
  72. test.pass_test()