michael@0: #!/usr/bin/env python michael@0: michael@0: # Copyright (c) 2012 Google Inc. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: """ michael@0: Verifies that targets have independent INTERMEDIATE_DIRs. michael@0: """ michael@0: michael@0: import TestGyp michael@0: michael@0: test = TestGyp.TestGyp() michael@0: michael@0: test.run_gyp('test.gyp', chdir='src') michael@0: test.build('test.gyp', 'target1', chdir='src') michael@0: # Check stuff exists. michael@0: intermediate_file1 = test.read('src/outfile.txt') michael@0: test.must_contain(intermediate_file1, 'target1') michael@0: michael@0: shared_intermediate_file1 = test.read('src/shared_outfile.txt') michael@0: test.must_contain(shared_intermediate_file1, 'shared_target1') michael@0: michael@0: test.run_gyp('test2.gyp', chdir='src') michael@0: # Force the shared intermediate to be rebuilt. michael@0: test.sleep() michael@0: test.touch('src/shared_infile.txt') michael@0: test.build('test2.gyp', 'target2', chdir='src') michael@0: # Check INTERMEDIATE_DIR file didn't get overwritten but SHARED_INTERMEDIATE_DIR michael@0: # file did. michael@0: intermediate_file2 = test.read('src/outfile.txt') michael@0: test.must_contain(intermediate_file1, 'target1') michael@0: test.must_contain(intermediate_file2, 'target2') michael@0: michael@0: shared_intermediate_file2 = test.read('src/shared_outfile.txt') michael@0: if shared_intermediate_file1 != shared_intermediate_file2: michael@0: test.fail_test(shared_intermediate_file1 + ' != ' + shared_intermediate_file2) michael@0: michael@0: test.must_contain(shared_intermediate_file1, 'shared_target2') michael@0: test.must_contain(shared_intermediate_file2, 'shared_target2') michael@0: michael@0: test.pass_test()