mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 21:07:30 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies actions which are not depended on by other targets get executed.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
test.run_gyp('bare.gyp', chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
test.build('bare.gyp', chdir='relocate/src')
|
||||
|
||||
file_content = 'Hello from bare.py\n'
|
||||
|
||||
test.built_file_must_match('out.txt', file_content, chdir='relocate/src')
|
||||
|
||||
test.pass_test()
|
||||
25
media/webrtc/trunk/tools/gyp/test/actions-bare/src/bare.gyp
Normal file
25
media/webrtc/trunk/tools/gyp/test/actions-bare/src/bare.gyp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'bare',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action1',
|
||||
'inputs': [
|
||||
'bare.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/out.txt',
|
||||
],
|
||||
'action': ['python', 'bare.py', '<(PRODUCT_DIR)/out.txt'],
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
11
media/webrtc/trunk/tools/gyp/test/actions-bare/src/bare.py
Normal file
11
media/webrtc/trunk/tools/gyp/test/actions-bare/src/bare.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
f = open(sys.argv[1], 'wb')
|
||||
f.write('Hello from bare.py\n')
|
||||
f.close()
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'depfile_target',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'depfile_action',
|
||||
'inputs': [
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'output.txt',
|
||||
],
|
||||
'depfile': 'depfile.d',
|
||||
'action': [ ]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Verifies that depfile fields are output in ninja rules."""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
if test.format == 'ninja':
|
||||
test.run_gyp('depfile.gyp')
|
||||
contents = open(test.built_file_path('obj/depfile_target.ninja')).read()
|
||||
|
||||
expected = 'depfile = depfile.d'
|
||||
if expected not in contents:
|
||||
test.fail_test()
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1 @@
|
|||
input
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies actions with multiple outputs & dependncies will correctly rebuild.
|
||||
|
||||
This is a regression test for crrev.com/1177163002.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
if sys.platform in ('darwin', 'win32'):
|
||||
print "This test is currently disabled: https://crbug.com/483696."
|
||||
sys.exit(0)
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
TESTDIR='relocate/src'
|
||||
test.run_gyp('action.gyp', chdir='src')
|
||||
test.relocate('src', TESTDIR)
|
||||
|
||||
def build_and_check(content):
|
||||
test.write(TESTDIR + '/input.txt', content)
|
||||
test.build('action.gyp', 'upper', chdir=TESTDIR)
|
||||
test.built_file_must_match('result.txt', content, chdir=TESTDIR)
|
||||
|
||||
build_and_check('Content for first build.')
|
||||
|
||||
# Ninja works with timestamps and the test above is fast enough that the
|
||||
# 'updated' file may end up with the same timestamp as the original, meaning
|
||||
# that ninja may not always recognize the input file has changed.
|
||||
if test.format == 'ninja':
|
||||
time.sleep(1)
|
||||
|
||||
build_and_check('An updated input file.')
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'upper',
|
||||
'type': 'none',
|
||||
'actions': [{
|
||||
'action_name': 'upper_action',
|
||||
'inputs': ['<(PRODUCT_DIR)/out2.txt'],
|
||||
'outputs': ['<(PRODUCT_DIR)/result.txt'],
|
||||
'action': ['python', 'rcopy.py', '<@(_inputs)', '<@(_outputs)'],
|
||||
}],
|
||||
},
|
||||
{
|
||||
'target_name': 'lower',
|
||||
'type': 'none',
|
||||
'actions': [{
|
||||
'action_name': 'lower_action',
|
||||
'inputs': ['input.txt'],
|
||||
'outputs': ['<(PRODUCT_DIR)/out1.txt', '<(PRODUCT_DIR)/out2.txt'],
|
||||
'action': ['python', 'rcopy.py', '<@(_inputs)', '<@(_outputs)'],
|
||||
}],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
"""A slightly odd 'cp' implementation for this test.
|
||||
|
||||
This 'cp' can have many targets, but only one source. 'cp src dest1 dest2'
|
||||
will copy the file 'src' to both 'dest1' and 'dest2'."""
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
src = f.read()
|
||||
for dest in sys.argv[2:]:
|
||||
with open(dest, 'w') as f:
|
||||
f.write(src)
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies actions with multiple outputs will correctly rebuild.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
import os
|
||||
import sys
|
||||
|
||||
if sys.platform == 'win32':
|
||||
print "This test is currently disabled: https://crbug.com/483696."
|
||||
sys.exit(0)
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
test.run_gyp('multiple-outputs.gyp', chdir='src')
|
||||
|
||||
chdir = 'relocate/src'
|
||||
test.relocate('src', chdir)
|
||||
|
||||
def build_and_check():
|
||||
# Build + check that both outputs exist.
|
||||
test.build('multiple-outputs.gyp', chdir=chdir)
|
||||
test.built_file_must_exist('out1.txt', chdir=chdir)
|
||||
test.built_file_must_exist('out2.txt', chdir=chdir)
|
||||
|
||||
# Plain build.
|
||||
build_and_check()
|
||||
|
||||
# Remove either + rebuild. Both should exist (again).
|
||||
os.remove(test.built_file_path('out1.txt', chdir=chdir))
|
||||
build_and_check();
|
||||
|
||||
# Remove the other + rebuild. Both should exist (again).
|
||||
os.remove(test.built_file_path('out2.txt', chdir=chdir))
|
||||
build_and_check();
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'multiple-outputs',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action1',
|
||||
'inputs': [],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/out1.txt',
|
||||
'<(PRODUCT_DIR)/out2.txt',
|
||||
],
|
||||
'action': ['python', 'touch.py', '<@(_outputs)'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
"""Cross-platform touch."""
|
||||
|
||||
for fname in sys.argv[1:]:
|
||||
if os.path.exists(fname):
|
||||
os.utime(fname, None)
|
||||
else:
|
||||
open(fname, 'w').close()
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies two actions can be attached to the same input files.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
test.run_gyp('actions.gyp', chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
# Test of fine-grained dependencies for generators that can build individual
|
||||
# files on demand.
|
||||
# In particular:
|
||||
# - TargetA depends on TargetB.
|
||||
# - TargetA and TargetB are 'none' type with actions attached.
|
||||
# - TargetA has multiple actions.
|
||||
# - An output from one of the actions in TargetA (not the first listed),
|
||||
# is requested as the build target.
|
||||
# Ensure that TargetB gets built.
|
||||
#
|
||||
# This sub-test can only be done with generators/build tools that can
|
||||
# be asked to build individual files rather than whole targets (make, ninja).
|
||||
if test.format in ['make', 'ninja']:
|
||||
# Select location of target based on generator.
|
||||
if test.format == 'make':
|
||||
target = 'multi2.txt'
|
||||
elif test.format == 'ninja':
|
||||
if sys.platform in ['win32', 'cygwin']:
|
||||
target = '..\\..\\multi2.txt'
|
||||
else:
|
||||
target = '../../multi2.txt'
|
||||
else:
|
||||
assert False
|
||||
test.build('actions.gyp', chdir='relocate/src', target=target)
|
||||
test.must_contain('relocate/src/multi2.txt', 'hello there')
|
||||
test.must_contain('relocate/src/multi_dep.txt', 'hello there')
|
||||
|
||||
|
||||
# Test that two actions can be attached to the same inputs.
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
test.must_contain('relocate/src/output1.txt', 'hello there')
|
||||
test.must_contain('relocate/src/output2.txt', 'hello there')
|
||||
test.must_contain('relocate/src/output3.txt', 'hello there')
|
||||
test.must_contain('relocate/src/output4.txt', 'hello there')
|
||||
|
||||
# Test that process_outputs_as_sources works in conjuction with merged
|
||||
# actions.
|
||||
test.run_built_executable(
|
||||
'multiple_action_source_filter',
|
||||
chdir='relocate/src',
|
||||
stdout=(
|
||||
'{\n'
|
||||
'bar\n'
|
||||
'car\n'
|
||||
'dar\n'
|
||||
'ear\n'
|
||||
'}\n'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
# Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Have a long string so that actions will exceed xp 512 character
|
||||
# command limit on xp.
|
||||
'long_string':
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'multiple_action_target',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action1',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'output1.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action2',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'output2.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action3',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'output3.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action4',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'output4.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'multiple_action_source_filter',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'main.c',
|
||||
# TODO(bradnelson): add foo.c here once this issue is fixed:
|
||||
# http://code.google.com/p/gyp/issues/detail?id=175
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action1',
|
||||
'inputs': [
|
||||
'foo.c',
|
||||
'filter.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/output1.c',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
'action': [
|
||||
'python', 'filter.py', 'foo', 'bar', 'foo.c', '<@(_outputs)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action2',
|
||||
'inputs': [
|
||||
'foo.c',
|
||||
'filter.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/output2.c',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
'action': [
|
||||
'python', 'filter.py', 'foo', 'car', 'foo.c', '<@(_outputs)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action3',
|
||||
'inputs': [
|
||||
'foo.c',
|
||||
'filter.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/output3.c',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
'action': [
|
||||
'python', 'filter.py', 'foo', 'dar', 'foo.c', '<@(_outputs)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action4',
|
||||
'inputs': [
|
||||
'foo.c',
|
||||
'filter.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/output4.c',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
'action': [
|
||||
'python', 'filter.py', 'foo', 'ear', 'foo.c', '<@(_outputs)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'multiple_dependent_target',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action1',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'multi1.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'action_name': 'action2',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'multi2.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
'dependencies': [
|
||||
'multiple_required_target',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'multiple_required_target',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'multi_dep',
|
||||
'inputs': [
|
||||
'copy.py',
|
||||
'input.txt',
|
||||
],
|
||||
'outputs': [
|
||||
'multi_dep.txt',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<(_outputs)', '<(long_string)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
shutil.copyfile(sys.argv[1], sys.argv[2])
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
data = open(sys.argv[3], 'r').read()
|
||||
fh = open(sys.argv[4], 'w')
|
||||
fh.write(data.replace(sys.argv[1], sys.argv[2]))
|
||||
fh.close()
|
||||
11
media/webrtc/trunk/tools/gyp/test/actions-multiple/src/foo.c
Normal file
11
media/webrtc/trunk/tools/gyp/test/actions-multiple/src/foo.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void foo(void) {
|
||||
printf("foo\n");
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
hello there
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void bar(void);
|
||||
void car(void);
|
||||
void dar(void);
|
||||
void ear(void);
|
||||
|
||||
int main() {
|
||||
printf("{\n");
|
||||
bar();
|
||||
car();
|
||||
dar();
|
||||
ear();
|
||||
printf("}\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies actions can be in 'none' type targets with source files.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
test.run_gyp('none_with_source_files.gyp', chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
test.build('none_with_source_files.gyp', chdir='relocate/src')
|
||||
|
||||
file_content = 'foo.cc\n'
|
||||
|
||||
test.built_file_must_match('fake.out', file_content, chdir='relocate/src')
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
fh = open(sys.argv[-1], 'wb')
|
||||
for filename in sys.argv[1:-1]:
|
||||
fh.write(open(filename).read())
|
||||
fh.close()
|
||||
|
|
@ -0,0 +1 @@
|
|||
foo.cc
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Test that 'none' type targets can have .cc files in them.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'none_with_sources',
|
||||
'type': 'none',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'sources': [
|
||||
'foo.cc',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'fake_cross',
|
||||
'inputs': [
|
||||
'fake_cross.py',
|
||||
'<@(_sources)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/fake.out',
|
||||
],
|
||||
'action': [
|
||||
'python', '<@(_inputs)', '<@(_outputs)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Test actions that output to PRODUCT_DIR.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
# TODO fix this for xcode: http://code.google.com/p/gyp/issues/detail?id=88
|
||||
test = TestGyp.TestGyp(formats=['!xcode'])
|
||||
|
||||
test.run_gyp('none.gyp', chdir='src')
|
||||
|
||||
test.build('none.gyp', test.ALL, chdir='src')
|
||||
|
||||
file_content = 'Hello from make-file.py\n'
|
||||
subdir_file_content = 'Hello from make-subdir-file.py\n'
|
||||
|
||||
test.built_file_must_match('file.out', file_content, chdir='src')
|
||||
test.built_file_must_match('subdir_file.out', subdir_file_content, chdir='src')
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
contents = 'Hello from make-file.py\n'
|
||||
|
||||
open(sys.argv[1], 'wb').write(contents)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'file',
|
||||
'type': 'none',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'make-file',
|
||||
'inputs': [
|
||||
'make-file.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/file.out',
|
||||
],
|
||||
'action': [
|
||||
'python', '<(_inputs)', '<@(_outputs)',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
}
|
||||
],
|
||||
'dependencies': [
|
||||
'subdir/subdir.gyp:subdir_file',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
contents = 'Hello from make-subdir-file.py\n'
|
||||
|
||||
open(sys.argv[1], 'wb').write(contents)
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'subdir_file',
|
||||
'type': 'none',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'make-subdir-file',
|
||||
'inputs': [
|
||||
'make-subdir-file.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/subdir_file.out',
|
||||
],
|
||||
'action': [
|
||||
'python', '<(_inputs)', '<@(_outputs)',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2013 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
outfile = sys.argv[1]
|
||||
open(outfile, 'w').write('const char kFoo[] = "%s";' % sys.argv[2])
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "MyHeader.h"
|
||||
|
||||
int main() {
|
||||
printf("%s\n", kFoo);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Copyright (c) 2013 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'generate_header',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'inputs': [ ],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/MyHeader.h',
|
||||
],
|
||||
'action_name': 'generate header',
|
||||
'action': ['python', './action.py',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/MyHeader.h', 'foobar output' ],
|
||||
},
|
||||
],
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
{
|
||||
'target_name': 'program',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'generate_header',
|
||||
],
|
||||
'include_dirs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)',
|
||||
],
|
||||
'sources': [ 'main.cc' ],
|
||||
},
|
||||
],
|
||||
}
|
||||
101
media/webrtc/trunk/tools/gyp/test/actions/gyptest-all.py
Normal file
101
media/webrtc/trunk/tools/gyp/test/actions/gyptest-all.py
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies simple actions when using an explicit build target of 'all'.
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(workdir='workarea_all')
|
||||
|
||||
test.run_gyp('actions.gyp', chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
# Some gyp files use an action that mentions an output but never
|
||||
# writes it as a means to making the action run on every build. That
|
||||
# doesn't mesh well with ninja's semantics. TODO(evan): figure out
|
||||
# how to work always-run actions in to ninja.
|
||||
if test.format in ['ninja', 'xcode-ninja']:
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
else:
|
||||
# Test that an "always run" action increases a counter on multiple
|
||||
# invocations, and that a dependent action updates in step.
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
|
||||
|
||||
# The "always run" action only counts to 2, but the dependent target
|
||||
# will count forever if it's allowed to run. This verifies that the
|
||||
# dependent target only runs when the "always run" action generates
|
||||
# new output, not just because the "always run" ran.
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
|
||||
|
||||
expect = """\
|
||||
Hello from program.c
|
||||
Hello from make-prog1.py
|
||||
Hello from make-prog2.py
|
||||
"""
|
||||
|
||||
if test.format == 'xcode':
|
||||
chdir = 'relocate/src/subdir1'
|
||||
else:
|
||||
chdir = 'relocate/src'
|
||||
test.run_built_executable('program', chdir=chdir, stdout=expect)
|
||||
|
||||
|
||||
test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
|
||||
|
||||
|
||||
expect = "Hello from generate_main.py\n"
|
||||
|
||||
if test.format == 'xcode':
|
||||
chdir = 'relocate/src/subdir3'
|
||||
else:
|
||||
chdir = 'relocate/src'
|
||||
test.run_built_executable('null_input', chdir=chdir, stdout=expect)
|
||||
|
||||
|
||||
# Clean out files which may have been created if test.ALL was run.
|
||||
def clean_dep_files():
|
||||
for file in (glob.glob('relocate/src/dep_*.txt') +
|
||||
glob.glob('relocate/src/deps_all_done_*.txt')):
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
|
||||
# Confirm our clean.
|
||||
clean_dep_files()
|
||||
test.must_not_exist('relocate/src/dep_1.txt')
|
||||
test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
|
||||
|
||||
# Make sure all deps finish before an action is run on a 'None' target.
|
||||
# If using the Make builder, add -j to make things more difficult.
|
||||
arguments = []
|
||||
if test.format == 'make':
|
||||
arguments = ['-j']
|
||||
test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src',
|
||||
arguments=arguments)
|
||||
test.must_exist('relocate/src/deps_all_done_first_123.txt')
|
||||
|
||||
# Try again with a target that has deps in reverse. Output files from
|
||||
# previous tests deleted. Confirm this execution did NOT run the ALL
|
||||
# target which would mess up our dep tests.
|
||||
clean_dep_files()
|
||||
test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src',
|
||||
arguments=arguments)
|
||||
test.must_exist('relocate/src/deps_all_done_first_321.txt')
|
||||
test.must_not_exist('relocate/src/deps_all_done_first_123.txt')
|
||||
|
||||
|
||||
test.pass_test()
|
||||
68
media/webrtc/trunk/tools/gyp/test/actions/gyptest-default.py
Normal file
68
media/webrtc/trunk/tools/gyp/test/actions/gyptest-default.py
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies simple actions when using the default build target.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(workdir='workarea_default')
|
||||
|
||||
test.run_gyp('actions.gyp', chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
# Some gyp files use an action that mentions an output but never
|
||||
# writes it as a means to making the action run on every build. That
|
||||
# doesn't mesh well with ninja's semantics. TODO(evan): figure out
|
||||
# how to work always-run actions in to ninja.
|
||||
if test.format in ['ninja', 'xcode-ninja']:
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
else:
|
||||
# Test that an "always run" action increases a counter on multiple
|
||||
# invocations, and that a dependent action updates in step.
|
||||
test.build('actions.gyp', chdir='relocate/src')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1')
|
||||
test.build('actions.gyp', chdir='relocate/src')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
|
||||
|
||||
# The "always run" action only counts to 2, but the dependent target
|
||||
# will count forever if it's allowed to run. This verifies that the
|
||||
# dependent target only runs when the "always run" action generates
|
||||
# new output, not just because the "always run" ran.
|
||||
test.build('actions.gyp', test.ALL, chdir='relocate/src')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2')
|
||||
test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2')
|
||||
|
||||
expect = """\
|
||||
Hello from program.c
|
||||
Hello from make-prog1.py
|
||||
Hello from make-prog2.py
|
||||
"""
|
||||
|
||||
if test.format == 'xcode':
|
||||
chdir = 'relocate/src/subdir1'
|
||||
else:
|
||||
chdir = 'relocate/src'
|
||||
test.run_built_executable('program', chdir=chdir, stdout=expect)
|
||||
|
||||
|
||||
test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n")
|
||||
|
||||
|
||||
expect = "Hello from generate_main.py\n"
|
||||
|
||||
if test.format == 'xcode':
|
||||
chdir = 'relocate/src/subdir3'
|
||||
else:
|
||||
chdir = 'relocate/src'
|
||||
test.run_built_executable('null_input', chdir=chdir, stdout=expect)
|
||||
|
||||
|
||||
test.pass_test()
|
||||
24
media/webrtc/trunk/tools/gyp/test/actions/gyptest-errors.py
Normal file
24
media/webrtc/trunk/tools/gyp/test/actions/gyptest-errors.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies behavior for different action configuration errors:
|
||||
exit status of 1, and the expected error message must be in stderr.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(workdir='workarea_errors')
|
||||
|
||||
|
||||
test.run_gyp('action_missing_name.gyp', chdir='src', status=1, stderr=None)
|
||||
expect = [
|
||||
"Anonymous action in target broken_actions2. An action must have an 'action_name' field.",
|
||||
]
|
||||
test.must_contain_all_lines(test.stderr(), expect)
|
||||
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2013 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies that dependencies on generated headers work, even if the header has
|
||||
a mixed-case file name.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
CHDIR = 'generated-header'
|
||||
|
||||
test.run_gyp('test.gyp', chdir=CHDIR)
|
||||
test.build('test.gyp', 'program', chdir=CHDIR)
|
||||
test.up_to_date('test.gyp', 'program', chdir=CHDIR)
|
||||
|
||||
expect = 'foobar output\n'
|
||||
test.run_built_executable('program', chdir=CHDIR, stdout=expect)
|
||||
|
||||
# Change what's written to the generated header, regyp and rebuild, and check
|
||||
# that the change makes it to the executable and that the build is clean.
|
||||
test.sleep()
|
||||
test.write('generated-header/test.gyp',
|
||||
test.read('generated-header/test.gyp').replace('foobar', 'barbaz'))
|
||||
|
||||
test.run_gyp('test.gyp', chdir=CHDIR)
|
||||
test.build('test.gyp', 'program', chdir=CHDIR)
|
||||
test.up_to_date('test.gyp', 'program', chdir=CHDIR)
|
||||
|
||||
expect = 'barbaz output\n'
|
||||
test.run_built_executable('program', chdir=CHDIR, stdout=expect)
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'broken_actions2',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'inputs': [
|
||||
'no_name.input',
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'-c',
|
||||
'print \'missing name\'',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
114
media/webrtc/trunk/tools/gyp/test/actions/src/actions.gyp
Normal file
114
media/webrtc/trunk/tools/gyp/test/actions/src/actions.gyp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'pull_in_all_actions',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'subdir1/executable.gyp:*',
|
||||
'subdir2/none.gyp:*',
|
||||
'subdir3/null_input.gyp:*',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'depend_on_always_run_action',
|
||||
'type': 'none',
|
||||
'dependencies': [ 'subdir1/executable.gyp:counter' ],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'use_always_run_output',
|
||||
'inputs': [
|
||||
'subdir1/actions-out/action-counter.txt',
|
||||
'subdir1/counter.py',
|
||||
],
|
||||
'outputs': [
|
||||
'subdir1/actions-out/action-counter_2.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', 'subdir1/counter.py', '<(_outputs)',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
# Three deps which don't finish immediately.
|
||||
# Each one has a small delay then creates a file.
|
||||
# Delays are 1.0, 1.1, and 2.0 seconds.
|
||||
{
|
||||
'target_name': 'dep_1',
|
||||
'type': 'none',
|
||||
'actions': [{
|
||||
'inputs': [ 'actions.gyp' ],
|
||||
'outputs': [ 'dep_1.txt' ],
|
||||
'action_name': 'dep_1',
|
||||
'action': [ 'python', '-c',
|
||||
'import time; time.sleep(1); open(\'dep_1.txt\', \'w\')' ],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}],
|
||||
},
|
||||
{
|
||||
'target_name': 'dep_2',
|
||||
'type': 'none',
|
||||
'actions': [{
|
||||
'inputs': [ 'actions.gyp' ],
|
||||
'outputs': [ 'dep_2.txt' ],
|
||||
'action_name': 'dep_2',
|
||||
'action': [ 'python', '-c',
|
||||
'import time; time.sleep(1.1); open(\'dep_2.txt\', \'w\')' ],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}],
|
||||
},
|
||||
{
|
||||
'target_name': 'dep_3',
|
||||
'type': 'none',
|
||||
'actions': [{
|
||||
'inputs': [ 'actions.gyp' ],
|
||||
'outputs': [ 'dep_3.txt' ],
|
||||
'action_name': 'dep_3',
|
||||
'action': [ 'python', '-c',
|
||||
'import time; time.sleep(2.0); open(\'dep_3.txt\', \'w\')' ],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}],
|
||||
},
|
||||
|
||||
# An action which assumes the deps have completed.
|
||||
# Does NOT list the output files of it's deps as inputs.
|
||||
# On success create the file deps_all_done_first.txt.
|
||||
{
|
||||
'target_name': 'action_with_dependencies_123',
|
||||
'type': 'none',
|
||||
'dependencies': [ 'dep_1', 'dep_2', 'dep_3' ],
|
||||
'actions': [{
|
||||
'inputs': [ 'actions.gyp' ],
|
||||
'outputs': [ 'deps_all_done_first_123.txt' ],
|
||||
'action_name': 'action_with_dependencies_123',
|
||||
'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}],
|
||||
},
|
||||
# Same as above but with deps in reverse.
|
||||
{
|
||||
'target_name': 'action_with_dependencies_321',
|
||||
'type': 'none',
|
||||
'dependencies': [ 'dep_3', 'dep_2', 'dep_1' ],
|
||||
'actions': [{
|
||||
'inputs': [ 'actions.gyp' ],
|
||||
'outputs': [ 'deps_all_done_first_321.txt' ],
|
||||
'action_name': 'action_with_dependencies_321',
|
||||
'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}],
|
||||
},
|
||||
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2011 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Confirms presence of files generated by our targets we depend on.
|
||||
If they exist, create a new file.
|
||||
|
||||
Note target's input files are explicitly NOT defined in the gyp file
|
||||
so they can't easily be passed to this script as args.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
outfile = sys.argv[1] # Example value we expect: deps_all_done_first_123.txt
|
||||
if (os.path.exists("dep_1.txt") and
|
||||
os.path.exists("dep_2.txt") and
|
||||
os.path.exists("dep_3.txt")):
|
||||
open(outfile, "w")
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2010 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
||||
output = sys.argv[1]
|
||||
persistoutput = "%s.persist" % sys.argv[1]
|
||||
|
||||
count = 0
|
||||
try:
|
||||
count = open(persistoutput, 'r').read()
|
||||
except:
|
||||
pass
|
||||
count = int(count) + 1
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
max_count = int(sys.argv[2])
|
||||
if count > max_count:
|
||||
count = max_count
|
||||
|
||||
oldcount = 0
|
||||
try:
|
||||
oldcount = open(output, 'r').read()
|
||||
except:
|
||||
pass
|
||||
|
||||
# Save the count in a file that is undeclared, and thus hidden, to gyp. We need
|
||||
# to do this because, prior to running commands, some build systems deletes
|
||||
# any declared outputs, so we would lose our count if we just wrote to the
|
||||
# given output file.
|
||||
open(persistoutput, 'w').write('%d' % (count))
|
||||
|
||||
# Only write the given output file if the count has changed.
|
||||
if int(oldcount) != count:
|
||||
open(output, 'w').write('%d' % (count))
|
||||
# Sleep so the next run changes the file time sufficiently to make the build
|
||||
# detect the file as changed.
|
||||
time.sleep(1)
|
||||
|
||||
sys.exit(0)
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'program',
|
||||
'type': 'executable',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'sources': [
|
||||
'program.c',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'make-prog1',
|
||||
'inputs': [
|
||||
'make-prog1.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/prog1.c',
|
||||
],
|
||||
'action': [
|
||||
'python', '<(_inputs)', '<@(_outputs)',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
},
|
||||
{
|
||||
'action_name': 'make-prog2',
|
||||
'inputs': [
|
||||
'make-prog2.py',
|
||||
],
|
||||
'outputs': [
|
||||
'actions-out/prog2.c',
|
||||
],
|
||||
'action': [
|
||||
'python', '<(_inputs)', '<@(_outputs)',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'counter',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
# This action should always run, regardless of whether or not it's
|
||||
# inputs or the command-line change. We do this by creating a dummy
|
||||
# first output, which is always missing, thus causing the build to
|
||||
# always try to recreate it. Actual output files should be listed
|
||||
# after the dummy one, and dependent targets should list the real
|
||||
# output(s) in their inputs
|
||||
# (see '../actions.gyp:depend_on_always_run_action').
|
||||
'action_name': 'action_counter',
|
||||
'inputs': [
|
||||
'counter.py',
|
||||
],
|
||||
'outputs': [
|
||||
'actions-out/action-counter.txt.always',
|
||||
'actions-out/action-counter.txt',
|
||||
],
|
||||
'action': [
|
||||
'python', '<(_inputs)', 'actions-out/action-counter.txt', '2',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
contents = r"""
|
||||
#include <stdio.h>
|
||||
|
||||
void prog1(void)
|
||||
{
|
||||
printf("Hello from make-prog1.py\n");
|
||||
}
|
||||
"""
|
||||
|
||||
open(sys.argv[1], 'w').write(contents)
|
||||
|
||||
sys.exit(0)
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
contents = r"""
|
||||
#include <stdio.h>
|
||||
|
||||
void prog2(void)
|
||||
{
|
||||
printf("Hello from make-prog2.py\n");
|
||||
}
|
||||
"""
|
||||
|
||||
open(sys.argv[1], 'w').write(contents)
|
||||
|
||||
sys.exit(0)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern void prog1(void);
|
||||
extern void prog2(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from program.c\n");
|
||||
prog1();
|
||||
prog2();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
contents = "Hello from make-file.py\n"
|
||||
|
||||
open(sys.argv[1], 'wb').write(contents)
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'file',
|
||||
'type': 'none',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'make-file',
|
||||
'inputs': [
|
||||
'make-file.py',
|
||||
],
|
||||
'outputs': [
|
||||
'file.out',
|
||||
# TODO: enhance testing infrastructure to test this
|
||||
# without having to hard-code the intermediate dir paths.
|
||||
#'<(INTERMEDIATE_DIR)/file.out',
|
||||
],
|
||||
'action': [
|
||||
'python', '<(_inputs)', '<@(_outputs)',
|
||||
],
|
||||
'process_outputs_as_sources': 1,
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
contents = """
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from generate_main.py\\n");
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
open(sys.argv[1], 'w').write(contents)
|
||||
|
||||
sys.exit(0)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'null_input',
|
||||
'type': 'executable',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'generate_main',
|
||||
'process_outputs_as_sources': 1,
|
||||
'inputs': [],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/main.c',
|
||||
],
|
||||
'action': [
|
||||
# TODO: we can't just use <(_outputs) here?!
|
||||
'python', 'generate_main.py', '<(INTERMEDIATE_DIR)/main.c',
|
||||
],
|
||||
# Allows the test to run without hermetic cygwin on windows.
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies simple actions when using an explicit build target of 'all'.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp()
|
||||
|
||||
test.run_gyp('all.gyp',
|
||||
'-G', 'xcode_ninja_target_pattern=^all_targets$',
|
||||
chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
# Build all.
|
||||
test.build('all.gyp', chdir='relocate/src')
|
||||
|
||||
if test.format=='xcode':
|
||||
chdir = 'relocate/src/dir1'
|
||||
else:
|
||||
chdir = 'relocate/src'
|
||||
|
||||
# Output is as expected.
|
||||
file_content = 'Hello from emit.py\n'
|
||||
test.built_file_must_match('out2.txt', file_content, chdir=chdir)
|
||||
|
||||
test.built_file_must_not_exist('out.txt', chdir='relocate/src')
|
||||
test.built_file_must_not_exist('foolib1',
|
||||
type=test.SHARED_LIB,
|
||||
chdir=chdir)
|
||||
|
||||
# xcode-ninja doesn't generate separate workspaces for sub-gyps by design
|
||||
if test.format == 'xcode-ninja':
|
||||
test.pass_test()
|
||||
|
||||
# TODO(mmoss) Make consistent with msvs, with 'dir1' before 'out/Default'?
|
||||
if test.format in ('make', 'ninja', 'cmake'):
|
||||
chdir='relocate/src'
|
||||
else:
|
||||
chdir='relocate/src/dir1'
|
||||
|
||||
# Build the action explicitly.
|
||||
test.build('actions.gyp', 'action1_target', chdir=chdir)
|
||||
|
||||
# Check that things got run.
|
||||
file_content = 'Hello from emit.py\n'
|
||||
test.built_file_must_exist('out.txt', chdir=chdir)
|
||||
|
||||
# Build the shared library explicitly.
|
||||
test.build('actions.gyp', 'foolib1', chdir=chdir)
|
||||
|
||||
test.built_file_must_exist('foolib1',
|
||||
type=test.SHARED_LIB,
|
||||
chdir=chdir,
|
||||
subdir='dir1')
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'all_targets',
|
||||
'type': 'none',
|
||||
'dependencies': ['dir1/actions.gyp:*'],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'action1_target',
|
||||
'type': 'none',
|
||||
'suppress_wildcard': 1,
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action1',
|
||||
'inputs': [
|
||||
'emit.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/out.txt',
|
||||
],
|
||||
'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out.txt'],
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'action2_target',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action2',
|
||||
'inputs': [
|
||||
'emit.py',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/out2.txt',
|
||||
],
|
||||
'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out2.txt'],
|
||||
'msvs_cygwin_shell': 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'foolib1',
|
||||
'type': 'shared_library',
|
||||
'suppress_wildcard': 1,
|
||||
'sources': ['lib1.c'],
|
||||
},
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="linux"', {
|
||||
'target_defaults': {
|
||||
'cflags': ['-fPIC'],
|
||||
},
|
||||
}],
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
|
||||
f = open(sys.argv[1], 'wb')
|
||||
f.write('Hello from emit.py\n')
|
||||
f.close()
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int func1(void) {
|
||||
return 42;
|
||||
}
|
||||
6
media/webrtc/trunk/tools/gyp/test/analyzer/common.gypi
Normal file
6
media/webrtc/trunk/tools/gyp/test/analyzer/common.gypi
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
}
|
||||
425
media/webrtc/trunk/tools/gyp/test/analyzer/gyptest-analyzer.py
Normal file
425
media/webrtc/trunk/tools/gyp/test/analyzer/gyptest-analyzer.py
Normal file
|
|
@ -0,0 +1,425 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Tests for analyzer
|
||||
"""
|
||||
|
||||
import json
|
||||
import TestGyp
|
||||
|
||||
found = 'Found dependency'
|
||||
found_all = 'Found dependency (all)'
|
||||
not_found = 'No dependencies'
|
||||
|
||||
|
||||
def _CreateConfigFile(files, additional_compile_targets, test_targets=[]):
|
||||
"""Creates the analyzer config file, which is used as the input to analyzer.
|
||||
See description of analyzer.py for description of the arguments."""
|
||||
f = open('test_file', 'w')
|
||||
to_write = {'files': files,
|
||||
'test_targets': test_targets,
|
||||
'additional_compile_targets': additional_compile_targets }
|
||||
json.dump(to_write, f)
|
||||
f.close()
|
||||
|
||||
|
||||
def _CreateBogusConfigFile():
|
||||
f = open('test_file','w')
|
||||
f.write('bogus')
|
||||
f.close()
|
||||
|
||||
|
||||
def _ReadOutputFileContents():
|
||||
f = open('analyzer_output', 'r')
|
||||
result = json.load(f)
|
||||
f.close()
|
||||
return result
|
||||
|
||||
|
||||
# NOTE: this would be clearer if it subclassed TestGypCustom, but that trips
|
||||
# over a bug in pylint (E1002).
|
||||
test = TestGyp.TestGypCustom(format='analyzer')
|
||||
|
||||
def CommonArgs():
|
||||
return ('-Gconfig_path=test_file',
|
||||
'-Ganalyzer_output_path=analyzer_output')
|
||||
|
||||
|
||||
def run_analyzer(*args, **kw):
|
||||
"""Runs the test specifying a particular config and output path."""
|
||||
args += CommonArgs()
|
||||
test.run_gyp('test.gyp', *args, **kw)
|
||||
|
||||
|
||||
def run_analyzer2(*args, **kw):
|
||||
"""Same as run_analyzer(), but passes in test2.gyp instead of test.gyp."""
|
||||
args += CommonArgs()
|
||||
test.run_gyp('test2.gyp', *args, **kw)
|
||||
|
||||
|
||||
def run_analyzer3(*args, **kw):
|
||||
"""Same as run_analyzer(), but passes in test3.gyp instead of test.gyp."""
|
||||
args += CommonArgs()
|
||||
test.run_gyp('test3.gyp', *args, **kw)
|
||||
|
||||
|
||||
def run_analyzer4(*args, **kw):
|
||||
"""Same as run_analyzer(), but passes in test3.gyp instead of test.gyp."""
|
||||
args += CommonArgs()
|
||||
test.run_gyp('test4.gyp', *args, **kw)
|
||||
|
||||
|
||||
def EnsureContains(matched=False, compile_targets=set(), test_targets=set()):
|
||||
"""Verifies output contains |compile_targets|."""
|
||||
result = _ReadOutputFileContents()
|
||||
if 'error' in result:
|
||||
print 'unexpected error', result.get('error')
|
||||
test.fail_test()
|
||||
|
||||
if 'invalid_targets' in result:
|
||||
print 'unexpected invalid_targets', result.get('invalid_targets')
|
||||
test.fail_test()
|
||||
|
||||
actual_compile_targets = set(result['compile_targets'])
|
||||
if actual_compile_targets != compile_targets:
|
||||
print 'actual compile_targets:', actual_compile_targets, \
|
||||
'\nexpected compile_targets:', compile_targets
|
||||
test.fail_test()
|
||||
|
||||
actual_test_targets = set(result['test_targets'])
|
||||
if actual_test_targets != test_targets:
|
||||
print 'actual test_targets:', actual_test_targets, \
|
||||
'\nexpected test_targets:', test_targets
|
||||
test.fail_test()
|
||||
|
||||
if matched and result['status'] != found:
|
||||
print 'expected', found, 'got', result['status']
|
||||
test.fail_test()
|
||||
elif not matched and result['status'] != not_found:
|
||||
print 'expected', not_found, 'got', result['status']
|
||||
test.fail_test()
|
||||
|
||||
|
||||
def EnsureMatchedAll(compile_targets, test_targets=set()):
|
||||
result = _ReadOutputFileContents()
|
||||
if 'error' in result:
|
||||
print 'unexpected error', result.get('error')
|
||||
test.fail_test()
|
||||
|
||||
if 'invalid_targets' in result:
|
||||
print 'unexpected invalid_targets', result.get('invalid_targets')
|
||||
test.fail_test()
|
||||
|
||||
if result['status'] != found_all:
|
||||
print 'expected', found_all, 'got', result['status']
|
||||
test.fail_test()
|
||||
|
||||
actual_compile_targets = set(result['compile_targets'])
|
||||
if actual_compile_targets != compile_targets:
|
||||
print ('actual compile_targets:', actual_compile_targets,
|
||||
'\nexpected compile_targets:', compile_targets)
|
||||
test.fail_test()
|
||||
|
||||
actual_test_targets = set(result['test_targets'])
|
||||
if actual_test_targets != test_targets:
|
||||
print ('actual test_targets:', actual_test_targets,
|
||||
'\nexpected test_targets:', test_targets)
|
||||
test.fail_test()
|
||||
|
||||
|
||||
def EnsureError(expected_error_string):
|
||||
"""Verifies output contains the error string."""
|
||||
result = _ReadOutputFileContents()
|
||||
if result.get('error', '').find(expected_error_string) == -1:
|
||||
print 'actual error:', result.get('error', ''), '\nexpected error:', \
|
||||
expected_error_string
|
||||
test.fail_test()
|
||||
|
||||
|
||||
def EnsureStdoutContains(expected_error_string):
|
||||
if test.stdout().find(expected_error_string) == -1:
|
||||
print 'actual stdout:', test.stdout(), '\nexpected stdout:', \
|
||||
expected_error_string
|
||||
test.fail_test()
|
||||
|
||||
|
||||
def EnsureInvalidTargets(expected_invalid_targets):
|
||||
"""Verifies output contains invalid_targets."""
|
||||
result = _ReadOutputFileContents()
|
||||
actual_invalid_targets = set(result['invalid_targets'])
|
||||
if actual_invalid_targets != expected_invalid_targets:
|
||||
print 'actual invalid_targets:', actual_invalid_targets, \
|
||||
'\nexpected :', expected_invalid_targets
|
||||
test.fail_test()
|
||||
|
||||
|
||||
# Two targets, A and B (both static_libraries) and A depends upon B. If a file
|
||||
# in B changes, then both A and B are output. It is not strictly necessary that
|
||||
# A is compiled in this case, only B.
|
||||
_CreateConfigFile(['b.c'], ['all'])
|
||||
test.run_gyp('static_library_test.gyp', *CommonArgs())
|
||||
EnsureContains(matched=True, compile_targets={'a' ,'b'})
|
||||
|
||||
# Verifies config_path must be specified.
|
||||
test.run_gyp('test.gyp')
|
||||
EnsureStdoutContains('Must specify files to analyze via config_path')
|
||||
|
||||
# Verifies config_path must point to a valid file.
|
||||
test.run_gyp('test.gyp', '-Gconfig_path=bogus_file',
|
||||
'-Ganalyzer_output_path=analyzer_output')
|
||||
EnsureError('Unable to open file bogus_file')
|
||||
|
||||
# Verify 'invalid_targets' is present when bad target is specified.
|
||||
_CreateConfigFile(['exe2.c'], ['bad_target'])
|
||||
run_analyzer()
|
||||
EnsureInvalidTargets({'bad_target'})
|
||||
|
||||
# Verifies config_path must point to a valid json file.
|
||||
_CreateBogusConfigFile()
|
||||
run_analyzer()
|
||||
EnsureError('Unable to parse config file test_file')
|
||||
|
||||
# Trivial test of a source.
|
||||
_CreateConfigFile(['foo.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Conditional source that is excluded.
|
||||
_CreateConfigFile(['conditional_source.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Conditional source that is included by way of argument.
|
||||
_CreateConfigFile(['conditional_source.c'], ['all'])
|
||||
run_analyzer('-Dtest_variable=1')
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Two unknown files.
|
||||
_CreateConfigFile(['unknown1.c', 'unoknow2.cc'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains()
|
||||
|
||||
# Two unknown files.
|
||||
_CreateConfigFile(['unknown1.c', 'subdir/subdir_sourcex.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains()
|
||||
|
||||
# Included dependency
|
||||
_CreateConfigFile(['unknown1.c', 'subdir/subdir_source.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe', 'exe3'})
|
||||
|
||||
# Included inputs to actions.
|
||||
_CreateConfigFile(['action_input.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Don't consider outputs.
|
||||
_CreateConfigFile(['action_output.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Rule inputs.
|
||||
_CreateConfigFile(['rule_input.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Ignore path specified with PRODUCT_DIR.
|
||||
_CreateConfigFile(['product_dir_input.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Path specified via a variable.
|
||||
_CreateConfigFile(['subdir/subdir_source2.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Verifies paths with // are fixed up correctly.
|
||||
_CreateConfigFile(['parent_source.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe', 'exe3'})
|
||||
|
||||
# Verifies relative paths are resolved correctly.
|
||||
_CreateConfigFile(['subdir/subdir_source.h'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Verifies relative paths in inputs are resolved correctly.
|
||||
_CreateConfigFile(['rel_path1.h'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Various permutations when passing in targets.
|
||||
_CreateConfigFile(['exe2.c', 'subdir/subdir2b_source.c'],
|
||||
['all'], ['exe', 'exe3'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, test_targets={'exe3'},
|
||||
compile_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c', 'subdir/subdir2b_source.c'], ['all'], ['exe'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2', 'exe3'})
|
||||
|
||||
# Verifies duplicates are ignored.
|
||||
_CreateConfigFile(['exe2.c', 'subdir/subdir2b_source.c'], ['all'],
|
||||
['exe', 'exe'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], ['all'], ['exe'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['subdir/subdir2b_source.c', 'exe2.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['subdir/subdir2b_source.c'], ['all'], ['exe3'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, test_targets={'exe3'}, compile_targets={'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['foo.c'], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe'})
|
||||
|
||||
# Assertions when modifying build (gyp/gypi) files, especially when said files
|
||||
# are included.
|
||||
_CreateConfigFile(['subdir2/d.cc'], ['all'], ['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, test_targets={'exe', 'foo'},
|
||||
compile_targets={'exe', 'foo'})
|
||||
|
||||
_CreateConfigFile(['subdir2/subdir.includes.gypi'], ['all'],
|
||||
['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, test_targets={'exe', 'foo'},
|
||||
compile_targets={'exe', 'foo'})
|
||||
|
||||
_CreateConfigFile(['subdir2/subdir.gyp'], ['all'],
|
||||
['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, test_targets={'exe', 'foo'},
|
||||
compile_targets={'exe', 'foo'})
|
||||
|
||||
_CreateConfigFile(['test2.includes.gypi'], ['all'],
|
||||
['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, test_targets={'exe', 'exe2', 'exe3'},
|
||||
compile_targets={'exe', 'exe2', 'exe3'})
|
||||
|
||||
# Verify modifying a file included makes all targets dirty.
|
||||
_CreateConfigFile(['common.gypi'], ['all'], ['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2('-Icommon.gypi')
|
||||
EnsureMatchedAll({'all', 'exe', 'exe2', 'foo', 'exe3'},
|
||||
{'exe', 'exe2', 'foo', 'exe3'})
|
||||
|
||||
# Assertions from test3.gyp.
|
||||
_CreateConfigFile(['d.c', 'f.c'], ['all'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['f.c'], ['all'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['f.c'], ['all'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, compile_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['c.c', 'e.c'], ['all'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, compile_targets={'a', 'b', 'c', 'e'})
|
||||
|
||||
_CreateConfigFile(['d.c'], ['all'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['all'], ['a', 'b'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['all'], ['a', 'b'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['d.c'], ['all'], ['a', 'b'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a', 'b'},
|
||||
compile_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['f.c'], ['all'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['all'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, test_targets={'a'}, compile_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['all'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, compile_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['d.c'], ['all'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, compile_targets={'a', 'b'})
|
||||
|
||||
# Assertions around test4.gyp.
|
||||
_CreateConfigFile(['f.c'], ['all'])
|
||||
run_analyzer4()
|
||||
EnsureContains(matched=True, compile_targets={'e', 'f'})
|
||||
|
||||
_CreateConfigFile(['d.c'], ['all'])
|
||||
run_analyzer4()
|
||||
EnsureContains(matched=True, compile_targets={'a', 'b', 'c', 'd'})
|
||||
|
||||
_CreateConfigFile(['i.c'], ['all'])
|
||||
run_analyzer4()
|
||||
EnsureContains(matched=True, compile_targets={'h', 'i'})
|
||||
|
||||
# Assertions where 'all' is not supplied in compile_targets.
|
||||
|
||||
_CreateConfigFile(['exe2.c'], [], ['exe2'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, test_targets={'exe2'}, compile_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['exe20.c'], [], ['exe2'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
|
||||
_CreateConfigFile(['exe2.c', 'exe3.c'], [], ['exe2', 'exe3'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, test_targets={'exe2', 'exe3'},
|
||||
compile_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c', 'exe3.c'], ['exe3'], ['exe2'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, test_targets={'exe2'},
|
||||
compile_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe3.c'], ['exe2'], ['exe2'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Assertions with 'all' listed as a test_target.
|
||||
_CreateConfigFile(['exe3.c'], [], ['all'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe3', 'all'},
|
||||
test_targets={'all'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], [], ['all', 'exe2'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, compile_targets={'exe2', 'all'},
|
||||
test_targets={'all', 'exe2'})
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Copyright 2015 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# These gyp files create the following dependencies:
|
||||
#
|
||||
# test.gyp:
|
||||
# #a -> b
|
||||
# a.c
|
||||
# #b
|
||||
# b.c
|
||||
# a and b are static libraries.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'a',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'a.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'b',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'b',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'b.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
36
media/webrtc/trunk/tools/gyp/test/analyzer/subdir/subdir.gyp
Normal file
36
media/webrtc/trunk/tools/gyp/test/analyzer/subdir/subdir.gyp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'trailing_dir_path': '../',
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'foo',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'subdir_source.c',
|
||||
'<(trailing_dir_path)/parent_source.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'subdir2a',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'subdir2_source.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'subdir2b',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'subdir2b',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'subdir2b_source.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'subdir2',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'../subdir_source.h',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'foo',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'subdir_source.c',
|
||||
],
|
||||
'includes': [
|
||||
'subdir.includes.gypi',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'sources': [
|
||||
'd.cc'
|
||||
],
|
||||
}
|
||||
114
media/webrtc/trunk/tools/gyp/test/analyzer/test.gyp
Normal file
114
media/webrtc/trunk/tools/gyp/test/analyzer/test.gyp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# These gyp files create the following dependencies:
|
||||
#
|
||||
# test.gyp:
|
||||
# #exe -> subdir/subdir.gyp#foo, subdir/subdir2/subdir2.gyp#subdir2
|
||||
# foo.c
|
||||
# subdir/subdir_source2.c
|
||||
# conditional_source.c (if test_variable==1)
|
||||
# action_input.c
|
||||
# action_output.c
|
||||
# rule_input.c
|
||||
# rule_output.pdf
|
||||
# #exe2
|
||||
# exe2.c
|
||||
# #exe3 -> subdir/subdir.gyp#foo, subdir/subdir.gyp#subdir2a
|
||||
# exe3.c
|
||||
# #allx (type none) -> exe, exe3
|
||||
#
|
||||
# subdir/subdir.gyp
|
||||
# #foo
|
||||
# subdir/subdir_source.c
|
||||
# parent_source.c
|
||||
# #subdir2a -> subdir2b
|
||||
# subdir/subdir2_source.c
|
||||
# #subdir2b
|
||||
# subdir/subdir2b_source.c
|
||||
#
|
||||
# subdir/subdir2/subdir2.gyp
|
||||
# #subdir2
|
||||
# subdir/subdir_source.h
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'test_variable%': 0,
|
||||
'variable_path': 'subdir',
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'exe',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'subdir/subdir.gyp:foo',
|
||||
'subdir/subdir2/subdir2.gyp:subdir2',
|
||||
],
|
||||
'sources': [
|
||||
'foo.c',
|
||||
'<(variable_path)/subdir_source2.c',
|
||||
],
|
||||
'conditions': [
|
||||
['test_variable==1', {
|
||||
'sources': [
|
||||
'conditional_source.c',
|
||||
],
|
||||
}],
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'action',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/product_dir_input.c',
|
||||
'action_input.c',
|
||||
'../bad_path1.h',
|
||||
'../../bad_path2.h',
|
||||
'./rel_path1.h',
|
||||
],
|
||||
'outputs': [
|
||||
'action_output.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
'rules': [
|
||||
{
|
||||
'rule_name': 'rule',
|
||||
'extension': 'pdf',
|
||||
'inputs': [
|
||||
'rule_input.c',
|
||||
],
|
||||
'outputs': [
|
||||
'rule_output.pdf',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'exe2',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'exe2.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'exe3',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'subdir/subdir.gyp:foo',
|
||||
'subdir/subdir.gyp:subdir2a',
|
||||
],
|
||||
'sources': [
|
||||
'exe3.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'allx',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'exe',
|
||||
'exe3',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
25
media/webrtc/trunk/tools/gyp/test/analyzer/test2.gyp
Normal file
25
media/webrtc/trunk/tools/gyp/test/analyzer/test2.gyp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'exe',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'subdir2/subdir.gyp:foo',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'exe2',
|
||||
'type': 'executable',
|
||||
'includes': [
|
||||
'test2.includes.gypi',
|
||||
],
|
||||
},
|
||||
],
|
||||
'includes': [
|
||||
'test2.toplevel_includes.gypi',
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'sources': [
|
||||
'a.cc',
|
||||
'b.cc'
|
||||
],
|
||||
'includes': [
|
||||
'test2.includes.includes.gypi',
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'sources': [
|
||||
'c.cc'
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'exe3',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'e.cc',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
77
media/webrtc/trunk/tools/gyp/test/analyzer/test3.gyp
Normal file
77
media/webrtc/trunk/tools/gyp/test/analyzer/test3.gyp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'allx',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'a',
|
||||
'b',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'a',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'a.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'c',
|
||||
'd',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'b',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'b.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'd',
|
||||
'e',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'c',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'c.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'd',
|
||||
'type': 'none',
|
||||
'sources': [
|
||||
'd.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'f',
|
||||
'g',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'e',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'e.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'f',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'f.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'g',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'g.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
80
media/webrtc/trunk/tools/gyp/test/analyzer/test4.gyp
Normal file
80
media/webrtc/trunk/tools/gyp/test/analyzer/test4.gyp
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'a',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'a.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'b',
|
||||
'c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'b',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'b.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'd',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'c',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'c.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'b',
|
||||
'd',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'd',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'd.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'e',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'test5.gyp:f',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'h',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'i',
|
||||
],
|
||||
'rules': [
|
||||
{
|
||||
'rule_name': 'rule',
|
||||
'extension': 'pdf',
|
||||
'inputs': [
|
||||
'rule_input.c',
|
||||
],
|
||||
'outputs': [
|
||||
'rule_output.pdf',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'i',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'i.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
25
media/webrtc/trunk/tools/gyp/test/analyzer/test5.gyp
Normal file
25
media/webrtc/trunk/tools/gyp/test/analyzer/test5.gyp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'f',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'f.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'g',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'g.c',
|
||||
],
|
||||
'dependencies': [
|
||||
'f',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
24
media/webrtc/trunk/tools/gyp/test/arflags/gyptest-arflags.py
Normal file
24
media/webrtc/trunk/tools/gyp/test/arflags/gyptest-arflags.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2014 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies that building a target with invalid arflags fails.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import TestGyp
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
print "This test is currently disabled: https://crbug.com/483696."
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
test = TestGyp.TestGyp(formats=['ninja'])
|
||||
test.run_gyp('test.gyp')
|
||||
expected_status = 0 if sys.platform in ['darwin', 'win32'] else 1
|
||||
test.build('test.gyp', target='lib', status=expected_status)
|
||||
test.pass_test()
|
||||
0
media/webrtc/trunk/tools/gyp/test/arflags/lib.cc
Normal file
0
media/webrtc/trunk/tools/gyp/test/arflags/lib.cc
Normal file
10
media/webrtc/trunk/tools/gyp/test/arflags/test.gyp
Normal file
10
media/webrtc/trunk/tools/gyp/test/arflags/test.gyp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'lib',
|
||||
'type': 'static_library',
|
||||
'sources': ['lib.cc'],
|
||||
'arflags': ['--nonexistent'],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
A basic test of compiling assembler files.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import TestGyp
|
||||
|
||||
if sys.platform != 'win32':
|
||||
# TODO(bradnelson): get this working for windows.
|
||||
test = TestGyp.TestGyp(formats=['!msvs'])
|
||||
|
||||
test.run_gyp('assembly.gyp', chdir='src')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
test.build('assembly.gyp', test.ALL, chdir='relocate/src')
|
||||
|
||||
expect = """\
|
||||
Hello from program.c
|
||||
Got 42.
|
||||
"""
|
||||
test.run_built_executable('program', chdir='relocate/src', stdout=expect)
|
||||
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Make sure that manual rules on Windows override the built in ones.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import TestGyp
|
||||
|
||||
if sys.platform == 'win32':
|
||||
test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
|
||||
CHDIR = 'src'
|
||||
test.run_gyp('override.gyp', chdir=CHDIR)
|
||||
test.build('override.gyp', test.ALL, chdir=CHDIR)
|
||||
expect = """\
|
||||
Hello from program.c
|
||||
Got 42.
|
||||
"""
|
||||
test.run_built_executable('program', chdir=CHDIR, stdout=expect)
|
||||
test.pass_test()
|
||||
4
media/webrtc/trunk/tools/gyp/test/assembly/src/as.bat
Normal file
4
media/webrtc/trunk/tools/gyp/test/assembly/src/as.bat
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
@echo off
|
||||
:: Mock windows assembler.
|
||||
cl /MD /c %1 /Fo"%2"
|
||||
|
||||
62
media/webrtc/trunk/tools/gyp/test/assembly/src/assembly.gyp
Normal file
62
media/webrtc/trunk/tools/gyp/test/assembly/src/assembly.gyp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'target_defaults': {
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'defines': ['PLATFORM_WIN'],
|
||||
}],
|
||||
['OS=="mac" or OS=="ios"', {
|
||||
'defines': ['PLATFORM_MAC'],
|
||||
}],
|
||||
['OS=="linux"', {
|
||||
'defines': ['PLATFORM_LINUX'],
|
||||
}],
|
||||
['OS=="android"', {
|
||||
'defines': ['PLATFORM_ANDROID'],
|
||||
}],
|
||||
],
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'program',
|
||||
'type': 'executable',
|
||||
'dependencies': ['lib1'],
|
||||
'sources': [
|
||||
'program.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'lib1',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'lib1.S',
|
||||
],
|
||||
},
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'target_defaults': {
|
||||
'rules': [
|
||||
{
|
||||
'rule_name': 'assembler',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'extension': 'S',
|
||||
'inputs': [
|
||||
'as.bat',
|
||||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
|
||||
],
|
||||
'action':
|
||||
['as.bat', 'lib1.c', '<(_outputs)'],
|
||||
'message': 'Building assembly file <(RULE_INPUT_PATH)',
|
||||
'process_outputs_as_sources': 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
},],
|
||||
],
|
||||
}
|
||||
15
media/webrtc/trunk/tools/gyp/test/assembly/src/lib1.S
Normal file
15
media/webrtc/trunk/tools/gyp/test/assembly/src/lib1.S
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#if PLATFORM_WINDOWS || PLATFORM_MAC
|
||||
# define IDENTIFIER(n) _##n
|
||||
#else /* Linux */
|
||||
# define IDENTIFIER(n) n
|
||||
#endif
|
||||
|
||||
.globl IDENTIFIER(lib1_function)
|
||||
IDENTIFIER(lib1_function):
|
||||
#if !defined(PLATFORM_ANDROID)
|
||||
movl $42, %eax
|
||||
ret
|
||||
#else /* Android (assuming ARM) */
|
||||
mov r0, #42
|
||||
bx lr
|
||||
#endif
|
||||
3
media/webrtc/trunk/tools/gyp/test/assembly/src/lib1.c
Normal file
3
media/webrtc/trunk/tools/gyp/test/assembly/src/lib1.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int lib1_function(void) {
|
||||
return 42;
|
||||
}
|
||||
34
media/webrtc/trunk/tools/gyp/test/assembly/src/override.gyp
Normal file
34
media/webrtc/trunk/tools/gyp/test/assembly/src/override.gyp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'program',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'program.c',
|
||||
'override_asm.asm',
|
||||
],
|
||||
'rules': [
|
||||
{
|
||||
# Test that if there's a specific .asm rule, it overrides the
|
||||
# built in one on Windows.
|
||||
'rule_name': 'assembler',
|
||||
'msvs_cygwin_shell': 0,
|
||||
'extension': 'asm',
|
||||
'inputs': [
|
||||
'as.bat',
|
||||
],
|
||||
'outputs': [
|
||||
'output.obj',
|
||||
],
|
||||
'action': ['as.bat', 'lib1.c', '<(_outputs)'],
|
||||
'message': 'Building assembly file <(RULE_INPUT_PATH)',
|
||||
'process_outputs_as_sources': 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
; Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
; Use of this source code is governed by a BSD-style license that can be
|
||||
; found in the LICENSE file.
|
||||
|
||||
; This is a placeholder. It should not be referenced if overrides work
|
||||
; correctly.
|
||||
|
||||
Bad stuff that shouldn't assemble.
|
||||
12
media/webrtc/trunk/tools/gyp/test/assembly/src/program.c
Normal file
12
media/webrtc/trunk/tools/gyp/test/assembly/src/program.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern int lib1_function(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
fprintf(stdout, "Hello from program.c\n");
|
||||
fflush(stdout);
|
||||
fprintf(stdout, "Got %d.\n", lib1_function());
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verifies simplest-possible build of a "Hello, world!" program
|
||||
using the default build target.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(workdir='workarea_default')
|
||||
|
||||
if test.format == 'xcode-ninja':
|
||||
# The xcode-ninja generator doesn't support --build
|
||||
# cf. https://code.google.com/p/gyp/issues/detail?id=453
|
||||
test.skip_test()
|
||||
|
||||
test.run_gyp('hello.gyp', '--build=Default')
|
||||
|
||||
test.run_built_executable('hello', stdout="Hello, world!\n")
|
||||
|
||||
test.up_to_date('hello.gyp', test.DEFAULT)
|
||||
|
||||
test.pass_test()
|
||||
13
media/webrtc/trunk/tools/gyp/test/build-option/hello.c
Normal file
13
media/webrtc/trunk/tools/gyp/test/build-option/hello.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello, world!\n");
|
||||
return 0;
|
||||
}
|
||||
15
media/webrtc/trunk/tools/gyp/test/build-option/hello.gyp
Normal file
15
media/webrtc/trunk/tools/gyp/test/build-option/hello.gyp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'hello',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'hello.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
85
media/webrtc/trunk/tools/gyp/test/builddir/gyptest-all.py
Normal file
85
media/webrtc/trunk/tools/gyp/test/builddir/gyptest-all.py
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verify the settings that cause a set of programs to be created in
|
||||
a specific build directory, and that no intermediate built files
|
||||
get created outside of that build directory hierarchy even when
|
||||
referred to with deeply-nested ../../.. paths.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
# TODO(mmoss): Make only supports (theoretically) a single, global build
|
||||
# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than
|
||||
# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other
|
||||
# generators support, so this doesn't work yet for make.
|
||||
# TODO(mmoss) Make also has the issue that the top-level Makefile is written to
|
||||
# the "--depth" location, which is one level above 'src', but then this test
|
||||
# moves 'src' somewhere else, leaving the Makefile behind, so make can't find
|
||||
# its sources. I'm not sure if make is wrong for writing outside the current
|
||||
# directory, or if the test is wrong for assuming everything generated is under
|
||||
# the current directory.
|
||||
# Ninja and CMake do not support setting the build directory.
|
||||
test = TestGyp.TestGyp(formats=['!make', '!ninja', '!cmake'])
|
||||
|
||||
test.run_gyp('prog1.gyp', '--depth=..', chdir='src')
|
||||
if test.format == 'msvs':
|
||||
if test.uses_msbuild:
|
||||
test.must_contain('src/prog1.vcxproj',
|
||||
'<OutDir>..\\builddir\\Default\\</OutDir>')
|
||||
else:
|
||||
test.must_contain('src/prog1.vcproj',
|
||||
'OutputDirectory="..\\builddir\\Default\\"')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
test.subdir('relocate/builddir')
|
||||
|
||||
# Make sure that all the built ../../etc. files only get put under builddir,
|
||||
# by making all of relocate read-only and then making only builddir writable.
|
||||
test.writable('relocate', False)
|
||||
test.writable('relocate/builddir', True)
|
||||
|
||||
# Suppress the test infrastructure's setting SYMROOT on the command line.
|
||||
test.build('prog1.gyp', test.ALL, SYMROOT=None, chdir='relocate/src')
|
||||
|
||||
expect1 = """\
|
||||
Hello from prog1.c
|
||||
Hello from func1.c
|
||||
"""
|
||||
|
||||
expect2 = """\
|
||||
Hello from subdir2/prog2.c
|
||||
Hello from func2.c
|
||||
"""
|
||||
|
||||
expect3 = """\
|
||||
Hello from subdir2/subdir3/prog3.c
|
||||
Hello from func3.c
|
||||
"""
|
||||
|
||||
expect4 = """\
|
||||
Hello from subdir2/subdir3/subdir4/prog4.c
|
||||
Hello from func4.c
|
||||
"""
|
||||
|
||||
expect5 = """\
|
||||
Hello from subdir2/subdir3/subdir4/subdir5/prog5.c
|
||||
Hello from func5.c
|
||||
"""
|
||||
|
||||
def run_builddir(prog, expect):
|
||||
dir = 'relocate/builddir/Default/'
|
||||
test.run(program=test.workpath(dir + prog), stdout=expect)
|
||||
|
||||
run_builddir('prog1', expect1)
|
||||
run_builddir('prog2', expect2)
|
||||
run_builddir('prog3', expect3)
|
||||
run_builddir('prog4', expect4)
|
||||
run_builddir('prog5', expect5)
|
||||
|
||||
test.pass_test()
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2012 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Verify the settings that cause a set of programs to be created in
|
||||
a specific build directory, and that no intermediate built files
|
||||
get created outside of that build directory hierarchy even when
|
||||
referred to with deeply-nested ../../.. paths.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
# TODO(mmoss): Make only supports (theoretically) a single, global build
|
||||
# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than
|
||||
# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other
|
||||
# generators support, so this doesn't work yet for make.
|
||||
# TODO(mmoss) Make also has the issue that the top-level Makefile is written to
|
||||
# the "--depth" location, which is one level above 'src', but then this test
|
||||
# moves 'src' somewhere else, leaving the Makefile behind, so make can't find
|
||||
# its sources. I'm not sure if make is wrong for writing outside the current
|
||||
# directory, or if the test is wrong for assuming everything generated is under
|
||||
# the current directory.
|
||||
# Ninja and CMake do not support setting the build directory.
|
||||
test = TestGyp.TestGyp(formats=['!make', '!ninja', '!cmake'])
|
||||
|
||||
test.run_gyp('prog1.gyp', '--depth=..', chdir='src')
|
||||
if test.format == 'msvs':
|
||||
if test.uses_msbuild:
|
||||
test.must_contain('src/prog1.vcxproj',
|
||||
'<OutDir>..\\builddir\\Default\\</OutDir>')
|
||||
else:
|
||||
test.must_contain('src/prog1.vcproj',
|
||||
'OutputDirectory="..\\builddir\\Default\\"')
|
||||
|
||||
test.relocate('src', 'relocate/src')
|
||||
|
||||
test.subdir('relocate/builddir')
|
||||
|
||||
# Make sure that all the built ../../etc. files only get put under builddir,
|
||||
# by making all of relocate read-only and then making only builddir writable.
|
||||
test.writable('relocate', False)
|
||||
test.writable('relocate/builddir', True)
|
||||
|
||||
# Suppress the test infrastructure's setting SYMROOT on the command line.
|
||||
test.build('prog1.gyp', SYMROOT=None, chdir='relocate/src')
|
||||
|
||||
expect1 = """\
|
||||
Hello from prog1.c
|
||||
Hello from func1.c
|
||||
"""
|
||||
|
||||
expect2 = """\
|
||||
Hello from subdir2/prog2.c
|
||||
Hello from func2.c
|
||||
"""
|
||||
|
||||
expect3 = """\
|
||||
Hello from subdir2/subdir3/prog3.c
|
||||
Hello from func3.c
|
||||
"""
|
||||
|
||||
expect4 = """\
|
||||
Hello from subdir2/subdir3/subdir4/prog4.c
|
||||
Hello from func4.c
|
||||
"""
|
||||
|
||||
expect5 = """\
|
||||
Hello from subdir2/subdir3/subdir4/subdir5/prog5.c
|
||||
Hello from func5.c
|
||||
"""
|
||||
|
||||
def run_builddir(prog, expect):
|
||||
dir = 'relocate/builddir/Default/'
|
||||
test.run(program=test.workpath(dir + prog), stdout=expect)
|
||||
|
||||
run_builddir('prog1', expect1)
|
||||
run_builddir('prog2', expect2)
|
||||
run_builddir('prog3', expect3)
|
||||
run_builddir('prog4', expect4)
|
||||
run_builddir('prog5', expect5)
|
||||
|
||||
test.pass_test()
|
||||
18
media/webrtc/trunk/tools/gyp/test/builddir/src/builddir.gypi
Normal file
18
media/webrtc/trunk/tools/gyp/test/builddir/src/builddir.gypi
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'target_defaults': {
|
||||
'configurations': {
|
||||
'Default': {
|
||||
'msvs_configuration_attributes': {
|
||||
'OutputDirectory': '<(DEPTH)\\builddir/Default',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'xcode_settings': {
|
||||
'SYMROOT': '<(DEPTH)/builddir',
|
||||
},
|
||||
}
|
||||
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func1.c
Normal file
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func1.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void func1(void)
|
||||
{
|
||||
printf("Hello from func1.c\n");
|
||||
}
|
||||
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func2.c
Normal file
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func2.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void func2(void)
|
||||
{
|
||||
printf("Hello from func2.c\n");
|
||||
}
|
||||
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func3.c
Normal file
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func3.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void func3(void)
|
||||
{
|
||||
printf("Hello from func3.c\n");
|
||||
}
|
||||
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func4.c
Normal file
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func4.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void func4(void)
|
||||
{
|
||||
printf("Hello from func4.c\n");
|
||||
}
|
||||
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func5.c
Normal file
6
media/webrtc/trunk/tools/gyp/test/builddir/src/func5.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void func5(void)
|
||||
{
|
||||
printf("Hello from func5.c\n");
|
||||
}
|
||||
10
media/webrtc/trunk/tools/gyp/test/builddir/src/prog1.c
Normal file
10
media/webrtc/trunk/tools/gyp/test/builddir/src/prog1.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern void func1(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from prog1.c\n");
|
||||
func1();
|
||||
return 0;
|
||||
}
|
||||
30
media/webrtc/trunk/tools/gyp/test/builddir/src/prog1.gyp
Normal file
30
media/webrtc/trunk/tools/gyp/test/builddir/src/prog1.gyp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'builddir.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'pull_in_all',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'prog1',
|
||||
'subdir2/prog2.gyp:prog2',
|
||||
'subdir2/subdir3/prog3.gyp:prog3',
|
||||
'subdir2/subdir3/subdir4/prog4.gyp:prog4',
|
||||
'subdir2/subdir3/subdir4/subdir5/prog5.gyp:prog5',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'prog1',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'prog1.c',
|
||||
'func1.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern void func2(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from subdir2/prog2.c\n");
|
||||
func2();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'../builddir.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'prog2',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'prog2.c',
|
||||
'../func2.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern void func3(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from subdir2/subdir3/prog3.c\n");
|
||||
func3();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'../../builddir.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'prog3',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'prog3.c',
|
||||
'../../func3.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern void func4(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from subdir2/subdir3/subdir4/prog4.c\n");
|
||||
func4();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'../../../builddir.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'prog4',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'prog4.c',
|
||||
'../../../func4.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern void func5(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from subdir2/subdir3/subdir4/subdir5/prog5.c\n");
|
||||
func5();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2009 Google Inc. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'../../../../builddir.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'prog5',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'prog5.c',
|
||||
'../../../../func5.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue