1#!/usr/bin/env python
2
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.
6
7"""
8Verifies that a rule that generates multiple outputs rebuilds
9correctly when the inputs change.
10"""
11
12import TestGyp
13
14test = TestGyp.TestGyp(workdir='workarea_all')
15
16test.run_gyp('same_target.gyp', chdir='src')
17
18test.relocate('src', 'relocate/src')
19
20
21test.build('same_target.gyp', test.ALL, chdir='relocate/src')
22
23expect = """\
24Hello from main.c
25Hello from prog1.in!
26Hello from prog2.in!
27"""
28
29test.run_built_executable('program', chdir='relocate/src', stdout=expect)
30
31test.up_to_date('same_target.gyp', 'program', chdir='relocate/src')
32
33
34test.sleep()
35contents = test.read(['relocate', 'src', 'prog1.in'])
36contents = contents.replace('!', ' AGAIN!')
37test.write(['relocate', 'src', 'prog1.in'], contents)
38
39test.build('same_target.gyp', test.ALL, chdir='relocate/src')
40
41expect = """\
42Hello from main.c
43Hello from prog1.in AGAIN!
44Hello from prog2.in!
45"""
46
47test.run_built_executable('program', chdir='relocate/src', stdout=expect)
48
49test.up_to_date('same_target.gyp', 'program', chdir='relocate/src')
50
51
52test.sleep()
53contents = test.read(['relocate', 'src', 'prog2.in'])
54contents = contents.replace('!', ' AGAIN!')
55test.write(['relocate', 'src', 'prog2.in'], contents)
56
57test.build('same_target.gyp', test.ALL, chdir='relocate/src')
58
59expect = """\
60Hello from main.c
61Hello from prog1.in AGAIN!
62Hello from prog2.in AGAIN!
63"""
64
65test.run_built_executable('program', chdir='relocate/src', stdout=expect)
66
67test.up_to_date('same_target.gyp', 'program', chdir='relocate/src')
68
69
70test.pass_test()
71