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('no_action_with_rules_fails.gyp', chdir='src/noaction', status=1,
     16              stderr=None)
     17 
     18 test.run_gyp('actions.gyp', chdir='src')
     19 
     20 test.relocate('src', 'relocate/src')
     21 
     22 test.build('actions.gyp', test.ALL, chdir='relocate/src')
     23 
     24 expect = """\
     25 Hello from program.c
     26 Hello from function1.in
     27 Hello from function2.in
     28 """
     29 
     30 if test.format == 'xcode':
     31   chdir = 'relocate/src/subdir1'
     32 else:
     33   chdir = 'relocate/src'
     34 test.run_built_executable('program', chdir=chdir, stdout=expect)
     35 
     36 expect = """\
     37 Hello from program.c
     38 Hello from function3.in
     39 """
     40 
     41 if test.format == 'xcode':
     42   chdir = 'relocate/src/subdir3'
     43 else:
     44   chdir = 'relocate/src'
     45 test.run_built_executable('program2', chdir=chdir, stdout=expect)
     46 
     47 test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n')
     48 test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n')
     49 
     50 test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n')
     51 test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n')
     52 
     53 test.must_match('relocate/src/subdir2/file1.out4', 'Hello from file1.in\n')
     54 test.must_match('relocate/src/subdir2/file2.out4', 'Hello from file2.in\n')
     55 test.must_match('relocate/src/subdir2/file1.copy', 'Hello from file1.in\n')
     56 
     57 test.must_match('relocate/src/external/file1.external_rules.out',
     58                 'Hello from file1.in\n')
     59 test.must_match('relocate/src/external/file2.external_rules.out',
     60                 'Hello from file2.in\n')
     61 
     62 expect = """\
     63 Hello from program.c
     64 Got 41.
     65 """
     66 
     67 if test.format == 'xcode':
     68   chdir = 'relocate/src/subdir4'
     69 else:
     70   chdir = 'relocate/src'
     71 test.run_built_executable('program4', chdir=chdir, stdout=expect)
     72 
     73 test.pass_test()
     74