~ubuntu-branches/ubuntu/oneiric/mozc/oneiric

« back to all changes in this revision

Viewing changes to third_party/gyp/test/actions/gyptest-all.py

  • Committer: Bazaar Package Importer
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2010-07-14 03:26:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100714032647-13qjisj6m8cm8jdx
Tags: 0.12.410.102-1
* New upstream release (Closes: #588971).
  - Add mozc-server, mozc-utils-gui and scim-mozc packages.
* Update debian/rules.
  Add --gypdir option to build_mozc.py.
* Update debian/control.
  - Bumped standards-version to 3.9.0.
  - Update description.
* Add mozc icon (Closes: #588972).
* Add patch which revises issue 18.
  ibus_mozc_issue18.patch
* kFreeBSD build support.
  support_kfreebsd.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Copyright (c) 2009 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 actions when using an explicit build target of 'all'.
 
9
"""
 
10
 
 
11
import glob
 
12
import os
 
13
import TestGyp
 
14
 
 
15
test = TestGyp.TestGyp()
 
16
 
 
17
test.run_gyp('actions.gyp', chdir='src')
 
18
 
 
19
test.relocate('src', 'relocate/src')
 
20
 
 
21
# Test that an "always run" action increases a counter on multiple invocations,
 
22
# and that a dependent action updates in step.
 
23
test.build('actions.gyp', test.ALL, chdir='relocate/src')
 
24
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
 
25
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
 
26
test.build('actions.gyp', test.ALL, chdir='relocate/src')
 
27
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
 
28
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
 
29
 
 
30
# The "always run" action only counts to 2, but the dependent target will count
 
31
# forever if it's allowed to run. This verifies that the dependent target only
 
32
# runs when the "always run" action generates new output, not just because the
 
33
# "always run" ran.
 
34
test.build('actions.gyp', test.ALL, chdir='relocate/src')
 
35
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
 
36
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
 
37
 
 
38
expect = """\
 
39
Hello from program.c
 
40
Hello from make-prog1.py
 
41
Hello from make-prog2.py
 
42
"""
 
43
 
 
44
if test.format == 'xcode':
 
45
  chdir = 'relocate/src/subdir1'
 
46
else:
 
47
  chdir = 'relocate/src'
 
48
test.run_built_executable('program', chdir=chdir, stdout=expect)
 
49
 
 
50
 
 
51
test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
 
52
 
 
53
 
 
54
expect = "Hello from generate_main.py\n"
 
55
 
 
56
if test.format == 'xcode':
 
57
  chdir = 'relocate/src/subdir3'
 
58
else:
 
59
  chdir = 'relocate/src'
 
60
test.run_built_executable('null_input', chdir=chdir, stdout=expect)
 
61
 
 
62
 
 
63
# Clean out files which may have been created if test.ALL was run.
 
64
def clean_dep_files():
 
65
  for file in (glob.glob('relocate/src/dep_*.txt') +
 
66
               glob.glob('relocate/src/deps_all_done_*.txt')):
 
67
    if os.path.exists(file):
 
68
      os.remove(file)
 
69
 
 
70
# Confirm our clean.
 
71
clean_dep_files()
 
72
test.must_not_exist('relocate/src/dep_1.txt')
 
73
test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
 
74
 
 
75
# Make sure all deps finish before an action is run on a 'None' target.
 
76
# If using the Make builder, add -j to make things more difficult.
 
77
arguments = []
 
78
if test.format == 'make':
 
79
  arguments = ['-j']
 
80
test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src',
 
81
           arguments=arguments)
 
82
test.must_exist('relocate/src/deps_all_done_first_123.txt')
 
83
 
 
84
# Try again with a target that has deps in reverse.  Output files from
 
85
# previous tests deleted.  Confirm this execution did NOT run the ALL
 
86
# target which would mess up our dep tests.
 
87
clean_dep_files()
 
88
test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src',
 
89
           arguments=arguments)
 
90
test.must_exist('relocate/src/deps_all_done_first_321.txt')
 
91
test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
 
92
 
 
93
 
 
94
test.pass_test()