• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"""
8Verifies simple rules when using an explicit build target of 'all'.
9"""
10
11import TestGyp
12
13test = TestGyp.TestGyp()
14
15test.run_gyp('no_action_with_rules_fails.gyp', chdir='src/noaction', status=1,
16             stderr=None)
17
18test.run_gyp('actions.gyp', chdir='src')
19
20test.relocate('src', 'relocate/src')
21
22test.build('actions.gyp', test.ALL, chdir='relocate/src')
23
24expect = """\
25Hello from program.c
26Hello from function1.in
27Hello from function2.in
28"""
29
30if test.format == 'xcode':
31  chdir = 'relocate/src/subdir1'
32else:
33  chdir = 'relocate/src'
34test.run_built_executable('program', chdir=chdir, stdout=expect)
35
36expect = """\
37Hello from program.c
38Hello from function3.in
39"""
40
41if test.format == 'xcode':
42  chdir = 'relocate/src/subdir3'
43else:
44  chdir = 'relocate/src'
45test.run_built_executable('program2', chdir=chdir, stdout=expect)
46
47test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n')
48test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n')
49
50test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n')
51test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n')
52
53test.must_match('relocate/src/external/file1.external_rules.out',
54                'Hello from file1.in\n')
55test.must_match('relocate/src/external/file2.external_rules.out',
56                'Hello from file2.in\n')
57
58expect = """\
59Hello from program.c
60Got 41.
61"""
62
63if test.format == 'xcode':
64  chdir = 'relocate/src/subdir4'
65else:
66  chdir = 'relocate/src'
67test.run_built_executable('program4', chdir=chdir, stdout=expect)
68
69test.pass_test()
70