Sha256: dbc4c52644e918734acc26978f3ac2fa9de7679cac16564121e2cef59ca61d21

Contents?: true

Size: 1.5 KB

Versions: 16

Compression:

Stored size: 1.5 KB

Contents

#!/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.

"""
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

env_stack = []


def PushEnv():
  env_copy = os.environ.copy()
  env_stack.append(env_copy)

def PopEnv():
  os.eniron=env_stack.pop()

# Regenerating build files when a gyp file changes is currently only supported
# by the make generator.
test = TestGyp.TestGyp(formats=['make'])

try:
  PushEnv()
  os.environ['CFLAGS'] = '-O0'
  test.run_gyp('cflags.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.
  PopEnv()

test.build('cflags.gyp')

expect = """\
Using no optimization flag
"""
test.run_built_executable('cflags', stdout=expect)

test.sleep()

try:
  PushEnv()
  os.environ['CFLAGS'] = '-O2'
  test.run_gyp('cflags.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.
  PopEnv()

test.build('cflags.gyp')

expect = """\
Using an optimization flag
"""
test.run_built_executable('cflags', stdout=expect)

test.pass_test()

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
libv8-3.11.8.17 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.16 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.13 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.12 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/libv8-3.11.8.4/vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.11 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.10 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.9 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.8 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.7 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.4 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-freebsd-3.11.8.3 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.3 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.1 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.11.8.0 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py
libv8-3.10.8.0 vendor/v8/build/gyp/test/cflags/gyptest-cflags.py