Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78538 - in trunk/tools/build/v2: test tools
From: steven_at_[hidden]
Date: 2012-05-22 00:20:34


Author: steven_watanabe
Date: 2012-05-22 00:20:29 EDT (Tue, 22 May 2012)
New Revision: 78538
URL: http://svn.boost.org/trac/boost/changeset/78538

Log:
Make unit-test handle paths containing spaces.
Added:
   trunk/tools/build/v2/test/space_in_path.py (contents, props changed)
Text files modified:
   trunk/tools/build/v2/test/TestCmd.py | 8 +++++++-
   trunk/tools/build/v2/test/test_all.py | 1 +
   trunk/tools/build/v2/tools/testing.jam | 2 +-
   3 files changed, 9 insertions(+), 2 deletions(-)

Modified: trunk/tools/build/v2/test/TestCmd.py
==============================================================================
--- trunk/tools/build/v2/test/TestCmd.py (original)
+++ trunk/tools/build/v2/test/TestCmd.py 2012-05-22 00:20:29 EDT (Tue, 22 May 2012)
@@ -405,7 +405,13 @@
             # (e.g. on Windows). We will be using the os.popen3() Python API
             # which takes a string parameter and so needs its executable quoted
             # in case its name contains spaces.
- cmd[0] = '"' + cmd[0] + '"'
+ for i in xrange(len(cmd)):
+ if '"' in cmd[i]:
+ pass
+ elif cmd[i][-1] == '\\':
+ cmd[i] = '"' + cmd[i] + '\\"'
+ else:
+ cmd[i] = '"' + cmd[i] + '"'
             command_string = join(cmd, " ")
             if ( os.name == 'nt' ):
                 # This is a workaround for a longstanding Python bug on Windows

Added: trunk/tools/build/v2/test/space_in_path.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/space_in_path.py 2012-05-22 00:20:29 EDT (Tue, 22 May 2012)
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+# Copyright 2012 Steven Watanabe
+# 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 paths containing spaces are handled correctly by actions.
+
+import BoostBuild
+
+class unsplit(object):
+ def __init__(self, value):
+ self.value = value
+ def split(self, ignored):
+ return self.value
+
+t = BoostBuild.Tester()
+
+t.write("has space/Jamroot.jam", """
+import testing ;
+unit-test test : test.cpp ;
+""")
+
+t.write("has space/test.cpp", """
+int main() {}
+""")
+
+t.run_build_system(unsplit(["has space"]))
+
+t.cleanup()

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 2012-05-22 00:20:29 EDT (Tue, 22 May 2012)
@@ -209,6 +209,7 @@
           "skipping",
           "sort_rule",
           "source_locations",
+ "space_in_path",
           "stage",
           "standalone",
           "suffix",

Modified: trunk/tools/build/v2/tools/testing.jam
==============================================================================
--- trunk/tools/build/v2/tools/testing.jam (original)
+++ trunk/tools/build/v2/tools/testing.jam 2012-05-22 00:20:29 EDT (Tue, 22 May 2012)
@@ -533,7 +533,7 @@
 actions unit-test
 {
     $(PATH_SETUP)
- $(LAUNCHER) $(>) $(ARGS) && $(.MAKE_FILE) $(<)
+ $(LAUNCHER) "$(>)" $(ARGS) && $(.MAKE_FILE) "$(<)"
 }
 
 


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