Boost logo

Boost-Commit :

From: jurko.gospodnetic_at_[hidden]
Date: 2008-01-07 13:38:28


Author: jurko
Date: 2008-01-07 13:38:28 EST (Mon, 07 Jan 2008)
New Revision: 42568
URL: http://svn.boost.org/trac/boost/changeset/42568

Log:
Added a new configuration test making sure that the bug with not being able to process absolute user-config configuration file references never rears its ugly head again.
Added:
   trunk/tools/build/v2/test/configuration.py (contents, props changed)
Text files modified:
   trunk/tools/build/v2/test/test_all.py | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Added: trunk/tools/build/v2/test/configuration.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/configuration.py 2008-01-07 13:38:28 EST (Mon, 07 Jan 2008)
@@ -0,0 +1,109 @@
+#!/usr/bin/python
+
+# Copyright 2008 Jurko Gospodnetic
+# 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)
+
+# Test that Boost Build configuration file handling.
+
+import BoostBuild
+import os.path
+import string
+
+
+################################################################################
+#
+# test_user_configuration()
+# -------------------------
+#
+################################################################################
+
+def test_user_configuration():
+ """Test Boost Build user configuration handling. Both relative and absolute
+ path handling is tested.
+ """
+
+ t = BoostBuild.Tester("--debug-configuration", pass_toolset=False, use_test_config=False)
+
+ implicitConfigLoadMessage = "notice: Loading user-config configuration file: *"
+ explicitConfigLoadMessage = "notice: Loading explicitly specified user configuration file:"
+ testMessage = "_!_!_!_!_!_!_!_!_ %s _!_!_!_!_!_!_!_!_"
+ toolsetName = "__myDummyToolset__"
+ subdirName = "ASubDirectory"
+ configFileNames = ["ups_lala_1.jam", "ups_lala_2.jam",
+ os.path.join(subdirName, "ups_lala_3.jam")]
+
+ for configFileName in configFileNames:
+ message = "ECHO \"%s\" ;" % testMessage % configFileName
+ # We need to double any backslashes in the message or Jam will interpret
+ # them as escape characters.
+ t.write(configFileName, message.replace("\\", "\\\\"))
+
+ # Prepare a dummy toolset so we do not get errors in case the default one is
+ # not found.
+ t.write(toolsetName + ".jam", """
+import feature ;
+feature.extend toolset : %s ;
+rule init ( ) { }
+""" % toolsetName )
+ t.write("Jamroot.jam", "using %s ;" % toolsetName)
+
+ t.run_build_system()
+ t.expect_output_line(explicitConfigLoadMessage, False)
+ t.expect_output_line(testMessage % configFileNames[0], False)
+ t.expect_output_line(testMessage % configFileNames[1], False)
+ t.expect_output_line(testMessage % configFileNames[2], False)
+
+ t.run_build_system("--user-config=")
+ t.expect_output_line(implicitConfigLoadMessage, False)
+ t.expect_output_line(explicitConfigLoadMessage, False)
+ t.expect_output_line(testMessage % configFileNames[0], False)
+ t.expect_output_line(testMessage % configFileNames[1], False)
+ t.expect_output_line(testMessage % configFileNames[2], False)
+
+ t.run_build_system('--user-config=""')
+ t.expect_output_line(implicitConfigLoadMessage, False)
+ t.expect_output_line(explicitConfigLoadMessage, False)
+ t.expect_output_line(testMessage % configFileNames[0], False)
+ t.expect_output_line(testMessage % configFileNames[1], False)
+ t.expect_output_line(testMessage % configFileNames[2], False)
+
+ t.run_build_system('--user-config="%s"' % configFileNames[0])
+ t.expect_output_line(implicitConfigLoadMessage, False)
+ t.expect_output_line(explicitConfigLoadMessage)
+ t.expect_output_line(testMessage % configFileNames[0] )
+ t.expect_output_line(testMessage % configFileNames[1], False)
+ t.expect_output_line(testMessage % configFileNames[2], False)
+
+ t.run_build_system('--user-config="%s"' % configFileNames[2])
+ t.expect_output_line(implicitConfigLoadMessage, False)
+ t.expect_output_line(explicitConfigLoadMessage)
+ t.expect_output_line(testMessage % configFileNames[0], False)
+ t.expect_output_line(testMessage % configFileNames[1], False)
+ t.expect_output_line(testMessage % configFileNames[2] )
+
+ t.run_build_system('--user-config="%s"' % os.path.abspath(configFileNames[1]))
+ t.expect_output_line(implicitConfigLoadMessage, False)
+ t.expect_output_line(explicitConfigLoadMessage)
+ t.expect_output_line(testMessage % configFileNames[0], False)
+ t.expect_output_line(testMessage % configFileNames[1] )
+ t.expect_output_line(testMessage % configFileNames[2], False)
+
+ t.run_build_system('--user-config="%s"' % os.path.abspath(configFileNames[2]))
+ t.expect_output_line(implicitConfigLoadMessage, False)
+ t.expect_output_line(explicitConfigLoadMessage)
+ t.expect_output_line(testMessage % configFileNames[0], False)
+ t.expect_output_line(testMessage % configFileNames[1], False)
+ t.expect_output_line(testMessage % configFileNames[2] )
+
+ t.cleanup()
+
+
+################################################################################
+#
+# main()
+# ------
+#
+################################################################################
+
+test_user_configuration()

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2008-01-07 13:38:28 EST (Mon, 07 Jan 2008)
@@ -109,6 +109,7 @@
           "conditionals",
           "conditionals2",
           "conditionals3",
+ "configuration",
           "indirect_conditional",
           "stage",
           "prebuilt",


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