diff options
Diffstat (limited to 'media/webrtc/trunk/tools/gyp/test/home_dot_gyp')
9 files changed, 182 insertions, 0 deletions
diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-config-arg.py b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-config-arg.py new file mode 100755 index 000000000..82e39f9d0 --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-config-arg.py @@ -0,0 +1,31 @@ +#!/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 inclusion of $HOME/.gyp/include.gypi works when --config-dir is +specified. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +os.environ['HOME'] = os.path.abspath('home2') + +test.run_gyp('all.gyp', '--config-dir=~/.gyp_new', chdir='src') + +# After relocating, we should still be able to build (build file shouldn't +# contain relative reference to ~/.gyp/include.gypi) +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome3\n') + +test.pass_test() diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-config-env.py b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-config-env.py new file mode 100755 index 000000000..6f4b299ed --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-config-env.py @@ -0,0 +1,33 @@ +#!/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 inclusion of $HOME/.gyp_new/include.gypi works when GYP_CONFIG_DIR +is set. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +os.environ['HOME'] = os.path.abspath('home') +os.environ['GYP_CONFIG_DIR'] = os.path.join(os.path.abspath('home2'), + '.gyp_new') + +test.run_gyp('all.gyp', chdir='src') + +# After relocating, we should still be able to build (build file shouldn't +# contain relative reference to ~/.gyp_new/include.gypi) +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome3\n') + +test.pass_test() diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py new file mode 100755 index 000000000..fdf8b1446 --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py @@ -0,0 +1,44 @@ +#!/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 inclusion of $HOME/.gyp/include.gypi works properly with relocation +and with regeneration. +""" + +import os +import TestGyp + +# Regenerating build files when a gyp file changes is currently only supported +# by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +os.environ['HOME'] = os.path.abspath('home') + +test.run_gyp('all.gyp', chdir='src') + +# After relocating, we should still be able to build (build file shouldn't +# contain relative reference to ~/.gyp/include.gypi) +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome\n') + +# Building should notice any changes to ~/.gyp/include.gypi and regyp. +test.sleep() + +test.write('home/.gyp/include.gypi', test.read('home2/.gyp/include.gypi')) + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome2\n') + +test.pass_test() diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py new file mode 100755 index 000000000..8ad52556b --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py @@ -0,0 +1,30 @@ +#!/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. + +""" +Verifies inclusion of $HOME/.gyp/include.gypi works. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +os.environ['HOME'] = os.path.abspath('home') + +test.run_gyp('all.gyp', chdir='src') + +# After relocating, we should still be able to build (build file shouldn't +# contain relative reference to ~/.gyp/include.gypi) +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome\n') + +test.pass_test() diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi new file mode 100644 index 000000000..fcfb39bef --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi @@ -0,0 +1,5 @@ +{ + 'variables': { + 'foo': '"fromhome"', + }, +} diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi new file mode 100644 index 000000000..f0d84b31a --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi @@ -0,0 +1,5 @@ +{ + 'variables': { + 'foo': '"fromhome2"', + }, +} diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home2/.gyp_new/include.gypi b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home2/.gyp_new/include.gypi new file mode 100644 index 000000000..4094dfd2f --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/home2/.gyp_new/include.gypi @@ -0,0 +1,5 @@ +{ + 'variables': { + 'foo': '"fromhome3"', + }, +} diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/src/all.gyp b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/src/all.gyp new file mode 100644 index 000000000..14b6aea28 --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/src/all.gyp @@ -0,0 +1,22 @@ +# 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. + +{ + 'variables': { + 'foo%': '"fromdefault"', + }, + 'targets': [ + { + 'target_name': 'printfoo', + 'type': 'executable', + 'sources': [ + 'printfoo.c', + ], + 'defines': [ + 'FOO=<(foo)', + ], + }, + ], +} + diff --git a/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/src/printfoo.c b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/src/printfoo.c new file mode 100644 index 000000000..9bb67181b --- /dev/null +++ b/media/webrtc/trunk/tools/gyp/test/home_dot_gyp/src/printfoo.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(void) +{ + printf("FOO is %s\n", FOO); + return 0; +} |