summaryrefslogtreecommitdiffstats
path: root/QMTest
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-21 15:13:26 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-04-21 15:13:26 (GMT)
commit57f9a905465a6022db0f0033c956afaecadc5d70 (patch)
treeed317ae6759a0bb9ba2e8a20a93a5f2b6981c876 /QMTest
parentfcd10ca3c39538542594aec5f894fc00fa58bdb1 (diff)
downloadSCons-57f9a905465a6022db0f0033c956afaecadc5d70.zip
SCons-57f9a905465a6022db0f0033c956afaecadc5d70.tar.gz
SCons-57f9a905465a6022db0f0033c956afaecadc5d70.tar.bz2
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Pass the python executable from the -P option to runtest to TestCmd.py. Create the escaped executable name in TestCmd.py as well. Pass those two values into derived test modules. Fix cascade problems in test scripts due to incorrect assumptions about the name of the executable.
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestCmd.py56
-rw-r--r--QMTest/TestCommon.py3
-rw-r--r--QMTest/TestRuntest.py5
-rw-r--r--QMTest/TestSCons.py2
-rw-r--r--QMTest/TestSCons_time.py13
5 files changed, 29 insertions, 50 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index e715acc..0d07be6 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -253,7 +253,8 @@ __all__ = [
'match_exact',
'match_re',
'match_re_dotall',
- 'python_executable',
+ 'python',
+ '_python_',
'TestCmd'
]
@@ -512,13 +513,31 @@ def diff_re(a, b, fromfile='', tofile='',
i = i+1
return result
-if os.name == 'java':
-
- python_executable = os.path.join(sys.prefix, 'jython')
-
+if os.name == 'posix':
+ def escape(arg):
+ "escape shell special characters"
+ slash = '\\'
+ special = '"$'
+ arg = arg.replace(slash, slash+slash)
+ for c in special:
+ arg = arg.replace(c, slash+c)
+ if re_space.search(arg):
+ arg = '"' + arg + '"'
+ return arg
else:
+ # Windows does not allow special characters in file names
+ # anyway, so no need for an escape function, we will just quote
+ # the arg.
+ def escape(arg):
+ if re_space.search(arg):
+ arg = '"' + arg + '"'
+ return arg
- python_executable = sys.executable
+if os.name == 'java':
+ python = os.path.join(sys.prefix, 'jython')
+else:
+ python = os.environ.get("python_executable", sys.executable)
+_python_ = escape(python)
if sys.platform == 'win32':
@@ -913,30 +932,7 @@ class TestCmd(object):
width = self.banner_width
return s + self.banner_char * (width - len(s))
- if os.name == 'posix':
-
- def escape(self, arg):
- "escape shell special characters"
- slash = '\\'
- special = '"$'
-
- arg = arg.replace(slash, slash+slash)
- for c in special:
- arg = arg.replace(c, slash+c)
-
- if re_space.search(arg):
- arg = '"' + arg + '"'
- return arg
-
- else:
-
- # Windows does not allow special characters in file names
- # anyway, so no need for an escape function, we will just quote
- # the arg.
- def escape(self, arg):
- if re_space.search(arg):
- arg = '"' + arg + '"'
- return arg
+ escape = staticmethod(escape)
def canonicalize(self, path):
if is_List(path):
diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py
index 6b452f7..0bc2429 100644
--- a/QMTest/TestCommon.py
+++ b/QMTest/TestCommon.py
@@ -60,7 +60,8 @@ provided by the TestCommon class:
The TestCommon module also provides the following variables
- TestCommon.python_executable
+ TestCommon.python
+ TestCommon._python_
TestCommon.exe_suffix
TestCommon.obj_suffix
TestCommon.shobj_prefix
diff --git a/QMTest/TestRuntest.py b/QMTest/TestRuntest.py
index 11f8ab2..c8b5893 100644
--- a/QMTest/TestRuntest.py
+++ b/QMTest/TestRuntest.py
@@ -26,14 +26,9 @@ from TestCommon import *
from TestCommon import __all__
__all__.extend([ 'TestRuntest',
- 'python',
'pythonstring',
- '_python_',
])
-python = python_executable
-_python_ = '"' + python_executable + '"'
-
if re.search('\s', python):
pythonstring = _python_
else:
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index fa3163b..a8bfd46 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -73,8 +73,6 @@ else:
machine = uname()[4]
machine = machine_map.get(machine, machine)
-python = python_executable
-_python_ = '"' + python_executable + '"'
_exe = exe_suffix
_obj = obj_suffix
_shobj = shobj_suffix
diff --git a/QMTest/TestSCons_time.py b/QMTest/TestSCons_time.py
index e846ab5..ce9e0df 100644
--- a/QMTest/TestSCons_time.py
+++ b/QMTest/TestSCons_time.py
@@ -22,20 +22,9 @@ import sys
from TestCommon import *
from TestCommon import __all__
-__all__.extend([ 'TestSCons',
- 'python',
- '_exe',
- '_obj',
- '_shobj',
- 'lib_',
- '_lib',
- 'dll_',
- '_dll'
+__all__.extend([ 'TestSCons_time',
])
-python = python_executable
-_python_ = '"' + python_executable + '"'
-
SConstruct = """\
import os
print "SConstruct file directory:", os.getcwd()