summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2021-07-21 16:22:18 (GMT)
committerMats Wichmann <mats@linux.com>2021-08-24 15:01:28 (GMT)
commit31518aea4593ae452b73c7acd7e48d604f59d806 (patch)
treef1ab44eac19588253c3ce2a2ee028f035570962c /test
parent370565d50c1c69d17b207021baa6ea608182222d (diff)
downloadSCons-31518aea4593ae452b73c7acd7e48d604f59d806.zip
SCons-31518aea4593ae452b73c7acd7e48d604f59d806.tar.gz
SCons-31518aea4593ae452b73c7acd7e48d604f59d806.tar.bz2
tests: use framework for platform-specific defines
Tweaked some tests which directly set values for _exe, _obj, which are available from the framework. Done for consistency, none of these were doing these wrong. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r--test/Libs/LIBPREFIXES.py12
-rw-r--r--test/Libs/LIBS.py18
-rw-r--r--test/NodeOps.py34
-rw-r--r--test/Repository/CPPPATH.py17
-rw-r--r--test/Repository/Program.py16
-rw-r--r--test/Repository/SConscript.py19
-rw-r--r--test/Repository/absolute-path.py16
-rw-r--r--test/Repository/include.py15
-rw-r--r--test/Repository/link-object.py20
-rw-r--r--test/Repository/multi-dir.py20
-rw-r--r--test/Repository/no-repository.py18
-rw-r--r--test/Repository/top-level-path.py16
-rw-r--r--test/Repository/variants.py17
-rw-r--r--test/Repository/within-repository.py20
-rw-r--r--test/ninja/build_libraries.py56
-rw-r--r--test/option/option--Y.py17
16 files changed, 110 insertions, 221 deletions
diff --git a/test/Libs/LIBPREFIXES.py b/test/Libs/LIBPREFIXES.py
index aed451e..e496ca4 100644
--- a/test/Libs/LIBPREFIXES.py
+++ b/test/Libs/LIBPREFIXES.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,21 +22,17 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
+
import TestSCons
+from TestSCons import _lib
if sys.platform == 'win32':
- _lib = '.lib'
import SCons.Tool.MSCommon as msc
if not msc.msvc_exists():
_lib = '.a'
-else:
- _lib = '.a'
test = TestSCons.TestSCons()
diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py
index 04206ac..33978da 100644
--- a/test/Libs/LIBS.py
+++ b/test/Libs/LIBS.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,22 +22,18 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import TestSCons
-import sys
+from TestSCons import _exe, lib_, _lib
if sys.platform == 'win32':
- _exe = '.exe'
- bar_lib = 'bar.lib'
import SCons.Tool.MSCommon as msc
if not msc.msvc_exists():
- bar_lib = 'libbar.a'
-else:
- _exe = ''
- bar_lib = 'libbar.a'
+ _lib = '.a'
+ lib_ = 'lib'
+bar_lib = lib_ + 'bar' + _lib
test = TestSCons.TestSCons()
diff --git a/test/NodeOps.py b/test/NodeOps.py
index ae200f6..a5300f1 100644
--- a/test/NodeOps.py
+++ b/test/NodeOps.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,29 +22,23 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-# This test is used to verify that the Buildability of a set of nodes
-# is unaffected by various querying operations on those nodes:
-#
-# 1) Calling exists() on a Node (e.g. from find_file) in a VariantDir
-# will cause that node to be duplicated into the builddir.
-# However, this should *not* occur during a dryrun (-n). When not
-# performed during a dryrun, this should not affect buildability.
-# 2) Calling is_derived() should not affect buildability.
+"""
+This test is used to verify that the Buildability of a set of nodes
+is unaffected by various querying operations on those nodes:
+
+1) Calling exists() on a Node (e.g. from find_file) in a VariantDir
+ will cause that node to be duplicated into the builddir.
+ However, this should *not* occur during a dryrun (-n). When not
+ performed during a dryrun, this should not affect buildability.
+2) Calling is_derived() should not affect buildability.
+"""
import sys
-import TestSCons
import os
-_exe = TestSCons._exe
-lib_ = TestSCons.lib_
-_lib = TestSCons._lib
-_obj = TestSCons._obj
-dll_ = TestSCons.dll_
-_dll = TestSCons._dll
+import TestSCons
+from TestSCons import _exe, lib_, _lib, _obj, dll_, _dll
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
diff --git a/test/Repository/CPPPATH.py b/test/Repository/CPPPATH.py
index ff1dbfe..93c6ffe 100644
--- a/test/Repository/CPPPATH.py
+++ b/test/Repository/CPPPATH.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,19 +22,11 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
+from TestSCons import TestSCons, _exe
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
-
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('repository',
['repository', 'include1'],
@@ -43,7 +37,6 @@ work_foo = test.workpath('work', 'foo')
opts = '-Y ' + test.workpath('repository')
-#
test.write(['repository', 'include1', 'foo.h'], r"""
#define STRING "repository/include1/foo.h"
""")
diff --git a/test/Repository/Program.py b/test/Repository/Program.py
index 3946d95..1b06a5d 100644
--- a/test/Repository/Program.py
+++ b/test/Repository/Program.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,21 +22,13 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
for implicit_deps in ['0', '1', '2', '\"all\"']:
# First, test a single repository.
- test = TestSCons.TestSCons()
+ test = TestSCons()
test.subdir('repository', 'work1')
repository = test.workpath('repository')
repository_foo_c = test.workpath('repository', 'foo.c')
diff --git a/test/Repository/SConscript.py b/test/Repository/SConscript.py
index 1482800..709f1ca 100644
--- a/test/Repository/SConscript.py
+++ b/test/Repository/SConscript.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,25 +22,16 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test how we handle SConscript calls when using a Repository.
"""
import sys
-import TestSCons
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
-test = TestSCons.TestSCons()
+test = TestSCons()
-#
test.subdir('work',
['work', 'src'],
'rep1',
@@ -48,11 +41,9 @@ test.subdir('work',
['rep2', 'src'],
['rep2', 'src', 'sub'])
-#
workpath_rep1 = test.workpath('rep1')
workpath_rep2 = test.workpath('rep2')
-#
test.write(['work', 'SConstruct'], """
Repository(r'%s')
SConscript('src/SConscript')
diff --git a/test/Repository/absolute-path.py b/test/Repository/absolute-path.py
index 5bd10e4..8e363e0 100644
--- a/test/Repository/absolute-path.py
+++ b/test/Repository/absolute-path.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,20 +22,13 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
import sys
-import TestSCons
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('repository',
['repository', 'src'],
@@ -46,7 +41,6 @@ work_src_foo = test.workpath('work', 'src', 'foo' + _exe)
opts = "-Y " + test.workpath('repository')
-#
test.write(['repository', 'SConstruct'], r"""
SConscript(r'%s')
""" % src_SConscript)
diff --git a/test/Repository/include.py b/test/Repository/include.py
index c52765c..ae0bc04 100644
--- a/test/Repository/include.py
+++ b/test/Repository/include.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,19 +22,12 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('repository', 'work')
diff --git a/test/Repository/link-object.py b/test/Repository/link-object.py
index 78add90..f7966d1 100644
--- a/test/Repository/link-object.py
+++ b/test/Repository/link-object.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,31 +22,19 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
+test = TestSCons()
-test = TestSCons.TestSCons()
-
-#
test.subdir('repository', 'work')
-#
workpath_repository = test.workpath('repository')
repository_foo = test.workpath('repository', 'foo' + _exe)
work_foo = test.workpath('work', 'foo' + _exe)
-#
test.write(['repository', 'SConstruct'], """
Repository(r'%s')
env = Environment()
diff --git a/test/Repository/multi-dir.py b/test/Repository/multi-dir.py
index 8a82126..6500581 100644
--- a/test/Repository/multi-dir.py
+++ b/test/Repository/multi-dir.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,23 +22,13 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
+test = TestSCons()
-test = TestSCons.TestSCons()
-
-#
test.subdir('work',
['work', 'src'],
['work', 'include'],
@@ -44,7 +36,6 @@ test.subdir('work',
['repository', 'src'],
['repository', 'include'])
-#
workpath_repository = test.workpath('repository')
work_include_my_string_h = test.workpath('work', 'include', 'my_string.h')
work_src_xxx = test.workpath('work', 'src', 'xxx')
@@ -52,7 +43,6 @@ repository_src_xxx = test.workpath('repository', 'src', 'xxx')
opts = "-Y " + workpath_repository
-#
test.write(['repository', 'SConstruct'], """
env = Environment(CPPPATH = ['#src', '#include'])
SConscript('src/SConscript', "env")
diff --git a/test/Repository/no-repository.py b/test/Repository/no-repository.py
index 7d12b90..ba6138d 100644
--- a/test/Repository/no-repository.py
+++ b/test/Repository/no-repository.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,22 +22,12 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-
-python = TestSCons.python
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('work')
diff --git a/test/Repository/top-level-path.py b/test/Repository/top-level-path.py
index d8ed9e2..bc2ce72 100644
--- a/test/Repository/top-level-path.py
+++ b/test/Repository/top-level-path.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,20 +22,13 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
import sys
-import TestSCons
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('repository',
['repository', 'src'],
@@ -45,7 +40,6 @@ work_src_foo = test.workpath('work', 'src', 'foo' + _exe)
opts = "-Y " + test.workpath('repository')
-#
test.write(['repository', 'SConstruct'], r"""
SConscript(r'%s')
""" % src_SConscript)
diff --git a/test/Repository/variants.py b/test/Repository/variants.py
index f6b53eb..f89605b 100644
--- a/test/Repository/variants.py
+++ b/test/Repository/variants.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,23 +22,14 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
import sys
import time
-import TestSCons
-if sys.platform == 'win32':
- _obj = '.obj'
- _exe = '.exe'
-else:
- _obj = '.o'
- _exe = ''
+from TestSCons import TestSCons, _exe, _obj
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('repository',
['repository', 'src1'],
diff --git a/test/Repository/within-repository.py b/test/Repository/within-repository.py
index 6bcc2fa..f9a04e6 100644
--- a/test/Repository/within-repository.py
+++ b/test/Repository/within-repository.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,31 +22,19 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+from TestSCons import TestSCons, _exe
+test = TestSCons()
-test = TestSCons.TestSCons()
-
-#
test.subdir('repository', ['repository', 'src'])
-#
workpath_repository = test.workpath('repository')
repository_foo = test.workpath('repository', 'foo' + _exe)
repository_src_bar = test.workpath('repository', 'src', 'bar' + _exe)
-#
test.write(['repository', 'SConstruct'], """
Repository(r'%s')
SConscript('src/SConscript')
diff --git a/test/ninja/build_libraries.py b/test/ninja/build_libraries.py
index 01c2707..385a493 100644
--- a/test/ninja/build_libraries.py
+++ b/test/ninja/build_libraries.py
@@ -20,27 +20,23 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
import os
import TestSCons
from TestCmd import IS_WINDOWS, IS_MACOS
+from TestSCons import _python_, _exe, _lib, lib_, _dll, dll_
test = TestSCons.TestSCons()
try:
import ninja
except ImportError:
- test.skip_test("Could not find ninja module in python")
+ test.skip_test("Could not find ninja module. Skipping test.\n")
ninja_binary = test.where_is('ninja')
if not ninja_binary:
- test.skip_test("Could not find ninja. Skipping test.")
-
-_python_ = TestSCons._python_
-_exe = TestSCons._exe
+ test.skip_test("Could not find ninja executable. Skipping test.\n")
ninja_bin = os.path.abspath(os.path.join(
ninja.__file__,
@@ -51,35 +47,23 @@ ninja_bin = os.path.abspath(os.path.join(
test.dir_fixture('ninja-fixture')
-if IS_WINDOWS:
- lib_suffix = '.lib'
- staticlib_suffix = '.lib'
- lib_prefix = ''
- win32 = ", 'WIN32'"
-else:
- lib_suffix = '.so'
- staticlib_suffix = '.a'
- lib_prefix = 'lib'
- win32 = ''
-
-if IS_MACOS:
- lib_suffix = '.dylib'
+win32 = ", 'WIN32'" if IS_WINDOWS else ""
test.write('SConstruct', """
-SetOption('experimental','ninja')
+SetOption('experimental', 'ninja')
DefaultEnvironment(tools=[])
env = Environment()
env.Tool('ninja')
env['NINJA'] = r"%(ninja_bin)s"
-shared_lib = env.SharedLibrary(target = 'test_impl', source = 'test_impl.c', CPPDEFINES=['LIBRARY_BUILD'%(win32)s])
-env.Program(target = 'test', source = 'test1.c', LIBS=['test_impl'], LIBPATH=['.'], RPATH='.')
-
-static_obj = env.Object(target = 'test_impl_static', source = 'test_impl.c')
-static_lib = env.StaticLibrary(target = 'test_impl_static', source = static_obj)
-static_obj = env.Object(target = 'test_static', source = 'test1.c')
-env.Program(target = 'test_static', source = static_obj, LIBS=[static_lib], LIBPATH=['.'])
+shared_lib = env.SharedLibrary(target='test_impl', source='test_impl.c', CPPDEFINES=['LIBRARY_BUILD'%(win32)s])
+env.Program(target='test', source='test1.c', LIBS=['test_impl'], LIBPATH=['.'], RPATH='.')
+static_obj = env.Object(target='test_impl_static', source='test_impl.c')
+static_lib = env.StaticLibrary(target='test_impl_static', source=static_obj)
+static_obj = env.Object(target='test_static', source='test1.c')
+env.Program(target='test_static', source=static_obj, LIBS=[static_lib], LIBPATH=['.'])
""" % locals())
+
# generate simple build
test.run(stdout=None)
test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
@@ -90,12 +74,16 @@ test.run(program=test.workpath('test_static'), stdout="library_function")
# clean build and ninja files
test.run(arguments='-c', stdout=None)
-test.must_contain_all_lines(test.stdout(), [
- ('Removed %stest_impl' % lib_prefix) + lib_suffix,
- 'Removed test' + _exe,
- ('Removed %stest_impl_static' % lib_prefix) + staticlib_suffix,
- 'Removed test_static' + _exe,
- 'Removed build.ninja'])
+test.must_contain_all_lines(
+ test.stdout(),
+ [
+ ('Removed %stest_impl' % dll_) + _dll,
+ 'Removed test' + _exe,
+ ('Removed %stest_impl_static' % lib_) + _lib,
+ 'Removed test_static' + _exe,
+ 'Removed build.ninja',
+ ],
+)
# only generate the ninja file
test.run(arguments='--disable-execute-ninja', stdout=None)
diff --git a/test/option/option--Y.py b/test/option/option--Y.py
index 69951c0..9293f67 100644
--- a/test/option/option--Y.py
+++ b/test/option/option--Y.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,21 +22,12 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
-import TestSCons
-
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
-
+from TestSCons import TestSCons, _exe
-test = TestSCons.TestSCons()
+test = TestSCons()
test.subdir('repository', 'work1')