1 #!/usr/bin/env python 2 3 # Copyright (c) 2012 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 targets have independent INTERMEDIATE_DIRs. 9 """ 10 11 import TestGyp 12 13 test = TestGyp.TestGyp() 14 15 test.run_gyp('test.gyp', chdir='src') 16 17 test.build('test.gyp', 'target1', chdir='src') 18 # Check stuff exists. 19 intermediate_file1 = test.read('src/outfile.txt') 20 test.must_contain(intermediate_file1, 'target1') 21 22 shared_intermediate_file1 = test.read('src/shared_outfile.txt') 23 test.must_contain(shared_intermediate_file1, 'shared_target1') 24 25 test.run_gyp('test2.gyp', chdir='src') 26 27 # Force the shared intermediate to be rebuilt. 28 test.sleep() 29 test.touch('src/shared_infile.txt') 30 test.build('test2.gyp', 'target2', chdir='src') 31 # Check INTERMEDIATE_DIR file didn't get overwritten but SHARED_INTERMEDIATE_DIR 32 # file did. 33 intermediate_file2 = test.read('src/outfile.txt') 34 test.must_contain(intermediate_file1, 'target1') 35 test.must_contain(intermediate_file2, 'target2') 36 37 shared_intermediate_file2 = test.read('src/shared_outfile.txt') 38 if shared_intermediate_file1 != shared_intermediate_file2: 39 test.fail_test(shared_intermediate_file1 + ' != ' + shared_intermediate_file2) 40 41 test.must_contain(shared_intermediate_file1, 'shared_target2') 42 test.must_contain(shared_intermediate_file2, 'shared_target2') 43 44 test.pass_test() 45