From f6affe1df80f8e59a0e17f2077182ba6c337004f Mon Sep 17 00:00:00 2001 From: "bradnelson@google.com" Date: Tue, 20 Oct 2009 00:22:52 +0000 Subject: Adding in missing tests from 297006 (incorrectly cloned from 271019). Oops, forgot to add new files. BUG=None TEST=None TBR=piman Review URL: http://codereview.chromium.org/304010 git-svn-id: http://gyp.googlecode.com/svn/trunk@711 78cadc50-ecff-11dd-a971-7dbc132099af --- test/toolsets/gyptest-toolsets.py | 19 +++++++++++++++++++ test/toolsets/main.cc | 7 +++++++ test/toolsets/toolsets.cc | 7 +++++++ test/toolsets/toolsets.gyp | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 test/toolsets/gyptest-toolsets.py create mode 100644 test/toolsets/main.cc create mode 100644 test/toolsets/toolsets.cc create mode 100644 test/toolsets/toolsets.gyp diff --git a/test/toolsets/gyptest-toolsets.py b/test/toolsets/gyptest-toolsets.py new file mode 100644 index 00000000..4d74a117 --- /dev/null +++ b/test/toolsets/gyptest-toolsets.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +""" +Verifies that toolsets are correctly applied +""" + +import TestGyp + +# Multiple toolsets are currently only supported by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +test.run_gyp('toolsets.gyp') + +test.build_all('toolsets.gyp') + +test.run_built_executable('host-main', stdout="Host\n") +test.run_built_executable('target-main', stdout="Target\n") + +test.pass_test() diff --git a/test/toolsets/main.cc b/test/toolsets/main.cc new file mode 100644 index 00000000..25a53f2d --- /dev/null +++ b/test/toolsets/main.cc @@ -0,0 +1,7 @@ +#include + +const char *GetToolset(); + +int main(int argc, char *argv[]) { + printf("%s\n", GetToolset()); +} diff --git a/test/toolsets/toolsets.cc b/test/toolsets/toolsets.cc new file mode 100644 index 00000000..0a21e99f --- /dev/null +++ b/test/toolsets/toolsets.cc @@ -0,0 +1,7 @@ +const char *GetToolset() { +#ifdef TARGET + return "Target"; +#else + return "Host"; +#endif +} diff --git a/test/toolsets/toolsets.gyp b/test/toolsets/toolsets.gyp new file mode 100644 index 00000000..c709fb10 --- /dev/null +++ b/test/toolsets/toolsets.gyp @@ -0,0 +1,34 @@ +{ + 'target_defaults': { + 'target_conditions': [ + ['_toolset=="target"', {'defines': ['TARGET']}] + ] + }, + 'targets': [ + { + 'target_name': 'toolsets', + 'type': 'static_library', + 'toolsets': ['target', 'host'], + 'sources': [ + 'toolsets.cc', + ], + }, + { + 'target_name': 'host-main', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': ['toolsets'], + 'sources': [ + 'main.cc', + ], + }, + { + 'target_name': 'target-main', + 'type': 'executable', + 'dependencies': ['toolsets'], + 'sources': [ + 'main.cc', + ], + }, + ], +} -- cgit v1.2.3