From 50f4fe43bd90b2440aad13cae7e0fbf48ce96502 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 26 Nov 2018 13:38:44 -0700 Subject: Add correct archiver tool for clang on win32 Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + test/Clang/clang_static_library.py | 20 +++++++++++++++++--- test/Clang/clangxx_static_library.py | 20 +++++++++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 97c3455..95c2f03 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -176,6 +176,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Update (pep8) configure-cache script, add a --show option. - Fix for a couple of "what if tool not found" exceptions in framework. - Add Textfile/Substfile to default environment. (issue #3147) + - Make the clang StaticLibrary tests work on win32. From Bernhard M. Wiedemann: - Update SCons' internal scons build logic to allow overriding build date diff --git a/test/Clang/clang_static_library.py b/test/Clang/clang_static_library.py index 7dedc6f..c5ab668 100644 --- a/test/Clang/clang_static_library.py +++ b/test/Clang/clang_static_library.py @@ -24,6 +24,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys + import TestSCons _exe = TestSCons._exe @@ -32,11 +34,23 @@ test = TestSCons.TestSCons() if not test.where_is('clang'): test.skip_test("Could not find 'clang', skipping test.\n") +if sys.platform == 'win32': + foo_lib = 'foo.lib' + archiver = 'mslib' + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + foo_lib = 'libfoo.a' + archiver = 'ar' +else: + foo_lib = 'libfoo.a' + archiver = 'ar' + + test.write('SConstruct', """\ DefaultEnvironment(tools=[]) -env = Environment(tools=['mingw','clang', 'ar']) +env = Environment(tools=['mingw','clang', '%s']) env.StaticLibrary('foo', 'foo.c') -""") +""" % archiver) test.write('foo.c', """\ int bar() { @@ -46,7 +60,7 @@ int bar() { test.run() -test.must_exist(test.workpath('libfoo.a')) +test.must_exist(test.workpath(foo_lib)) test.pass_test() diff --git a/test/Clang/clangxx_static_library.py b/test/Clang/clangxx_static_library.py index c768deb..8159eac 100644 --- a/test/Clang/clangxx_static_library.py +++ b/test/Clang/clangxx_static_library.py @@ -24,6 +24,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import sys + import TestSCons _exe = TestSCons._exe @@ -32,11 +34,23 @@ test = TestSCons.TestSCons() if not test.where_is('clang'): test.skip_test("Could not find 'clang++', skipping test.\n") +if sys.platform == 'win32': + foo_lib = 'foo.lib' + archiver = 'mslib' + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + foo_lib = 'libfoo.a' + archiver = 'ar' +else: + foo_lib = 'libfoo.a' + archiver = 'ar' + + test.write('SConstruct', """\ DefaultEnvironment(tools=[]) -env = Environment(tools=['mingw','clang++', 'ar']) +env = Environment(tools=['mingw','clang++', '%s']) env.StaticLibrary('foo', 'foo.cpp') -""") +""" % archiver) test.write('foo.cpp', """\ int bar() { @@ -46,7 +60,7 @@ int bar() { test.run() -test.must_exist(test.workpath('libfoo.a')) +test.must_exist(test.workpath(foo_lib)) test.pass_test() -- cgit v0.12 From 62e885c01a370fb0f3eee7ca9e837d2612099fef Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 28 Nov 2018 09:42:18 -0700 Subject: PR #3244: changes per review for clang StaticLib tests Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 - test/Clang/clang_static_library.py | 11 ++++------- test/Clang/clangxx_static_library.py | 11 ++++------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 95c2f03..97c3455 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -176,7 +176,6 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Update (pep8) configure-cache script, add a --show option. - Fix for a couple of "what if tool not found" exceptions in framework. - Add Textfile/Substfile to default environment. (issue #3147) - - Make the clang StaticLibrary tests work on win32. From Bernhard M. Wiedemann: - Update SCons' internal scons build logic to allow overriding build date diff --git a/test/Clang/clang_static_library.py b/test/Clang/clang_static_library.py index c5ab668..1198638 100644 --- a/test/Clang/clang_static_library.py +++ b/test/Clang/clang_static_library.py @@ -24,8 +24,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import sys - import TestSCons _exe = TestSCons._exe @@ -34,13 +32,12 @@ test = TestSCons.TestSCons() if not test.where_is('clang'): test.skip_test("Could not find 'clang', skipping test.\n") -if sys.platform == 'win32': +if test.IS_WINDOWS: foo_lib = 'foo.lib' archiver = 'mslib' - import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): - foo_lib = 'libfoo.a' - archiver = 'ar' + # TODO: other Windows combinations exist (not depending on + # mslib (lib.exe) from MS Build Tools / Visual Studio). + # Expand this if there is demand. else: foo_lib = 'libfoo.a' archiver = 'ar' diff --git a/test/Clang/clangxx_static_library.py b/test/Clang/clangxx_static_library.py index 8159eac..f4902e2 100644 --- a/test/Clang/clangxx_static_library.py +++ b/test/Clang/clangxx_static_library.py @@ -24,8 +24,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import sys - import TestSCons _exe = TestSCons._exe @@ -34,13 +32,12 @@ test = TestSCons.TestSCons() if not test.where_is('clang'): test.skip_test("Could not find 'clang++', skipping test.\n") -if sys.platform == 'win32': +if test.IS_WINDOWS: foo_lib = 'foo.lib' archiver = 'mslib' - import SCons.Tool.MSCommon as msc - if not msc.msvc_exists(): - foo_lib = 'libfoo.a' - archiver = 'ar' + # TODO: other Windows combinations exist (not depending on + # mslib (lib.exe) from MS Build Tools / Visual Studio). + # Expand this if there is demand. else: foo_lib = 'libfoo.a' archiver = 'ar' -- cgit v0.12