Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: test/cxxflags/gyptest-cxxflags.py

Issue 5917002: Changed the order of toolset and gyp CFLAGS, CXXFLAGS and LDFLAGS. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cxxflags/cxxflags.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cxxflags/gyptest-cxxflags.py
===================================================================
--- test/cxxflags/gyptest-cxxflags.py (revision 0)
+++ test/cxxflags/gyptest-cxxflags.py (revision 0)
@@ -0,0 +1,65 @@
+#!/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 build of an executable with C++ define specified by a gyp define, and
+the use of the environment during regeneration when the gyp file changes.
+"""
+
+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'])
+
+try:
+ old_cxxflags = None
+ if old_cxxflags in os.environ.keys():
+ old_cxxflags = os.environ['CXXFLAGS']
+ os.environ['CXXFLAGS'] = '-O0'
Evan Martin 2010/12/17 22:10:54 One idea to make this test simpler is to instead u
+ test.run_gyp('cxxflags.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ if old_cxxflags:
+ os.environ['CXXFLAGS'] = old_cxxflags
+ elif 'CXXFLAGS' in os.environ.keys():
+ del os.environ['CXXFLAGS']
+
+test.build('cxxflags.gyp')
+
+expect = """\
+Using no optimization flag
+"""
+test.run_built_executable('cxxflags', stdout=expect)
+
+test.sleep()
+
+try:
+ old_cxxflags = None
+ if old_cxxflags in os.environ.keys():
+ old_cxxflags = os.environ['CXXFLAGS']
+ os.environ['CXXFLAGS'] = '-O2'
+ test.run_gyp('cxxflags.gyp')
+finally:
+ # We clear the environ after calling gyp. When the auto-regeneration happens,
+ # the same define should be reused anyway. Reset to empty string first in
+ # case the platform doesn't support unsetenv.
+ if old_cxxflags:
+ os.environ['CXXFLAGS'] = old_cxxflags
+ elif 'CXXFLAGS' in os.environ.keys():
+ del os.environ['CXXFLAGS']
+
+test.build('cxxflags.gyp')
+
+expect = """\
+Using an optimization flag
+"""
+test.run_built_executable('cxxflags', stdout=expect)
+
+test.pass_test()
« no previous file with comments | « test/cxxflags/cxxflags.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698