summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node/FSTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-02-10 06:02:02 (GMT)
committerSteven Knight <knight@baldmt.com>2005-02-10 06:02:02 (GMT)
commit11f1e91b731f3914d520b3bddb38da3ec55cb7ce (patch)
treeb859c75a691e4a85bfce764b0a1940a2cc2f4c79 /src/engine/SCons/Node/FSTests.py
parentac121612f842bbfe3cf35459dbd85c63c0fa7aa5 (diff)
downloadSCons-11f1e91b731f3914d520b3bddb38da3ec55cb7ce.zip
SCons-11f1e91b731f3914d520b3bddb38da3ec55cb7ce.tar.gz
SCons-11f1e91b731f3914d520b3bddb38da3ec55cb7ce.tar.bz2
Don't create a Node for every file we try to find during scan.
Diffstat (limited to 'src/engine/SCons/Node/FSTests.py')
-rw-r--r--src/engine/SCons/Node/FSTests.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 9e9626a..2846f64 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -408,8 +408,7 @@ class BuildDirTestCase(unittest.TestCase):
fs.BuildDir('build/var3', 'src', duplicate=0)
d1 = fs.Dir('build/var3')
r = d1.rdir()
- s = fs.Dir('src')
- assert r == s, "%s != %s" % (r, s)
+ assert r == d1, "%s != %s" % (r, d1)
# verify the link creation attempts in file_link()
class LinkSimulator :
@@ -542,6 +541,8 @@ class BuildDirTestCase(unittest.TestCase):
'work/src/b1/b2/f' : 'work/src/f',
'work/src/b1/b2/b1' : 'work/src/b1/',
'work/src/b1/b2/b1/f' : 'work/src/b1/f',
+ 'work/src/b1/b2/b1/b2' : 'work/src/b1/b2',
+ 'work/src/b1/b2/b1/b2/f' : 'work/src/b1/b2/f',
}
alter_map = {
@@ -1328,18 +1329,18 @@ class RepositoryTestCase(unittest.TestCase):
list = fs.Rsearchall('#d2')
assert list == [], list
- test.subdir(['work', 'd2'])
fs.File('d2').built() # Clear exists cache
+ test.subdir(['work', 'd2'])
list = fs.Rsearchall('d2')
assert map(str, list) == ['d2'], list
- test.subdir(['rep2', 'd2'])
fs.File('../rep2/d2').built() # Clear exists cache
+ test.subdir(['rep2', 'd2'])
list = fs.Rsearchall('d2')
assert map(str, list) == ['d2', test.workpath('rep2', 'd2')], list
- test.subdir(['rep1', 'd2'])
fs.File('../rep1/d2').built() # Clear exists cache
+ test.subdir(['rep1', 'd2'])
list = fs.Rsearchall('d2')
assert map(str, list) == ['d2',
test.workpath('rep1', 'd2'),
@@ -1348,13 +1349,13 @@ class RepositoryTestCase(unittest.TestCase):
list = fs.Rsearchall(['d3', 'd4'])
assert list == [], list
- test.subdir(['work', 'd3'])
fs.File('d3').built() # Clear exists cache
+ test.subdir(['work', 'd3'])
list = map(str, fs.Rsearchall(['d3', 'd4']))
assert list == ['d3'], list
- test.subdir(['rep3', 'd4'])
fs.File('../rep3/d4').built() # Clear exists cache
+ test.subdir(['rep3', 'd4'])
list = map(str, fs.Rsearchall(['d3', 'd4']))
assert list == ['d3', test.workpath('rep3', 'd4')], list
@@ -1425,6 +1426,8 @@ class find_fileTestCase(unittest.TestCase):
"""Testing find_file function"""
test = TestCmd(workdir = '')
test.write('./foo', 'Some file\n')
+ test.subdir('bar')
+ test.write(['bar', 'on_disk'], 'Another file\n')
fs = SCons.Node.FS.FS(test.workpath(""))
os.chdir(test.workpath("")) # FS doesn't like the cwd to be something other than it's root
node_derived = fs.File(test.workpath('bar/baz'))
@@ -1461,6 +1464,15 @@ class find_fileTestCase(unittest.TestCase):
" find_file: ... FOUND 'baz' in 'bar'\n"
c = sio.getvalue()
assert c == expect, c
+
+ sio = StringIO.StringIO()
+ sys.stdout = sio
+ SCons.Node.FS.find_file('on_disk', paths, fs.File, verbose=1)
+ expect = " find_file: looking for 'on_disk' in '.' ...\n" + \
+ " find_file: looking for 'on_disk' in 'bar' ...\n" + \
+ " find_file: ... FOUND 'on_disk' in 'bar'\n"
+ c = sio.getvalue()
+ assert c == expect, c
finally:
sys.stdout = save_sys_stdout