mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
tools: remove gyp test directory
gyp tests are not performed in iojs and it's size about 8M bytes. We can check gyp tests outside of iojs and reduce the size of the repository by removing them. PR-URL: https://github.com/iojs/io.js/pull/1350 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,25 +0,0 @@
|
||||
# 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,25 +0,0 @@
|
||||
# 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': [ ]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1 +0,0 @@
|
||||
input
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,226 +0,0 @@
|
||||
# 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/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])
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
hello there
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1 +0,0 @@
|
||||
foo.cc
|
||||
@@ -1,35 +0,0 @@
|
||||
# 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,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,31 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,28 +0,0 @@
|
||||
# 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,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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])
|
||||
@@ -1,7 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "MyHeader.h"
|
||||
|
||||
int main() {
|
||||
printf("%s\n", kFoo);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# 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' ],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/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.
|
||||
# Android also can't do this as it doesn't have order-only dependencies.
|
||||
if test.format in ['ninja', 'android', '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()
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/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.
|
||||
# Android also can't do this as it doesn't have order-only dependencies.
|
||||
if test.format in ['ninja', 'android', '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()
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/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()
|
||||
|
||||
if test.format == 'android':
|
||||
# This test currently fails on android. Investigate why, fix the issues
|
||||
# responsible, and reenable this test on android. See bug:
|
||||
# https://code.google.com/p/gyp/issues/detail?id=436
|
||||
test.skip_test(message='Test fails on android. Fix and reenable.\n')
|
||||
|
||||
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()
|
||||
@@ -1,24 +0,0 @@
|
||||
# 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\'',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
# 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,
|
||||
}],
|
||||
},
|
||||
|
||||
],
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/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")
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,74 +0,0 @@
|
||||
# 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
extern void prog1(void);
|
||||
extern void prog2(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from program.c\n");
|
||||
prog1();
|
||||
prog2();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,33 +0,0 @@
|
||||
# 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,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/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)
|
||||
@@ -1,29 +0,0 @@
|
||||
# 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/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', 'android', '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()
|
||||
@@ -1,13 +0,0 @@
|
||||
# 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:*'],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
# 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'],
|
||||
},
|
||||
}],
|
||||
],
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int func1(void) {
|
||||
return 42;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
# 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.
|
||||
|
||||
{
|
||||
}
|
||||
@@ -1,356 +0,0 @@
|
||||
#!/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, targets):
|
||||
"""Creates the analyzer conflig 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, 'targets': 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(targets=set(), matched=False, build_targets=set()):
|
||||
"""Verifies output contains |targets|."""
|
||||
result = _ReadOutputFileContents()
|
||||
if result.get('error', None):
|
||||
print 'unexpected error', result.get('error')
|
||||
test.fail_test()
|
||||
|
||||
if result.get('invalid_targets', None):
|
||||
print 'unexpected invalid_targets', result.get('invalid_targets')
|
||||
test.fail_test()
|
||||
|
||||
actual_targets = set(result['targets'])
|
||||
if actual_targets != targets:
|
||||
print 'actual targets:', actual_targets, '\nexpected targets:', targets
|
||||
test.fail_test()
|
||||
|
||||
actual_build_targets = set(result['build_targets'])
|
||||
if actual_build_targets != build_targets:
|
||||
print 'actual build_targets:', actual_build_targets, \
|
||||
'\nexpected build_targets:', build_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(targets):
|
||||
result = _ReadOutputFileContents()
|
||||
if result.get('error', None):
|
||||
print 'unexpected error', result.get('error')
|
||||
test.fail_test()
|
||||
|
||||
if result.get('invalid_targets', None):
|
||||
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_targets = set(result['targets'])
|
||||
if actual_targets != targets:
|
||||
print 'actual targets:', actual_targets, '\nexpected targets:', 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()
|
||||
|
||||
# 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'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Conditional source that is excluded.
|
||||
_CreateConfigFile(['conditional_source.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Conditional source that is included by way of argument.
|
||||
_CreateConfigFile(['conditional_source.c'], [])
|
||||
run_analyzer('-Dtest_variable=1')
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Two unknown files.
|
||||
_CreateConfigFile(['unknown1.c', 'unoknow2.cc'], [])
|
||||
run_analyzer()
|
||||
EnsureContains()
|
||||
|
||||
# Two unknown files.
|
||||
_CreateConfigFile(['unknown1.c', 'subdir/subdir_sourcex.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains()
|
||||
|
||||
# Included dependency
|
||||
_CreateConfigFile(['unknown1.c', 'subdir/subdir_source.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe', 'exe3'})
|
||||
|
||||
# Included inputs to actions.
|
||||
_CreateConfigFile(['action_input.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Don't consider outputs.
|
||||
_CreateConfigFile(['action_output.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Rule inputs.
|
||||
_CreateConfigFile(['rule_input.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Ignore path specified with PRODUCT_DIR.
|
||||
_CreateConfigFile(['product_dir_input.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=False)
|
||||
|
||||
# Path specified via a variable.
|
||||
_CreateConfigFile(['subdir/subdir_source2.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Verifies paths with // are fixed up correctly.
|
||||
_CreateConfigFile(['parent_source.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe', 'exe3'})
|
||||
|
||||
# Verifies relative paths are resolved correctly.
|
||||
_CreateConfigFile(['subdir/subdir_source.h'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Various permutations when passing in targets.
|
||||
_CreateConfigFile(['exe2.c', 'subdir/subdir2b_source.c'], ['exe', 'exe3'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, targets={'exe3'}, build_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c', 'subdir/subdir2b_source.c'], ['exe'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe2', 'exe3'})
|
||||
|
||||
# Verifies duplicates are ignored.
|
||||
_CreateConfigFile(['exe2.c', 'subdir/subdir2b_source.c'], ['exe', 'exe'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], ['exe'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['subdir/subdir2b_source.c', 'exe2.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe2', 'exe3'})
|
||||
|
||||
_CreateConfigFile(['subdir/subdir2b_source.c'], ['exe3'])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, targets={'exe3'}, build_targets={'exe3'})
|
||||
|
||||
_CreateConfigFile(['exe2.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe2'})
|
||||
|
||||
_CreateConfigFile(['foo.c'], [])
|
||||
run_analyzer()
|
||||
EnsureContains(matched=True, build_targets={'exe'})
|
||||
|
||||
# Assertions when modifying build (gyp/gypi) files, especially when said files
|
||||
# are included.
|
||||
_CreateConfigFile(['subdir2/d.cc'], ['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, targets={'exe', 'foo'}, build_targets={'exe'})
|
||||
|
||||
_CreateConfigFile(['subdir2/subdir.includes.gypi'],
|
||||
['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, targets={'exe', 'foo'}, build_targets={'exe'})
|
||||
|
||||
_CreateConfigFile(['subdir2/subdir.gyp'], ['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, targets={'exe', 'foo'}, build_targets={'exe'})
|
||||
|
||||
_CreateConfigFile(['test2.includes.gypi'], ['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2()
|
||||
EnsureContains(matched=True, targets={'exe', 'exe2', 'exe3'},
|
||||
build_targets={'exe', 'exe2', 'exe3'})
|
||||
|
||||
# Verify modifying a file included makes all targets dirty.
|
||||
_CreateConfigFile(['common.gypi'], ['exe', 'exe2', 'foo', 'exe3'])
|
||||
run_analyzer2('-Icommon.gypi')
|
||||
EnsureMatchedAll({'exe', 'exe2', 'foo', 'exe3'})
|
||||
|
||||
# Assertions from test3.gyp.
|
||||
_CreateConfigFile(['d.c', 'f.c'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['f.c'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['f.c'], [])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, build_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['c.c', 'e.c'], [])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, build_targets={'a', 'b', 'c', 'e'})
|
||||
|
||||
_CreateConfigFile(['d.c'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['a', 'b'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['a', 'b'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['d.c'], ['a', 'b'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a', 'b'}, build_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['f.c'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a', 'b'})
|
||||
|
||||
_CreateConfigFile(['a.c'], ['a'])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, targets={'a'}, build_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['a.c'], [])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, build_targets={'a'})
|
||||
|
||||
_CreateConfigFile(['d.c'], [])
|
||||
run_analyzer3()
|
||||
EnsureContains(matched=True, build_targets={'a', 'b'})
|
||||
|
||||
# Assertions around test4.gyp.
|
||||
_CreateConfigFile(['f.c'], [])
|
||||
run_analyzer4()
|
||||
EnsureContains(matched=True, build_targets={'e', 'f'})
|
||||
|
||||
_CreateConfigFile(['d.c'], [])
|
||||
run_analyzer4()
|
||||
EnsureContains(matched=True, build_targets={'a', 'b', 'c', 'd'})
|
||||
|
||||
_CreateConfigFile(['i.c'], [])
|
||||
run_analyzer4()
|
||||
EnsureContains(matched=True, build_targets={'h'})
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,36 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
# 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'
|
||||
],
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
# 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
|
||||
# #all (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',
|
||||
],
|
||||
'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': 'all',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'exe',
|
||||
'exe3',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
# 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'
|
||||
],
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
# 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': 'all',
|
||||
'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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
const char* getString()
|
||||
{
|
||||
#ifdef __LP64__
|
||||
return "Hello, 64-bit world!\n";
|
||||
#else
|
||||
return "Hello, 32-bit world!\n";
|
||||
#endif
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
A boring test file
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/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 it's possible to build host targets correctly in a multilib
|
||||
configuration, explicitly forcing either 32 or 64 bit.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(formats=['android'])
|
||||
|
||||
test.run_gyp('host_32or64.gyp')
|
||||
|
||||
# Force building as 32-bit
|
||||
test.build('host_32or64.gyp', 'generate_output',
|
||||
arguments=['GYP_HOST_VAR_PREFIX=$(HOST_2ND_ARCH_VAR_PREFIX)',
|
||||
'GYP_HOST_MULTILIB=32'])
|
||||
|
||||
test.built_file_must_match('host_32or64.output', 'Hello, 32-bit world!\n')
|
||||
|
||||
# Force building as 64-bit
|
||||
test.build('host_32or64.gyp', 'generate_output',
|
||||
arguments=['GYP_HOST_VAR_PREFIX=',
|
||||
'GYP_HOST_MULTILIB=64'])
|
||||
|
||||
test.built_file_must_match('host_32or64.output', 'Hello, 64-bit world!\n')
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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 it's possible for gyp actions to use the result of calling a make
|
||||
function with "$()".
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(formats=['android'])
|
||||
|
||||
test.run_gyp('make_functions.gyp')
|
||||
|
||||
test.build('make_functions.gyp', test.ALL)
|
||||
|
||||
file_content = 'A boring test file\n'
|
||||
test.built_file_must_match('file.in', file_content)
|
||||
test.built_file_must_match('file.out', file_content)
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/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 disabling target aliases works.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(formats=['android'])
|
||||
|
||||
test.run_gyp('hello.gyp', '-G', 'write_alias_targets=0')
|
||||
|
||||
test.build('hello.gyp', 'hello', status=2, stderr=None)
|
||||
|
||||
test.build('hello.gyp', 'gyp_all_modules', status=2, stderr=None)
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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 it's possible to set Android build system settings using the
|
||||
aosp_build_settings key, with list values.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(formats=['android'])
|
||||
|
||||
test.run_gyp('settings-list.gyp')
|
||||
|
||||
test.build('settings-list.gyp', 'hello')
|
||||
|
||||
test.run_built_executable('hello.foo', stdout="Hello, world!\n")
|
||||
|
||||
test.up_to_date('settings-list.gyp', test.DEFAULT)
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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 it's possible to set Android build system settings using the
|
||||
aosp_build_settings key.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(formats=['android'])
|
||||
|
||||
test.run_gyp('settings.gyp')
|
||||
|
||||
test.build('settings.gyp', 'hello')
|
||||
|
||||
test.run_built_executable('hello.foo', stdout="Hello, world!\n")
|
||||
|
||||
test.up_to_date('settings.gyp', test.DEFAULT)
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/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 action input/output filenames with spaces are rejected.
|
||||
"""
|
||||
|
||||
import TestGyp
|
||||
|
||||
test = TestGyp.TestGyp(formats=['android'])
|
||||
|
||||
stderr = ('gyp: Action input filename "name with spaces" in target do_actions '
|
||||
'contains a space\n')
|
||||
test.run_gyp('space_filenames.gyp', status=1, stderr=stderr)
|
||||
|
||||
test.pass_test()
|
||||
@@ -1,12 +0,0 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Hello, world!\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# 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': 'hello',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'hello.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
# 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': 'lib32or64',
|
||||
'type': 'static_library',
|
||||
'toolsets': [ 'host' ],
|
||||
'sources': [
|
||||
'32or64.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'host_32or64',
|
||||
'type': 'executable',
|
||||
'toolsets': [ 'host' ],
|
||||
'dependencies': [ 'lib32or64#host' ],
|
||||
'sources': [
|
||||
'writefile.c',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'generate_output',
|
||||
'type': 'none',
|
||||
'dependencies': [ 'host_32or64#host' ],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'generate',
|
||||
'inputs': [ '<(PRODUCT_DIR)/host_32or64' ],
|
||||
'outputs': [ '<(PRODUCT_DIR)/host_32or64.output' ],
|
||||
'action': [ '<@(_inputs)', '<@(_outputs)' ],
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
# 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': 'file-in',
|
||||
'type': 'none',
|
||||
'copies': [
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)',
|
||||
'files': [ 'file.in' ],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'file-out',
|
||||
'type': 'none',
|
||||
'dependencies': [ 'file-in' ],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'copy-file',
|
||||
'inputs': [ '$(strip <(PRODUCT_DIR)/file.in)' ],
|
||||
'outputs': [ '<(PRODUCT_DIR)/file.out' ],
|
||||
'action': [ 'cp', '$(strip <(PRODUCT_DIR)/file.in)', '<(PRODUCT_DIR)/file.out' ],
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# 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': 'hello',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'hello.c',
|
||||
],
|
||||
'aosp_build_settings': {
|
||||
'LOCAL_MODULE_SUFFIX': ['.foo'],
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# 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': 'hello',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'hello.c',
|
||||
],
|
||||
'aosp_build_settings': {
|
||||
'LOCAL_MODULE_SUFFIX': '.foo',
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# 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': 'do_actions',
|
||||
'type': 'none',
|
||||
'actions': [{
|
||||
'action_name': 'should_be_forbidden',
|
||||
'inputs': [ 'name with spaces' ],
|
||||
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/name with spaces' ],
|
||||
'action': [ 'true' ],
|
||||
}],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern const char* getString(void);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc < 2) return 2;
|
||||
FILE* f = fopen(argv[1], "w");
|
||||
if (f == NULL) return 1;
|
||||
fprintf(f, "%s", getString());
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/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
|
||||
|
||||
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()
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'lib',
|
||||
'type': 'static_library',
|
||||
'sources': ['lib.cc'],
|
||||
'arflags': ['--nonexistent'],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
:: Mock windows assembler.
|
||||
cl /MD /c %1 /Fo"%2"
|
||||
@@ -1,62 +0,0 @@
|
||||
# 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
},],
|
||||
],
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#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
|
||||
@@ -1,3 +0,0 @@
|
||||
int lib1_function(void) {
|
||||
return 42;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
; 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.
|
||||
@@ -1,12 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/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 == 'android':
|
||||
# This test currently fails on android. Investigate why, fix the issues
|
||||
# responsible, and reenable this test on android. See bug:
|
||||
# https://code.google.com/p/gyp/issues/detail?id=436
|
||||
test.skip_test(message='Test fails on android. Fix and reenable.\n')
|
||||
|
||||
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()
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# 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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/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.
|
||||
# Android, Ninja, and CMake do not support setting the build directory.
|
||||
test = TestGyp.TestGyp(formats=['!make', '!ninja', '!android', '!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()
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/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.
|
||||
# Android, Ninja, and CMake do not support setting the build directory.
|
||||
test = TestGyp.TestGyp(formats=['!make', '!ninja', '!android', '!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()
|
||||
@@ -1,18 +0,0 @@
|
||||
# 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',
|
||||
},
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void func1(void)
|
||||
{
|
||||
printf("Hello from func1.c\n");
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void func2(void)
|
||||
{
|
||||
printf("Hello from func2.c\n");
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void func3(void)
|
||||
{
|
||||
printf("Hello from func3.c\n");
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void func4(void)
|
||||
{
|
||||
printf("Hello from func4.c\n");
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void func5(void)
|
||||
{
|
||||
printf("Hello from func5.c\n");
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
extern void func1(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from prog1.c\n");
|
||||
func1();
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user