|
Boost-Commit : |
From: jurko.gospodnetic_at_[hidden]
Date: 2008-01-05 16:37:15
Author: jurko
Date: 2008-01-05 16:37:15 EST (Sat, 05 Jan 2008)
New Revision: 42499
URL: http://svn.boost.org/trac/boost/changeset/42499
Log:
Test code cleaned up a bit. No functional changes.
Text files modified:
trunk/tools/build/v2/test/alias.py | 109 ++++++++++++++++++++++++++-------------
1 files changed, 72 insertions(+), 37 deletions(-)
Modified: trunk/tools/build/v2/test/alias.py
==============================================================================
--- trunk/tools/build/v2/test/alias.py (original)
+++ trunk/tools/build/v2/test/alias.py 2008-01-05 16:37:15 EST (Sat, 05 Jan 2008)
@@ -6,9 +6,20 @@
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
from BoostBuild import Tester, List
-t = Tester()
-t.write("Jamroot.jam", """
+
+################################################################################
+#
+# test_alias_rule()
+# -----------------
+#
+################################################################################
+
+def test_alias_rule(t):
+ """Basic alias rule test.
+ """
+
+ t.write("Jamroot.jam", """
exe a : a.cpp ;
exe b : b.cpp ;
exe c : c.cpp ;
@@ -20,33 +31,50 @@
exe hello : hello.cpp src ;
""")
-t.write("a.cpp", "int main() { return 0; }\n")
-t.copy("a.cpp", "b.cpp")
-t.copy("a.cpp", "c.cpp")
-t.copy("a.cpp", "hello.cpp")
-t.write("s.cpp", "")
-
-# Check that targets to which "bin1" refers are updated, and only those.
-t.run_build_system("bin1")
-t.expect_addition(List("bin/$toolset/debug/") * "a.exe a.obj")
-t.expect_nothing_more()
-
-# Try again with "bin2"
-t.run_build_system("bin2")
-t.expect_addition(List("bin/$toolset/debug/") * "b.exe b.obj")
-t.expect_nothing_more()
-
-# Try building everything, making sure 'hello' target is created.
-t.run_build_system()
-t.expect_addition(List("bin/$toolset/debug/") * "hello.exe hello.obj")
-t.expect_addition("bin/$toolset/debug/s.obj")
-t.expect_addition(List("bin/$toolset/debug/") * "c.exe c.obj")
-t.expect_nothing_more()
-
-# Regression test.
-# Check if usage requirements are propagated via "alias"
-
-t.write("l.cpp", """
+ t.write("a.cpp", "int main() { return 0; }\n")
+ t.copy("a.cpp", "b.cpp")
+ t.copy("a.cpp", "c.cpp")
+ t.copy("a.cpp", "hello.cpp")
+ t.write("s.cpp", "")
+
+ # Check that targets to which "bin1" refers are updated, and only those.
+ t.run_build_system("bin1")
+ t.expect_addition(List("bin/$toolset/debug/") * "a.exe a.obj")
+ t.expect_nothing_more()
+
+ # Try again with "bin2"
+ t.run_build_system("bin2")
+ t.expect_addition(List("bin/$toolset/debug/") * "b.exe b.obj")
+ t.expect_nothing_more()
+
+ # Try building everything, making sure 'hello' target is created.
+ t.run_build_system()
+ t.expect_addition(List("bin/$toolset/debug/") * "hello.exe hello.obj")
+ t.expect_addition("bin/$toolset/debug/s.obj")
+ t.expect_addition(List("bin/$toolset/debug/") * "c.exe c.obj")
+ t.expect_nothing_more()
+
+
+################################################################################
+#
+# test_alias_source_usage_requirements()
+# --------------------------------------
+#
+################################################################################
+
+def test_alias_source_usage_requirements(t):
+ """Check whether usage requirements are propagated via "alias". In case they
+ are not, linking will fail as there will be no main() function defined
+ anywhere in the source.
+ """
+
+ t.write("Jamroot.jam", """
+lib l : l.cpp : : : <define>WANT_MAIN ;
+alias la : l ;
+exe main : main.cpp la ;
+""")
+
+ t.write("l.cpp", """
void
#if defined(_WIN32)
__declspec(dllexport)
@@ -54,18 +82,25 @@
foo() {}
""")
-t.write("Jamroot.jam", """
-lib l : l.cpp : : : <define>WANT_MAIN ;
-alias la : l ;
-exe main : main.cpp la ;
-""")
-
-t.write("main.cpp", """
+ t.write("main.cpp", """
#ifdef WANT_MAIN
int main() { return 0; }
#endif
""")
-t.run_build_system()
+ t.run_build_system()
+
+
+################################################################################
+#
+# main()
+# ------
+#
+################################################################################
+
+t = Tester()
+
+test_alias_rule(t)
+test_alias_source_usage_requirements(t)
t.cleanup()
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk