Home | History | Annotate | Download | only in rules
      1 #!/usr/bin/env python
      2 
      3 # Copyright (c) 2011 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 simple rules when using an explicit build target of 'all'.
      9 """
     10 
     11 import TestGyp
     12 
     13 test = TestGyp.TestGyp()
     14 
     15 test.run_gyp('actions.gyp', chdir='src')
     16 
     17 test.relocate('src', 'relocate/src')
     18 
     19 test.build('actions.gyp', chdir='relocate/src')
     20 
     21 expect = """\
     22 Hello from program.c
     23 Hello from function1.in
     24 Hello from function2.in
     25 """
     26 
     27 if test.format == 'xcode':
     28   chdir = 'relocate/src/subdir1'
     29 else:
     30   chdir = 'relocate/src'
     31 test.run_built_executable('program', chdir=chdir, stdout=expect)
     32 
     33 expect = """\
     34 Hello from program.c
     35 Hello from function3.in
     36 """
     37 
     38 if test.format == 'xcode':
     39   chdir = 'relocate/src/subdir3'
     40 else:
     41   chdir = 'relocate/src'
     42 test.run_built_executable('program2', chdir=chdir, stdout=expect)
     43 
     44 test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n')
     45 test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n')
     46 
     47 test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n')
     48 test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n')
     49 
     50 test.must_match('relocate/src/subdir2/file1.out4', 'Hello from file1.in\n')
     51 test.must_match('relocate/src/subdir2/file2.out4', 'Hello from file2.in\n')
     52 test.must_match('relocate/src/subdir2/file1.copy', 'Hello from file1.in\n')
     53 
     54 test.must_match('relocate/src/external/file1.external_rules.out',
     55                 'Hello from file1.in\n')
     56 test.must_match('relocate/src/external/file2.external_rules.out',
     57                 'Hello from file2.in\n')
     58 
     59 test.pass_test()
     60