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