Sha256: 96e2afb923c26e4ce584b742e1790c3956d22ca73b0ea94a854b8d8da4749fbb

Contents?: true

Size: 1.52 KB

Versions: 23

Compression:

Stored size: 1.52 KB

Contents

#!/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 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 and Android generators.
test = TestGyp.TestGyp(formats=['make', 'android'])

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

23 entries across 23 versions & 3 rubygems

Version Path
libv8-3.16.14.19.1 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.19 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.18 vendor/gyp/test/cflags/gyptest-cflags.py
arcabouco-0.2.13 vendor/bundle/gems/libv8-3.16.14.17/vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.17 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.16 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.15 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.14 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-tmpfork-3.16.14.13 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.13 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.12 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.11 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.10 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.8 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.8.rc1 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.7 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.6 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.5 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.4 vendor/gyp/test/cflags/gyptest-cflags.py
libv8-3.16.14.3 vendor/gyp/test/cflags/gyptest-cflags.py