summaryrefslogtreecommitdiff
path: root/src/engine/SCons/EnvironmentTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r--src/engine/SCons/EnvironmentTests.py117
1 files changed, 10 insertions, 107 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 1ce1007..139bef7 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -23,7 +23,7 @@
from __future__ import print_function
-__revision__ = "src/engine/SCons/EnvironmentTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
+__revision__ = "src/engine/SCons/EnvironmentTests.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import SCons.compat
@@ -797,12 +797,14 @@ sys.exit(0)
"-F fwd3 " + \
"-dylib_file foo-dylib " + \
"-pthread " + \
+ "-fmerge-all-constants " +\
"-fopenmp " + \
"-mno-cygwin -mwindows " + \
"-arch i386 -isysroot /tmp " + \
"-iquote /usr/include/foo1 " + \
"-isystem /usr/include/foo2 " + \
"-idirafter /usr/include/foo3 " + \
+ "-imacros /usr/include/foo4 " + \
"+DD64 " + \
"-DFOO -DBAR=value -D BAZ "
@@ -811,11 +813,13 @@ sys.exit(0)
assert d['ASFLAGS'] == ['-as'], d['ASFLAGS']
assert d['CFLAGS'] == ['-std=c99']
assert d['CCFLAGS'] == ['-X', '-Wa,-as',
- '-pthread', '-fopenmp', '-mno-cygwin',
+ '-pthread', '-fmerge-all-constants',
+ '-fopenmp', '-mno-cygwin',
('-arch', 'i386'), ('-isysroot', '/tmp'),
('-iquote', '/usr/include/foo1'),
('-isystem', '/usr/include/foo2'),
('-idirafter', '/usr/include/foo3'),
+ ('-imacros', env.fs.File('/usr/include/foo4')),
'+DD64'], repr(d['CCFLAGS'])
assert d['CXXFLAGS'] == ['-std=c++0x'], repr(d['CXXFLAGS'])
assert d['CPPDEFINES'] == ['FOO', ['BAR', 'value'], 'BAZ'], d['CPPDEFINES']
@@ -832,7 +836,7 @@ sys.exit(0)
assert LIBS == ['xxx', 'yyy', 'ascend'], (d['LIBS'], LIBS)
assert d['LINKFLAGS'] == ['-Wl,-link',
'-dylib_file', 'foo-dylib',
- '-pthread', '-fopenmp',
+ '-pthread', '-fmerge-all-constants', '-fopenmp',
'-mno-cygwin', '-mwindows',
('-arch', 'i386'),
('-isysroot', '/tmp'),
@@ -1872,18 +1876,6 @@ def generate(env):
assert ('BUILDERS' in env) is False
env2 = env.Clone()
- def test_Copy(self):
- """Test copying using the old env.Copy() method"""
- env1 = self.TestEnvironment(XXX = 'x', YYY = 'y')
- env2 = env1.Copy()
- env1copy = env1.Copy()
- assert env1copy == env1copy
- assert env2 == env2
- env2.Replace(YYY = 'yyy')
- assert env2 == env2
- assert env1 != env2
- assert env1 == env1copy
-
def test_Detect(self):
"""Test Detect()ing tools"""
test = TestCmd.TestCmd(workdir = '')
@@ -2024,6 +2016,7 @@ def generate(env):
"-Ffwd2 " + \
"-F fwd3 " + \
"-pthread " + \
+ "-fmerge-all-constants " + \
"-mno-cygwin -mwindows " + \
"-arch i386 -isysroot /tmp " + \
"-iquote /usr/include/foo1 " + \
@@ -2035,7 +2028,7 @@ def generate(env):
assert save_command == ['fake command'], save_command
assert env['ASFLAGS'] == ['assembler', '-as'], env['ASFLAGS']
assert env['CCFLAGS'] == ['', '-X', '-Wa,-as',
- '-pthread', '-mno-cygwin',
+ '-pthread', '-fmerge-all-constants', '-mno-cygwin',
('-arch', 'i386'), ('-isysroot', '/tmp'),
('-iquote', '/usr/include/foo1'),
('-isystem', '/usr/include/foo2'),
@@ -2049,6 +2042,7 @@ def generate(env):
assert env['LIBPATH'] == ['list', '/usr/fax', 'foo'], env['LIBPATH']
assert env['LIBS'] == ['xxx', 'yyy', env.File('abc')], env['LIBS']
assert env['LINKFLAGS'] == ['', '-Wl,-link', '-pthread',
+ '-fmerge-all-constants',
'-mno-cygwin', '-mwindows',
('-arch', 'i386'),
('-isysroot', '/tmp'),
@@ -3280,44 +3274,6 @@ def generate(env):
s = e.src_builder()
assert s is None, s
- def test_SourceSignatures(self):
- """Test the SourceSignatures() method"""
- import SCons.Errors
-
- env = self.TestEnvironment(M = 'MD5', T = 'timestamp')
-
- exc_caught = None
- try:
- env.SourceSignatures('invalid_type')
- except SCons.Errors.UserError:
- exc_caught = 1
- assert exc_caught, "did not catch expected UserError"
-
- env.SourceSignatures('MD5')
- assert env.src_sig_type == 'MD5', env.src_sig_type
-
- env.SourceSignatures('$M')
- assert env.src_sig_type == 'MD5', env.src_sig_type
-
- env.SourceSignatures('timestamp')
- assert env.src_sig_type == 'timestamp', env.src_sig_type
-
- env.SourceSignatures('$T')
- assert env.src_sig_type == 'timestamp', env.src_sig_type
-
- try:
- import SCons.Util
- save_md5 = SCons.Util.md5
- SCons.Util.md5 = None
- try:
- env.SourceSignatures('MD5')
- except SCons.Errors.UserError:
- pass
- else:
- self.fail('Did not catch expected UserError')
- finally:
- SCons.Util.md5 = save_md5
-
def test_Split(self):
"""Test the Split() method"""
env = self.TestEnvironment(FOO = 'fff', BAR = 'bbb')
@@ -3334,56 +3290,6 @@ def generate(env):
s = env.Split("$FOO$BAR")
assert s == ["fffbbb"], s
- def test_TargetSignatures(self):
- """Test the TargetSignatures() method"""
- import SCons.Errors
-
- env = self.TestEnvironment(B='build', C='content')
-
- exc_caught = None
- try:
- env.TargetSignatures('invalid_type')
- except SCons.Errors.UserError:
- exc_caught = 1
- assert exc_caught, "did not catch expected UserError"
- assert not hasattr(env, '_build_signature')
-
- env.TargetSignatures('build')
- assert env.tgt_sig_type == 'build', env.tgt_sig_type
-
- env.TargetSignatures('$B')
- assert env.tgt_sig_type == 'build', env.tgt_sig_type
-
- env.TargetSignatures('content')
- assert env.tgt_sig_type == 'content', env.tgt_sig_type
-
- env.TargetSignatures('$C')
- assert env.tgt_sig_type == 'content', env.tgt_sig_type
-
- env.TargetSignatures('MD5')
- assert env.tgt_sig_type == 'MD5', env.tgt_sig_type
-
- env.TargetSignatures('timestamp')
- assert env.tgt_sig_type == 'timestamp', env.tgt_sig_type
-
- try:
- import SCons.Util
- save_md5 = SCons.Util.md5
- SCons.Util.md5 = None
- try:
- env.TargetSignatures('MD5')
- except SCons.Errors.UserError:
- pass
- else:
- self.fail('Did not catch expected UserError')
- try:
- env.TargetSignatures('content')
- except SCons.Errors.UserError:
- pass
- else:
- self.fail('Did not catch expected UserError')
- finally:
- SCons.Util.md5 = save_md5
def test_Value(self):
"""Test creating a Value() object
@@ -3404,7 +3310,6 @@ def generate(env):
assert v3.value == 'c', v3.value
-
def test_Environment_global_variable(self):
"""Test setting Environment variable to an Environment.Base subclass"""
class MyEnv(SCons.Environment.Base):
@@ -3746,8 +3651,6 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture):
# Environment()
# FindFile()
# Scanner()
- # SourceSignatures()
- # TargetSignatures()
# It's unlikely Clone() will ever be called this way, so let the
# other methods test that handling overridden values works.