summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2025-02-08 00:12:39 (GMT)
committerMats Wichmann <mats@linux.com>2025-02-08 00:12:39 (GMT)
commit07e63ae27ecdd710fef08b6e9344faa71ce4885d (patch)
tree1a5ddff215ca6162c8f43c65b6c2b85a0185e12a /test
parent2bb3cd381c0df6d8a7170692c692f47efa648e08 (diff)
downloadSCons-07e63ae27ecdd710fef08b6e9344faa71ce4885d.zip
SCons-07e63ae27ecdd710fef08b6e9344faa71ce4885d.tar.gz
SCons-07e63ae27ecdd710fef08b6e9344faa71ce4885d.tar.bz2
Minor fixes to CheckLibWithHeader test
Add boilderplate header/footer, fix one place where the wrong (non-portable) name for a library was used. Still does not build on Windows, due to mismatch between .dll/.lib construction. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r--test/Configure/CheckLibWithHeader_extra_libs.py51
1 files changed, 43 insertions, 8 deletions
diff --git a/test/Configure/CheckLibWithHeader_extra_libs.py b/test/Configure/CheckLibWithHeader_extra_libs.py
index 0be8999..0b7a560 100644
--- a/test/Configure/CheckLibWithHeader_extra_libs.py
+++ b/test/Configure/CheckLibWithHeader_extra_libs.py
@@ -1,6 +1,31 @@
+#!/usr/bin/env python
+#
+# 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
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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
+
"""
-Verify that a program which depends on library which in turns depend on another library
-can be built correctly using CheckLibWithHeader
+Verify that a program which depends on library which in turn depends
+on another library can be built correctly using CheckLibWithHeader
"""
from pathlib import Path
@@ -9,7 +34,7 @@ from TestSCons import TestSCons
test = TestSCons(match=TestSCons.match_re_dotall)
-
+# This is the first library project
libA_dir = Path(test.workdir) / "libA"
libA_dir.mkdir()
test.write(
@@ -32,12 +57,13 @@ void libA() {
test.write(
str(libA_dir / "SConstruct"),
"""\
-SharedLibrary('libA', source=['libA.c'])
+DefaultEnvironment(tools=[])
+SharedLibrary('A', source=['libA.c'])
""",
)
-test.run(chdir=libA_dir)
-
+test.run(arguments='-C libA')
+# This is the second library project, depending on the first
libB_dir = Path(test.workdir) / "libB"
libB_dir.mkdir()
test.write(
@@ -61,8 +87,9 @@ void libB () {
test.write(
str(libB_dir / "SConstruct"),
"""\
+DefaultEnvironment(tools=[])
SharedLibrary(
- 'libB',
+ 'B',
source=['libB.c'],
LIBS=['A'],
LIBPATH='../libA',
@@ -70,12 +97,14 @@ SharedLibrary(
)
""",
)
-test.run(chdir=libB_dir)
+test.run(arguments='-C libB')
+# With the two projects built, we can now run the Configure check
test.write(
"SConstruct",
"""\
import os
+
env = Environment(ENV=os.environ, CPPPATH=['libB', 'libA'], LIBPATH=['libB', 'libA'])
conf = Configure(env)
@@ -92,3 +121,9 @@ assert ret
)
test.run()
test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: