gyptest-dirname.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. import os
  10. import sys
  11. test = TestGyp.TestGyp(formats=['make', 'ninja', 'android', 'xcode', 'msvs'])
  12. test.run_gyp('actions.gyp', chdir='src')
  13. test.relocate('src', 'relocate/src')
  14. test.build('actions.gyp', chdir='relocate/src')
  15. expect = """\
  16. no dir here
  17. hi c
  18. hello baz
  19. """
  20. if test.format == 'xcode':
  21. chdir = 'relocate/src/subdir'
  22. else:
  23. chdir = 'relocate/src'
  24. test.run_built_executable('gencc_int_output', chdir=chdir, stdout=expect)
  25. if test.format == 'msvs':
  26. test.run_built_executable('gencc_int_output_external', chdir=chdir,
  27. stdout=expect)
  28. test.must_match('relocate/src/subdir/foo/bar/baz.dirname',
  29. os.path.join('foo', 'bar'))
  30. test.must_match('relocate/src/subdir/a/b/c.dirname',
  31. os.path.join('a', 'b'))
  32. # FIXME the xcode and make generators incorrectly convert RULE_INPUT_PATH
  33. # to an absolute path, making the tests below fail!
  34. if test.format != 'xcode' and test.format != 'make':
  35. test.must_match('relocate/src/subdir/foo/bar/baz.path',
  36. os.path.join('foo', 'bar', 'baz.printvars'))
  37. test.must_match('relocate/src/subdir/a/b/c.path',
  38. os.path.join('a', 'b', 'c.printvars'))
  39. test.pass_test()