3
# Copyright (c) 2009 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.
8
Verifies simple actions when using an explicit build target of 'all'.
15
test = TestGyp.TestGyp()
17
test.run_gyp('actions.gyp', chdir='src')
19
test.relocate('src', 'relocate/src')
21
# Test that an "always run" action increases a counter on multiple invocations,
22
# and that a dependent action updates in step.
23
test.build('actions.gyp', test.ALL, chdir='relocate/src')
24
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
25
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
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')
30
# The "always run" action only counts to 2, but the dependent target will count
31
# forever if it's allowed to run. This verifies that the dependent target only
32
# runs when the "always run" action generates new output, not just because the
34
test.build('actions.gyp', test.ALL, chdir='relocate/src')
35
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
36
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
40
Hello from make-prog1.py
41
Hello from make-prog2.py
44
if test.format == 'xcode':
45
chdir = 'relocate/src/subdir1'
47
chdir = 'relocate/src'
48
test.run_built_executable('program', chdir=chdir, stdout=expect)
51
test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
54
expect = "Hello from generate_main.py\n"
56
if test.format == 'xcode':
57
chdir = 'relocate/src/subdir3'
59
chdir = 'relocate/src'
60
test.run_built_executable('null_input', chdir=chdir, stdout=expect)
63
# Clean out files which may have been created if test.ALL was run.
64
def clean_dep_files():
65
for file in (glob.glob('relocate/src/dep_*.txt') +
66
glob.glob('relocate/src/deps_all_done_*.txt')):
67
if os.path.exists(file):
72
test.must_not_exist('relocate/src/dep_1.txt')
73
test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
75
# Make sure all deps finish before an action is run on a 'None' target.
76
# If using the Make builder, add -j to make things more difficult.
78
if test.format == 'make':
80
test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src',
82
test.must_exist('relocate/src/deps_all_done_first_123.txt')
84
# Try again with a target that has deps in reverse. Output files from
85
# previous tests deleted. Confirm this execution did NOT run the ALL
86
# target which would mess up our dep tests.
88
test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src',
90
test.must_exist('relocate/src/deps_all_done_first_321.txt')
91
test.must_not_exist('relocate/src/deps_all_done_first_123.txt')