summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins@gmail.com>2014-07-20 17:01:59 (GMT)
committerWilliam Blevins <wblevins@gmail.com>2014-07-20 17:01:59 (GMT)
commit78dde7017bdd278f24ea885514fbbf0e6c600711 (patch)
treeaf2c5b99f852046b12a563fdfb6a085e7abcfcda /test
parent84a2d823537b9257b7e4b4a5daacb8fc0b962d16 (diff)
downloadSCons-78dde7017bdd278f24ea885514fbbf0e6c600711.zip
SCons-78dde7017bdd278f24ea885514fbbf0e6c600711.tar.gz
SCons-78dde7017bdd278f24ea885514fbbf0e6c600711.tar.bz2
Issue 2395: Added tests from copying broken symlinks.
Diffstat (limited to 'test')
-rw-r--r--test/Copy-Symlinks.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/test/Copy-Symlinks.py b/test/Copy-Symlinks.py
index b2455c4..f8f92d7 100644
--- a/test/Copy-Symlinks.py
+++ b/test/Copy-Symlinks.py
@@ -45,15 +45,19 @@ dirToLink = 'dir'
dirlinkToCopy = 'dirlinkToCopy'
treeToLink = 'tree'
treelinkToCopy = 'treelinkToCopy'
+badToLink = 'None' # do not write this item
+badlinkToCopy = 'badlinkToCopy'
try:
test.symlink( fileToLink, filelinkToCopy )
test.symlink( dirToLink, dirlinkToCopy )
test.symlink( treeToLink, treelinkToCopy )
+ test.symlink( badToLink, badlinkToCopy )
except:
test.no_result()
test.write( fileToLink, fileContents )
+test.subdir( dirToLink )
test.subdir( treeToLink )
test.write( os.path.join( treeToLink, fileToLink ), fileContents )
@@ -66,7 +70,6 @@ Execute( Copy( 'F1', '%(filelinkToCopy)s', False ) )
Execute( Copy( 'L1', '%(filelinkToCopy)s' ) )
Execute( Copy( 'L2', '%(filelinkToCopy)s', True ) )
-Execute( Mkdir( '%(dirToLink)s' ) )
Execute( Copy( 'D1', '%(dirlinkToCopy)s', False ) )
Execute( Copy( 'L3', '%(dirlinkToCopy)s' ) )
Execute( Copy( 'L4', '%(dirlinkToCopy)s', True ) )
@@ -74,6 +77,10 @@ Execute( Copy( 'L4', '%(dirlinkToCopy)s', True ) )
Execute( Copy( 'T1', '%(treelinkToCopy)s', False ) )
Execute( Copy( 'L5', '%(treelinkToCopy)s' ) )
Execute( Copy( 'L6', '%(treelinkToCopy)s', True ) )
+
+Execute( Copy( 'Fails', '%(badlinkToCopy)s', False ) )
+Execute( Copy( 'L7', '%(badlinkToCopy)s' ) )
+Execute( Copy( 'L8', '%(badlinkToCopy)s', True ) )
"""
% locals()
)
@@ -83,20 +90,24 @@ test.must_exist( fileToLink )
test.must_exist( filelinkToCopy )
test.must_exist( dirlinkToCopy )
test.must_exist( treelinkToCopy )
+test.must_not_exist( badToLink )
+test.must_exist( badlinkToCopy )
-expect = test.wrap_stdout(
+expectStdout = test.wrap_stdout(
read_str =
'''\
Copy("F1", "%(filelinkToCopy)s")
Copy("L1", "%(filelinkToCopy)s")
Copy("L2", "%(filelinkToCopy)s")
-Mkdir("%(dirToLink)s")
Copy("D1", "%(dirlinkToCopy)s")
Copy("L3", "%(dirlinkToCopy)s")
Copy("L4", "%(dirlinkToCopy)s")
Copy("T1", "%(treelinkToCopy)s")
Copy("L5", "%(treelinkToCopy)s")
Copy("L6", "%(treelinkToCopy)s")
+Copy("Fails", "badlinkToCopy")
+Copy("L7", "%(badlinkToCopy)s")
+Copy("L8", "%(badlinkToCopy)s")
''' % locals(),
build_str =
'''\
@@ -104,7 +115,12 @@ scons: `.' is up to date.
'''
)
-test.run( stdout = expect )
+expectStderr = \
+'''\
+scons: *** None: No such file or directory
+'''
+
+test.run( stdout = expectStdout, stderr = expectStderr, status = None )
test.must_exist('D1')
test.must_exist('F1')
@@ -113,7 +129,10 @@ test.must_exist('L3')
test.must_exist('L4')
test.must_exist('L5')
test.must_exist('L6')
+test.must_exist('L7')
+test.must_exist('L8')
test.must_exist('T1')
+test.must_not_exist( 'Fails' )
test.must_match( fileToLink, fileContents )
test.must_match( 'F1', fileContents )
@@ -133,12 +152,18 @@ test.fail_test( condition=(not os.path.islink('L3')) )
test.fail_test( condition=(not os.path.islink('L4')) )
test.fail_test( condition=(not os.path.islink('L5')) )
test.fail_test( condition=(not os.path.islink('L6')) )
+test.fail_test( condition=(not os.path.islink('L7')) )
+test.fail_test( condition=(not os.path.islink('L8')) )
+test.fail_test( condition=(os.path.exists('L7')) )
+test.fail_test( condition=(os.path.exists('L8')) )
test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L1')) )
test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L2')) )
test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L3')) )
test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L4')) )
test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L5')) )
test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L6')) )
+test.fail_test( condition=(os.readlink(badlinkToCopy) != os.readlink('L7')) )
+test.fail_test( condition=(os.readlink(badlinkToCopy) != os.readlink('L8')) )
test.pass_test()