summaryrefslogtreecommitdiffstats
path: root/QMTest
diff options
context:
space:
mode:
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestSCons.py17
-rw-r--r--QMTest/TestSConsign.py24
2 files changed, 25 insertions, 16 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index 1277af5..cfcbfb1 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -338,9 +338,8 @@ class TestSCons(TestCommon):
if options:
arguments = options + " " + arguments
kw['arguments'] = arguments
- kw['stdout'] = self.wrap_stdout(read_str = read_str, build_str = s)
- kw['stdout'] = string.replace(kw['stdout'],'\n','\\n')
- kw['stdout'] = string.replace(kw['stdout'],'.','\\.')
+ stdout = self.wrap_stdout(read_str = read_str, build_str = s)
+ kw['stdout'] = re.escape(stdout)
kw['match'] = self.match_re_dotall
apply(self.run, [], kw)
@@ -350,14 +349,14 @@ class TestSCons(TestCommon):
This function is most useful in conjunction with the -n option.
"""
s = ""
- for arg in string.split(arguments):
- s = s + "(?!scons: `%s' is up to date.)" % arg
+ for arg in string.split(arguments):
+ s = s + "(?!scons: `%s' is up to date.)" % re.escape(arg)
if options:
arguments = options + " " + arguments
+ s = '('+s+'[^\n]*\n)*'
kw['arguments'] = arguments
- kw['stdout'] = self.wrap_stdout(build_str="("+s+"[^\n]*\n)*")
- kw['stdout'] = string.replace(kw['stdout'],'\n','\\n')
- kw['stdout'] = string.replace(kw['stdout'],'.','\\.')
+ stdout = re.escape(self.wrap_stdout(build_str='ARGUMENTSGOHERE'))
+ kw['stdout'] = string.replace(stdout, 'ARGUMENTSGOHERE', s)
kw['match'] = self.match_re_dotall
apply(self.run, [], kw)
@@ -833,7 +832,7 @@ print "self._msvs_versions =", str(env['MSVS']['VERSIONS'])
def __init__(self, p):
self.pos = p
- def matchPart(log, logfile, lastEnd):
+ def matchPart(log, logfile, lastEnd, NoMatch=NoMatch):
m = re.match(log, logfile[lastEnd:])
if not m:
raise NoMatch, lastEnd
diff --git a/QMTest/TestSConsign.py b/QMTest/TestSConsign.py
index d144040..fd8ef30 100644
--- a/QMTest/TestSConsign.py
+++ b/QMTest/TestSConsign.py
@@ -54,13 +54,23 @@ class TestSConsign(TestSCons):
'interpreter' : python, # imported from TestSCons
}
- if os.path.exists(self.script_path('sconsign.py')):
- sconsign = 'sconsign.py'
- elif os.path.exists(self.script_path('sconsign')):
- sconsign = 'sconsign'
- else:
- print "Can find neither 'sconsign.py' nor 'sconsign' scripts."
- self.no_result()
+ if not kw.has_key('program'):
+ kw['program'] = os.environ.get('SCONS')
+ if not kw['program']:
+ if os.path.exists('scons'):
+ kw['program'] = 'scons'
+ else:
+ kw['program'] = 'scons.py'
+
+ sconsign = os.environ.get('SCONSIGN')
+ if not sconsign:
+ if os.path.exists(self.script_path('sconsign.py')):
+ sconsign = 'sconsign.py'
+ elif os.path.exists(self.script_path('sconsign')):
+ sconsign = 'sconsign'
+ else:
+ print "Can find neither 'sconsign.py' nor 'sconsign' scripts."
+ self.no_result()
self.set_sconsign(sconsign)
def script_path(self, script):