From cf2e6f77edb453aa4cbc786e72f1b8af5848b974 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 9 Dec 2011 16:08:44 +0000 Subject: [PATCH] Fix direct_request_test and add it to test_all.py. [SVN r75877] --- test/direct-request-test/a.cpp | 19 ----------- test/direct-request-test/b.cpp | 22 ------------ test/direct-request-test/b_inverse.cpp | 22 ------------ test/direct-request-test/jamfile.jam | 13 ------- test/direct-request-test/jamfile2.jam | 9 ----- test/direct-request-test/jamroot.jam | 6 ---- test/direct_request_test.py | 47 ++++++++++++++++++++++---- test/test_all.py | 1 + 8 files changed, 41 insertions(+), 98 deletions(-) delete mode 100644 test/direct-request-test/a.cpp delete mode 100644 test/direct-request-test/b.cpp delete mode 100644 test/direct-request-test/b_inverse.cpp delete mode 100644 test/direct-request-test/jamfile.jam delete mode 100644 test/direct-request-test/jamfile2.jam delete mode 100644 test/direct-request-test/jamroot.jam diff --git a/test/direct-request-test/a.cpp b/test/direct-request-test/a.cpp deleted file mode 100644 index cb97ea0c3..000000000 --- a/test/direct-request-test/a.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2003 Vladimir Prus -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// http://www.boost.org -// - -void -# ifdef _WIN32 -__declspec(dllimport) -# endif -foo(); - -int main() -{ - foo(); -} diff --git a/test/direct-request-test/b.cpp b/test/direct-request-test/b.cpp deleted file mode 100644 index 22dc6bb5d..000000000 --- a/test/direct-request-test/b.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2003 Vladimir Prus -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// http://www.boost.org -// - -// This file will declare 'foo' is 'MACROS' is defined. - -#ifdef MACROS -void -# ifdef _WIN32 -__declspec(dllexport) -# endif -foo() {} -#endif - -# ifdef _WIN32 -int __declspec(dllexport) force_implib_creation; -# endif diff --git a/test/direct-request-test/b_inverse.cpp b/test/direct-request-test/b_inverse.cpp deleted file mode 100644 index 5068f6118..000000000 --- a/test/direct-request-test/b_inverse.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2003 Vladimir Prus -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// http://www.boost.org -// - -// This file will declare 'foo' is 'MACROS' is NOT defined. - -#ifndef MACROS -void -# ifdef _WIN32 -__declspec(dllexport) -# endif -foo() {} -#endif - -# ifdef _WIN32 -int __declspec(dllexport) force_implib_creation; -# endif diff --git a/test/direct-request-test/jamfile.jam b/test/direct-request-test/jamfile.jam deleted file mode 100644 index f57874d3f..000000000 --- a/test/direct-request-test/jamfile.jam +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2002 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - - -# This will link correctly only if symbol MACROS is defined when compiling -# b.cpp. However, this is only possible if that symbol is requested -# on command line and b.cpp is compiled with directly requested -# properties. - -exe a : a.cpp b ; - -lib b : b.cpp ; diff --git a/test/direct-request-test/jamfile2.jam b/test/direct-request-test/jamfile2.jam deleted file mode 100644 index bc7e1bc74..000000000 --- a/test/direct-request-test/jamfile2.jam +++ /dev/null @@ -1,9 +0,0 @@ - -# This will link correctly only if symbol MACROS is not defined when -# compiling b.cpp. This tests if direct build request -# 'release MACROS' to 'b' does not add 'MACROS' when 'b' -# is compiled with 'debug' -- the version needed by 'a'. - -exe a : a.cpp b : debug ; - -lib b : b.cpp ; \ No newline at end of file diff --git a/test/direct-request-test/jamroot.jam b/test/direct-request-test/jamroot.jam deleted file mode 100644 index 845aca854..000000000 --- a/test/direct-request-test/jamroot.jam +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2002 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - - -import gcc ; diff --git a/test/direct_request_test.py b/test/direct_request_test.py index 000d15b64..32121f1d7 100644 --- a/test/direct_request_test.py +++ b/test/direct_request_test.py @@ -4,9 +4,42 @@ import BoostBuild t = BoostBuild.Tester() - # First check some startup. -t.set_tree("direct-request-test") + +t.write("jamroot.jam", "") + +t.write("jamfile.jam", """ +exe a : a.cpp b ; +lib b : b.cpp ; +""") + +t.write("a.cpp", """ +void +# ifdef _WIN32 +__declspec(dllimport) +# endif +foo(); + +int main() +{ + foo(); +} +""") + +t.write("b.cpp", """ +#ifdef MACROS +void +# ifdef _WIN32 +__declspec(dllexport) +# endif +foo() {} +#endif + +# ifdef _WIN32 +int __declspec(dllexport) force_implib_creation; +# endif +""") + t.run_build_system(extra_args="define=MACROS") t.expect_addition("bin/$toolset/debug/" * (BoostBuild.List("a.obj b.obj b.dll a.exe"))) @@ -19,11 +52,11 @@ t.expect_addition("bin/$toolset/debug/" * (BoostBuild.List("a.obj b.obj b.dll a.exe"))) -# When building release version, the 'define' should not apply: we will have -# direct build request 'release MACROS' and a real build property -# 'debug'. -t.copy("jamfile2.jam", "jamfile.jam") -t.copy("b_inverse.cpp", "b.cpp") +# When building release version, the 'define' still applies. +t.write("jamfile.jam", """ +exe a : a.cpp b : debug ; +lib b : b.cpp ; +""") t.rm("bin") t.run_build_system(extra_args="release define=MACROS") diff --git a/test/test_all.py b/test/test_all.py index e6e7e381f..195dea29a 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -158,6 +158,7 @@ tests = [ "absolute_sources", # "default_toolset", "dependency_property", "dependency_test", + "direct_request_test", "disambiguation", "dll_path", "double_loading",