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