Sha256: 78dc41415ef43a5b7a74ea733cd452817a80c4533cfa8a158fbb0b2ba5221738

Contents?: true

Size: 1.83 KB

Versions: 44

Compression:

Stored size: 1.83 KB

Contents

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

import os
import TestGyp

test = TestGyp.TestGyp()

# With the value only given in environment, it should be used.
try:
  os.environ['GYP_DEFINES'] = 'value=10'
  test.run_gyp('defines-env.gyp')
finally:
  del os.environ['GYP_DEFINES']

test.build('defines-env.gyp')

expect = """\
VALUE is 10
"""
test.run_built_executable('defines', stdout=expect)


# With the value given in both command line and environment,
# command line should take precedence.
try:
  os.environ['GYP_DEFINES'] = 'value=20'
  test.run_gyp('defines-env.gyp', '-Dvalue=25')
finally:
  del os.environ['GYP_DEFINES']

test.sleep()
test.touch('defines.c')
test.build('defines-env.gyp')

expect = """\
VALUE is 25
"""
test.run_built_executable('defines', stdout=expect)


# With the value only given in environment, it should be ignored if
# --ignore-environment is specified.
try:
  os.environ['GYP_DEFINES'] = 'value=30'
  test.run_gyp('defines-env.gyp', '--ignore-environment')
finally:
  del os.environ['GYP_DEFINES']

test.sleep()
test.touch('defines.c')
test.build('defines-env.gyp')

expect = """\
VALUE is 5
"""
test.run_built_executable('defines', stdout=expect)


# With the value given in both command line and environment, and
# --ignore-environment also specified, command line should still be used.
try:
  os.environ['GYP_DEFINES'] = 'value=40'
  test.run_gyp('defines-env.gyp', '--ignore-environment', '-Dvalue=45')
finally:
  del os.environ['GYP_DEFINES']

test.sleep()
test.touch('defines.c')
test.build('defines-env.gyp')

expect = """\
VALUE is 45
"""
test.run_built_executable('defines', stdout=expect)


test.pass_test()

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
libv8-3.16.14.19.1 vendor/gyp/test/defines/gyptest-defines-env.py
mt-libuv-4.1.04 ext/gyp/test/defines/gyptest-defines-env.py
mt-libuv-4.1.03 ext/gyp/test/defines/gyptest-defines-env.py
mt-libuv-4.1.02 ext/gyp/test/defines/gyptest-defines-env.py
tree-sitter-0.1.0 ext/tree-sitter/tree-sitter/externals/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.19 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.18 vendor/gyp/test/defines/gyptest-defines-env.py
tree-sitter-0.0.1 ext/tree-sitter/tree-sitter/externals/gyp/test/defines/gyptest-defines-env.py
arcabouco-0.2.13 vendor/bundle/gems/libv8-3.16.14.17/vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.17 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.16 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.15 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.14 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-tmpfork-3.16.14.13 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.13 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.12 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.11 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.10 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.8 vendor/gyp/test/defines/gyptest-defines-env.py
libv8-3.16.14.8.rc1 vendor/gyp/test/defines/gyptest-defines-env.py