summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-03-17 03:06:56 (GMT)
committerSteven Knight <knight@baldmt.com>2005-03-17 03:06:56 (GMT)
commit7e4b4c01d69a2d2a776abb49db68507706ded50e (patch)
tree89d7e783bfa6814d01de40df8a8b9b18539d9ef4
parenta911d49dc68205cebbd6b7e728f2cd1ad49b9aca (diff)
downloadSCons-7e4b4c01d69a2d2a776abb49db68507706ded50e.zip
SCons-7e4b4c01d69a2d2a776abb49db68507706ded50e.tar.gz
SCons-7e4b4c01d69a2d2a776abb49db68507706ded50e.tar.bz2
Windows portability in tests. Replace overlooked import
-rw-r--r--src/engine/SCons/Node/FSTests.py102
-rw-r--r--src/engine/SCons/Platform/win32.py1
-rw-r--r--test/QT/QT.py16
-rw-r--r--test/import.py20
4 files changed, 78 insertions, 61 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 1d7d926..613626b 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -1212,20 +1212,25 @@ class DirTestCase(_tempdirTestCase):
self.fs.BuildDir(bld, src, duplicate=0)
self.fs.BuildDir(sub2, src, duplicate=0)
- s = map(str, src.srcdir_list())
- assert s == [], s
+ def check(result, expect):
+ result = map(str, result)
+ expect = map(os.path.normpath, expect)
+ assert result == expect, result
- s = map(str, bld.srcdir_list())
- assert s == ['src'], s
+ s = src.srcdir_list()
+ check(s, [])
- s = map(str, sub1.srcdir_list())
- assert s == ['src/sub'], s
+ s = bld.srcdir_list()
+ check(s, ['src'])
- s = map(str, sub2.srcdir_list())
- assert s == ['src', 'src/sub/sub'], s
+ s = sub1.srcdir_list()
+ check(s, ['src/sub'])
- s = map(str, sub3.srcdir_list())
- assert s == ['src/sub', 'src/sub/sub/sub'], s
+ s = sub2.srcdir_list()
+ check(s, ['src', 'src/sub/sub'])
+
+ s = sub3.srcdir_list()
+ check(s, ['src/sub', 'src/sub/sub/sub'])
self.fs.BuildDir('src/b1/b2', 'src')
b1 = src.Dir('b1')
@@ -1234,20 +1239,20 @@ class DirTestCase(_tempdirTestCase):
b1_b2_b1_b2 = b1_b2_b1.Dir('b2')
b1_b2_b1_b2_sub = b1_b2_b1_b2.Dir('sub')
- s = map(str, b1.srcdir_list())
- assert s == [], s
+ s = b1.srcdir_list()
+ check(s, [])
- s = map(str, b1_b2.srcdir_list())
- assert s == ['src'], s
+ s = b1_b2.srcdir_list()
+ check(s, ['src'])
- s = map(str, b1_b2_b1.srcdir_list())
- assert s == ['src/b1'], s
+ s = b1_b2_b1.srcdir_list()
+ check(s, ['src/b1'])
- s = map(str, b1_b2_b1_b2.srcdir_list())
- assert s == [], s
+ s = b1_b2_b1_b2.srcdir_list()
+ check(s, [])
- s = map(str, b1_b2_b1_b2_sub.srcdir_list())
- assert s == [], s
+ s = b1_b2_b1_b2_sub.srcdir_list()
+ check(s, [])
def test_srcdir_duplicate(self):
"""Test the Dir.srcdir_duplicate() method
@@ -1266,7 +1271,7 @@ class DirTestCase(_tempdirTestCase):
assert not os.path.exists(test.workpath('bld0', 'does_not_exist'))
n = bld0.srcdir_duplicate('exists', SCons.Node.FS.File)
- assert str(n) == 'src0/exists', str(n)
+ assert str(n) == os.path.normpath('src0/exists'), str(n)
assert not os.path.exists(test.workpath('bld0', 'exists'))
test.subdir('src1')
@@ -1281,7 +1286,7 @@ class DirTestCase(_tempdirTestCase):
assert not os.path.exists(test.workpath('bld1', 'does_not_exist'))
n = bld1.srcdir_duplicate('exists', SCons.Node.FS.File)
- assert str(n) == 'bld1/exists', str(n)
+ assert str(n) == os.path.normpath('bld1/exists'), str(n)
assert os.path.exists(test.workpath('bld1', 'exists'))
def test_srcdir_find_file(self):
@@ -1306,45 +1311,42 @@ class DirTestCase(_tempdirTestCase):
exists = src0.File('exists-f')
exists.exists = return_true
+ def check(result, expect):
+ result = map(str, result)
+ expect = map(os.path.normpath, expect)
+ assert result == expect, result
+
# First check from the source directory.
n = src0.srcdir_find_file('does_not_exist')
assert n == (None, None), n
n = src0.srcdir_find_file('derived-f')
- n = map(str, n)
- assert n == ['src0/derived-f', 'src0'], n
+ check(n, ['src0/derived-f', 'src0'])
n = src0.srcdir_find_file('pseudo-f')
- n = map(str, n)
- assert n == ['src0/pseudo-f', 'src0'], n
+ check(n, ['src0/pseudo-f', 'src0'])
n = src0.srcdir_find_file('exists-f')
- n = map(str, n)
- assert n == ['src0/exists-f', 'src0'], n
+ check(n, ['src0/exists-f', 'src0'])
n = src0.srcdir_find_file('on-disk-f1')
- n = map(str, n)
- assert n == ['src0/on-disk-f1', 'src0'], n
+ check(n, ['src0/on-disk-f1', 'src0'])
# Now check from the build directory.
n = bld0.srcdir_find_file('does_not_exist')
assert n == (None, None), n
n = bld0.srcdir_find_file('derived-f')
- n = map(str, n)
- assert n == ['src0/derived-f', 'bld0'], n
+ check(n, ['src0/derived-f', 'bld0'])
n = bld0.srcdir_find_file('pseudo-f')
- n = map(str, n)
- assert n == ['src0/pseudo-f', 'bld0'], n
+ check(n, ['src0/pseudo-f', 'bld0'])
n = bld0.srcdir_find_file('exists-f')
- n = map(str, n)
- assert n == ['src0/exists-f', 'bld0'], n
+ check(n, ['src0/exists-f', 'bld0'])
n = bld0.srcdir_find_file('on-disk-f2')
- n = map(str, n)
- assert n == ['src0/on-disk-f2', 'bld0'], n
+ check(n, ['src0/on-disk-f2', 'bld0'])
test.subdir('src1')
@@ -1367,40 +1369,32 @@ class DirTestCase(_tempdirTestCase):
assert n == (None, None), n
n = src1.srcdir_find_file('derived-f')
- n = map(str, n)
- assert n == ['src1/derived-f', 'src1'], n
+ check(n, ['src1/derived-f', 'src1'])
n = src1.srcdir_find_file('pseudo-f')
- n = map(str, n)
- assert n == ['src1/pseudo-f', 'src1'], n
+ check(n, ['src1/pseudo-f', 'src1'])
n = src1.srcdir_find_file('exists-f')
- n = map(str, n)
- assert n == ['src1/exists-f', 'src1'], n
+ check(n, ['src1/exists-f', 'src1'])
n = src1.srcdir_find_file('on-disk-f1')
- n = map(str, n)
- assert n == ['src1/on-disk-f1', 'src1'], n
+ check(n, ['src1/on-disk-f1', 'src1'])
# Now check from the build directory.
n = bld1.srcdir_find_file('does_not_exist')
assert n == (None, None), n
n = bld1.srcdir_find_file('derived-f')
- n = map(str, n)
- assert n == ['bld1/derived-f', 'src1'], n
+ check(n, ['bld1/derived-f', 'src1'])
n = bld1.srcdir_find_file('pseudo-f')
- n = map(str, n)
- assert n == ['bld1/pseudo-f', 'src1'], n
+ check(n, ['bld1/pseudo-f', 'src1'])
n = bld1.srcdir_find_file('exists-f')
- n = map(str, n)
- assert n == ['bld1/exists-f', 'src1'], n
+ check(n, ['bld1/exists-f', 'src1'])
n = bld1.srcdir_find_file('on-disk-f2')
- n = map(str, n)
- assert n == ['bld1/on-disk-f2', 'bld1'], n
+ check(n, ['bld1/on-disk-f2', 'bld1'])
class EntryTestCase(unittest.TestCase):
def runTest(self):
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index 382e5b8..58e06da 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -36,6 +36,7 @@ import os
import os.path
import string
import sys
+import tempfile
from SCons.Platform.posix import exitvalmap
from SCons.Platform import TempFileMunge
diff --git a/test/QT/QT.py b/test/QT/QT.py
index 680784f..a6580a6 100644
--- a/test/QT/QT.py
+++ b/test/QT/QT.py
@@ -923,8 +923,20 @@ test.run(chdir='work12', arguments='-n noqtdir=1')
# Consequently, we need to just wipe out its value as follows>
os.environ['QTDIR'] = ''
test.run(chdir='work12', stderr=None, arguments='-n noqtdir=1')
-test.fail_test(not test.match_re(test.stderr(), r"""
+
+moc = test.where_is('moc')
+if moc:
+ import os.path
+ expect = """
+scons: warning: Could not detect qt, using moc executable as a hint \(QTDIR=%s\)
+File "SConstruct", line \d+, in \?
+""" % os.path.dirname(os.path.dirname(moc))
+else:
+ expect = """
scons: warning: Could not detect qt, using empty QTDIR
-""" + TestSCons.file_expr))
+File "SConstruct", line \d+, in \?
+"""
+
+test.fail_test(not test.match_re(test.stderr(), expect))
test.pass_test()
diff --git a/test/import.py b/test/import.py
index 1aae7ce..5bf2042 100644
--- a/test/import.py
+++ b/test/import.py
@@ -140,13 +140,23 @@ scons: warning: Intel license dir was not found. Tried using the INTEL_LICENSE_
File "SConstruct", line 1, in ?
"""
+moc = test.where_is('moc')
+if moc:
+ import os.path
+ qt_err = """
+scons: warning: Could not detect qt, using moc executable as a hint (QTDIR=%s)
+File "SConstruct", line 1, in ?
+""" % os.path.dirname(os.path.dirname(moc))
+else:
+ qt_err = """
+scons: warning: Could not detect qt, using empty QTDIR
+File "SConstruct", line 1, in ?
+"""
+
error_output = {
'icl' : intel_license_warning,
'intelc' : intel_license_warning,
- 'qt' : """
-scons: warning: Could not detect qt, using empty QTDIR
-File "SConstruct", line 1, in ?
-""",
+ 'qt' : qt_err,
}
# An SConstruct for importing Tool names that have illegal characters
@@ -176,7 +186,7 @@ for tool in tools:
if stderr != '' and stderr != error_output.get(tool, ''):
print "Failed importing '%s', stderr:" % tool
print stderr
- failures.append[tool]
+ failures.append(tool)
test.fail_test(len(failures))