gyptest-toplevel-dir.py 918 B

12345678910111213141516171819202122232425262728293031
  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 building a subsidiary dependent target from a .gyp file in a
  7. subdirectory, without specifying an explicit output build directory,
  8. and using the subdirectory's solution or project file as the entry point.
  9. """
  10. import TestGyp
  11. import errno
  12. test = TestGyp.TestGyp(formats=['ninja', 'make'])
  13. # We want our Makefile to be one dir up from main.gyp.
  14. test.run_gyp('main.gyp', '--toplevel-dir=..', chdir='src/sub1')
  15. toplevel_dir = 'src'
  16. test.build('sub1/main.gyp', test.ALL, chdir=toplevel_dir)
  17. test.built_file_must_exist('prog1', type=test.EXECUTABLE, chdir=toplevel_dir)
  18. test.run_built_executable('prog1',
  19. chdir=toplevel_dir,
  20. stdout="Hello from prog1.c\n")
  21. test.pass_test()