Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | # Copyright (c) 2013 Google Inc. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | """ |
| 8 | Verifies that Makefiles get rebuilt when a source gyp file changes and |
| 9 | --generator-output is used. |
| 10 | """ |
| 11 | |
| 12 | import TestGyp |
| 13 | |
| 14 | # Regenerating build files when a gyp file changes is currently only supported |
| 15 | # by the make generator, and --generator-output is not supported by ninja, so we |
| 16 | # can only test for make. |
| 17 | test = TestGyp.TestGyp(formats=['make']) |
| 18 | |
| 19 | CHDIR='generator-output' |
| 20 | |
| 21 | test.run_gyp('hello.gyp', '--generator-output=%s' % CHDIR) |
| 22 | |
| 23 | test.build('hello.gyp', test.ALL, chdir=CHDIR) |
| 24 | |
| 25 | test.run_built_executable('hello', stdout="Hello, world!\n", chdir=CHDIR) |
| 26 | |
| 27 | # Sleep so that the changed gyp file will have a newer timestamp than the |
| 28 | # previously generated build files. |
| 29 | test.sleep() |
| 30 | test.write('hello.gyp', test.read('hello2.gyp')) |
| 31 | |
| 32 | test.build('hello.gyp', test.ALL, chdir=CHDIR) |
| 33 | |
| 34 | test.run_built_executable('hello', stdout="Hello, two!\n", chdir=CHDIR) |
| 35 | |
| 36 | test.pass_test() |