summaryrefslogtreecommitdiffstats
path: root/test/Install
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2015-09-21 17:03:12 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2015-09-21 17:03:12 (GMT)
commit0941093e0e5a030faa49968457638a3a6aee7ad8 (patch)
tree6d33513c14eb6eac0531dd050de0ecca4c39bd79 /test/Install
downloadSCons-2.4.0.zip
SCons-2.4.0.tar.gz
SCons-2.4.0.tar.bz2
release 2.4.02.4.0
Diffstat (limited to 'test/Install')
-rw-r--r--test/Install/Clone.py75
-rw-r--r--test/Install/INSTALLSTR.py58
-rw-r--r--test/Install/Install.py154
-rw-r--r--test/Install/InstallAs.py92
-rw-r--r--test/Install/dir-exists.py65
-rw-r--r--test/Install/directories.py99
-rw-r--r--test/Install/multi.py54
-rw-r--r--test/Install/no-top-relative.py59
-rw-r--r--test/Install/non-ascii-name.py54
-rw-r--r--test/Install/option--install-sandbox.py82
-rw-r--r--test/Install/tool.py57
-rw-r--r--test/Install/wrap-by-attribute.py114
12 files changed, 963 insertions, 0 deletions
diff --git a/test/Install/Clone.py b/test/Install/Clone.py
new file mode 100644
index 0000000..da66157
--- /dev/null
+++ b/test/Install/Clone.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that we can Install() and InstallAs() from a construction
+environment cloned from a clone.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env1 = Environment(DESTDIR='sub1', tools=[])
+
+# Call env1.Install() but not env1.InstallAs() *before* we clone it.
+# This is to verify that re-initializing the Install() attribute on the
+# construction environment doesn't mess up the environment settings in
+# a way that leaves the InstallAs() intializer in place, which leads to
+# infinite recursion.
+env1.Install('$DESTDIR', 'foo.in')
+
+env2 = env1.Clone(DESTDIR='sub2')
+env3 = env2.Clone(DESTDIR='sub3')
+
+env2.Install('$DESTDIR', 'foo.in')
+env3.Install('$DESTDIR', 'foo.in')
+
+env1.InstallAs('$DESTDIR/foo.out', 'foo.in')
+env2.InstallAs('$DESTDIR/foo.out', 'foo.in')
+env3.InstallAs('$DESTDIR/foo.out', 'foo.in')
+""")
+
+test.write('foo.in', "foo.in\n")
+
+test.run(arguments = '.')
+
+test.must_match(['sub1', 'foo.in'], "foo.in\n")
+test.must_match(['sub2', 'foo.in'], "foo.in\n")
+test.must_match(['sub3', 'foo.in'], "foo.in\n")
+
+test.must_match(['sub1', 'foo.out'], "foo.in\n")
+test.must_match(['sub2', 'foo.out'], "foo.in\n")
+test.must_match(['sub3', 'foo.out'], "foo.in\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/INSTALLSTR.py b/test/Install/INSTALLSTR.py
new file mode 100644
index 0000000..0cc5fce
--- /dev/null
+++ b/test/Install/INSTALLSTR.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that the $INSTALLSTR variable is displayed when we install a file.
+"""
+
+import os.path
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('install')
+
+test.write('SConstruct', """\
+env = Environment(INSTALLSTR = 'INSTALL $SOURCE => $TARGET!')
+env.Install('install', 'file')
+""")
+
+test.write('file', "file\n")
+
+test.run(stdout=test.wrap_stdout("""\
+INSTALL file => %s!
+""") % os.path.join('install', 'file'))
+
+test.must_match(['install', 'file'], "file\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/Install.py b/test/Install/Install.py
new file mode 100644
index 0000000..adadfd9
--- /dev/null
+++ b/test/Install/Install.py
@@ -0,0 +1,154 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the Install() Builder works
+"""
+
+import os.path
+import time
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('outside', 'work', ['work', 'sub'])
+
+f1_out = test.workpath('work', 'export', 'f1.out')
+f2_out = test.workpath('work', 'export', 'f2.out')
+f3_out = test.workpath('work', 'export', 'f3.out')
+f4_out = test.workpath('work', 'export', 'f4.out')
+f5_txt = test.workpath('outside', 'f5.txt')
+f6_txt = test.workpath('outside', 'f6.txt')
+f6_sep = f6_txt.replace(os.sep, '/')
+
+_SUBDIR_f4_out = os.path.join('$SUBDIR', 'f4.out')
+
+test.write(['work', 'SConstruct'], """\
+def cat(env, source, target):
+ target = str(target[0])
+ f = open(target, "wb")
+ for src in source:
+ f.write(open(str(src), "rb").read())
+ f.close()
+
+def my_install(dest, source, env):
+ import shutil
+ shutil.copy2(source, dest)
+ open('my_install.out', 'ab').write(dest)
+
+env1 = Environment()
+env1.Append(BUILDERS={'Cat':Builder(action=cat)})
+env3 = env1.Clone(INSTALL = my_install)
+
+t = env1.Cat(target='f1.out', source='f1.in')
+env1.Install(dir='export', source=t)
+t = env1.Cat(target='f2.out', source='f2.in')
+Install(dir='export', source=t)
+
+t = env3.Cat(target='f3.out', source='f3.in')
+env3.Install(dir='export', source=t)
+
+env4 = env1.Clone(EXPORT='export', SUBDIR='sub')
+t = env4.Cat(target='sub/f4.out', source='sub/f4.in')
+env4.Install(dir='$EXPORT', source=r'%(_SUBDIR_f4_out)s')
+
+env1.Install('.', r'%(f5_txt)s')
+env1.Install('export', r'%(f5_txt)s')
+env1.Install('.', r'%(f6_sep)s')
+env1.Install('export', r'%(f6_sep)s')
+
+# test passing a keyword arg (not used, but should be accepted)
+env7 = env1.Clone(EXPORT='export')
+env7.Install(dir='$EXPORT', source='./f1.in', FOO="bar")
+
+""" % locals())
+
+test.write(['work', 'f1.in'], "f1.in\n")
+test.write(['work', 'f2.in'], "f2.in\n")
+test.write(['work', 'f3.in'], "f3.in\n")
+test.write(['work', 'sub', 'f4.in'], "sub/f4.in\n")
+test.write(f5_txt, "f5.txt\n")
+test.write(f6_txt, "f6.txt\n")
+
+test.run(chdir = 'work', arguments = '.')
+
+test.must_match(f1_out, "f1.in\n")
+test.must_match(f2_out, "f2.in\n")
+test.must_match(f3_out, "f3.in\n")
+test.must_match(f4_out, "sub/f4.in\n")
+test.must_match(['work', 'f5.txt'], "f5.txt\n")
+test.must_match(['work', 'export', 'f5.txt'], "f5.txt\n")
+test.must_match(['work', 'f6.txt'], "f6.txt\n")
+test.must_match(['work', 'export', 'f6.txt'], "f6.txt\n")
+
+test.must_match(['work', 'my_install.out'], os.path.join('export', 'f3.out'))
+test.must_match(['work', 'export', 'f1.in'], "f1.in\n")
+
+# make sure the programs didn't get rebuilt, because nothing changed:
+oldtime1 = os.path.getmtime(f1_out)
+oldtime2 = os.path.getmtime(f2_out)
+
+test.write(['work', 'f1.in'], "f1.in again\n")
+
+time.sleep(2) # introduce a small delay, to make the test valid
+
+test.run(chdir = 'work', arguments = '.')
+
+test.fail_test(oldtime1 == os.path.getmtime(f1_out))
+test.fail_test(oldtime2 != os.path.getmtime(f2_out))
+
+# Verify that we didn't link to the Installed file.
+open(f2_out, 'wb').write("xyzzy\n")
+test.must_match(['work', 'f2.out'], "f2.in\n")
+
+# Verify that scons prints an error message
+# if a target can not be unlinked before building it:
+test.write(['work', 'f1.in'], "f1.in again again\n")
+
+os.chmod(test.workpath('work', 'export'), 0555)
+f = open(f1_out, 'rb')
+
+
+expect = [
+ "Permission denied",
+ "The process cannot access the file because it is being used by another process",
+ "Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird",
+]
+
+test.run(chdir = 'work', arguments = f1_out, stderr=None, status=2)
+
+test.must_contain_any_line(test.stderr(), expect)
+
+f.close()
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/InstallAs.py b/test/Install/InstallAs.py
new file mode 100644
index 0000000..fe860b0
--- /dev/null
+++ b/test/Install/InstallAs.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the InstallAs() Environment method.
+"""
+
+import os.path
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('install', 'subdir')
+
+install = test.workpath('install')
+install_f1_out = os.path.join('install', 'f1.out')
+install_file1_out = test.workpath('install', 'file1.out')
+install_file2_out = test.workpath('install', 'file2.out')
+install_file3_out = test.workpath('install', 'file3.out')
+
+_INSTALLDIR_file2_out = os.path.join('$INSTALLDIR', 'file2.out')
+_SUBDIR_file3_in = os.path.join('$SUBDIR', 'file3.in')
+
+#
+test.write('SConstruct', r"""
+env = Environment(INSTALLDIR=r'%(install)s', SUBDIR='subdir')
+InstallAs(r'%(install_file1_out)s', 'file1.in')
+env.InstallAs([r'%(_INSTALLDIR_file2_out)s', r'%(install_file3_out)s'],
+ ['file2.in', r'%(_SUBDIR_file3_in)s'])
+# test passing a keyword arg (not used, but should be accepted)
+env.InstallAs('install/f1.out', './file1.in', FOO="bar")
+""" % locals())
+
+test.write('file1.in', "file1.in\n")
+test.write('file2.in', "file2.in\n")
+test.write(['subdir', 'file3.in'], "subdir/file3.in\n")
+
+install_file1_out = os.path.join('install', 'file1.out')
+install_file2_out = os.path.join('install', 'file2.out')
+install_file3_out = os.path.join('install', 'file3.out')
+install_file1a_out = os.path.join('install', 'f1.out')
+
+subdir_file3_in = os.path.join('subdir', 'file3.in')
+
+expect = test.wrap_stdout("""\
+Install file: "file1.in" as "%(install_f1_out)s"
+Install file: "file1.in" as "%(install_file1_out)s"
+Install file: "file2.in" as "%(install_file2_out)s"
+Install file: "%(subdir_file3_in)s" as "%(install_file3_out)s"
+""" % locals())
+
+test.run(arguments = '.', stdout=expect)
+
+test.fail_test(test.read(install_file1_out) != "file1.in\n")
+test.fail_test(test.read(install_file2_out) != "file2.in\n")
+test.fail_test(test.read(install_file3_out) != "subdir/file3.in\n")
+test.fail_test(test.read(install_file1a_out) != "file1.in\n")
+
+test.up_to_date(arguments = '.')
+
+#
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/dir-exists.py b/test/Install/dir-exists.py
new file mode 100644
index 0000000..f981a35
--- /dev/null
+++ b/test/Install/dir-exists.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test using Install() on directories that exist.
+"""
+
+import os.path
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+Execute(Mkdir('a'))
+Execute(Mkdir('b'))
+f=Command('a/f', None, 'echo hi > $TARGET')
+AlwaysBuild(f)
+Install('b', 'a')
+""")
+
+expect="""\
+Mkdir("a")
+Mkdir("b")
+echo hi > a%sf
+Install directory: "a" as "b%sa"
+"""%(os.sep, os.sep)
+test.run(arguments = ["-Q"], stdout = expect)
+
+test.must_exist(test.workpath('a', 'f'))
+test.must_exist(test.workpath('b', 'a', 'f'))
+
+# this run used to fail on Windows with an OS error before the copytree fix
+test.run(arguments=["-Q"])
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/directories.py b/test/Install/directories.py
new file mode 100644
index 0000000..74a7ac5
--- /dev/null
+++ b/test/Install/directories.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test using Install() on directories.
+"""
+
+import os.path
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('outside',
+ 'work',
+ ['work', 'dir1'],
+ ['work', 'dir1', 'sub'],
+ ['work', 'dir2'],
+ ['work', 'dir2', 'sub'],
+ ['work', 'dir3'],
+ ['work', 'dir3', 'sub'],
+ ['work', 'dir4'],
+ ['work', 'dir4', 'sub'])
+
+test.write(['work', 'SConstruct'], """\
+Install('../outside', 'dir1')
+InstallAs('../outside/d2', 'dir2')
+
+env = Environment()
+env.Install('../outside', 'dir3')
+env.InstallAs('../outside/d4', 'dir4')
+""")
+
+test.write(['work', 'f1'], "work/f1\n")
+test.write(['work', 'dir1', 'f2'], "work/dir1/f2\n")
+test.write(['work', 'dir1', 'sub', 'f3'], "work/dir1/sub/f3\n")
+test.write(['work', 'dir2', 'f4'], "work/dir2/f4\n")
+test.write(['work', 'dir2', 'sub', 'f5'], "work/dir2/sub/f5\n")
+test.write(['work', 'dir3', 'f6'], "work/dir3/f6\n")
+test.write(['work', 'dir3', 'sub', 'f7'], "work/dir3/sub/f7\n")
+test.write(['work', 'dir4', 'f8'], "work/dir4/f8\n")
+test.write(['work', 'dir4', 'sub', 'f9'], "work/dir4/sub/f9\n")
+
+
+arguments = [
+ test.workpath('outside', 'dir1'),
+ test.workpath('outside', 'd2'),
+ test.workpath('outside', 'dir3'),
+ test.workpath('outside', 'd4'),
+]
+
+expect = test.wrap_stdout("""\
+Install directory: "dir1" as "%s"
+Install directory: "dir2" as "%s"
+Install directory: "dir3" as "%s"
+Install directory: "dir4" as "%s"
+""" % tuple(arguments))
+
+test.run(chdir = 'work', arguments = arguments, stdout = expect)
+
+test.must_match(test.workpath('outside', 'dir1', 'f2'), "work/dir1/f2\n")
+test.must_match(test.workpath('outside', 'dir1', 'sub', 'f3'), "work/dir1/sub/f3\n")
+test.must_match(test.workpath('outside', 'd2', 'f4'), "work/dir2/f4\n")
+test.must_match(test.workpath('outside', 'd2', 'sub', 'f5'), "work/dir2/sub/f5\n")
+test.must_match(test.workpath('outside', 'dir3', 'f6'), "work/dir3/f6\n")
+test.must_match(test.workpath('outside', 'dir3', 'sub', 'f7'), "work/dir3/sub/f7\n")
+test.must_match(test.workpath('outside', 'd4', 'f8'), "work/dir4/f8\n")
+test.must_match(test.workpath('outside', 'd4', 'sub', 'f9'), "work/dir4/sub/f9\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/multi.py b/test/Install/multi.py
new file mode 100644
index 0000000..a7a6eb8
--- /dev/null
+++ b/test/Install/multi.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that multiple calls to test.Install() with the same file
+are all right.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment()
+env.Install('install', 'file1')
+env.Install('install', 'file1')
+""")
+
+test.write('file1', "file1\n")
+
+test.run(arguments = '.')
+
+test.must_match(['install', 'file1'], "file1\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/no-top-relative.py b/test/Install/no-top-relative.py
new file mode 100644
index 0000000..3eb24f7
--- /dev/null
+++ b/test/Install/no-top-relative.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that we can install a file if its file name portion begins
+with a '#'. (A previous bug re-interpreted that as relative to
+the top-level SConstruct directory.)
+
+Thanks to Dave Weber for the test case.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir(['test'])
+
+test.write(['SConstruct'], """\
+env = Environment()
+i = env.Install("#/install", "#/test/#testfile.txt#");
+env.Default(i);
+""")
+
+test.write(['test', '#testfile.txt#'], "test/#testfile.txt#\n")
+
+test.run()
+
+test.must_match(['install', '#testfile.txt#'], "test/#testfile.txt#\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/non-ascii-name.py b/test/Install/non-ascii-name.py
new file mode 100644
index 0000000..0e2ee24
--- /dev/null
+++ b/test/Install/non-ascii-name.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that the Install() Builder works
+"""
+
+import os.path
+import time
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('中文.txt', """\
+test stuff here in file 中文.txt.
+""")
+
+test.write('SConstruct', """\
+InstallAs("b", Glob("*.txt"))
+""")
+test.run(arguments = '.')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/option--install-sandbox.py b/test/Install/option--install-sandbox.py
new file mode 100644
index 0000000..020cd3a
--- /dev/null
+++ b/test/Install/option--install-sandbox.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the --install-sandbox commandline option for Install() and InstallAs().
+"""
+
+import os.path
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('install', 'subdir')
+target = 'destination'
+destdir = test.workpath( target )
+_SUBDIR_file3_out = os.path.join('$SUBDIR', 'file3.out')
+_SUBDIR_file3_in = os.path.join('$SUBDIR', 'file3.in')
+
+target_file2_out = os.path.join(target, 'file2.out')
+subdir_file3_in = os.path.join('subdir', 'file3.in')
+target_subdir_file3_out = os.path.join(target, 'subdir', 'file3.out')
+file1_out = target+os.path.join( target,
+ os.path.splitdrive(destdir)[1],
+ 'file1.out' )
+
+#
+test.write('SConstruct', r"""
+env = Environment(SUBDIR='subdir')
+f1 = env.Install(r'%(destdir)s', 'file1.out')
+f2 = env.InstallAs(['file2.out', r'%(_SUBDIR_file3_out)s'],
+ ['file2.in', r'%(_SUBDIR_file3_in)s'])
+env.Depends(f2, f1)
+""" % locals())
+
+test.write('file1.out', "file1.out\n")
+test.write('file2.in', "file2.in\n")
+test.write(['subdir', 'file3.in'], "subdir/file3.in\n")
+
+expect = test.wrap_stdout("""\
+Install file: "file1.out" as "%(file1_out)s"
+Install file: "file2.in" as "%(target_file2_out)s"
+Install file: "%(subdir_file3_in)s" as "%(target_subdir_file3_out)s"
+""" % locals())
+
+test.run(arguments = '--install-sandbox=%s' % destdir, stdout=expect)
+
+test.must_match(file1_out, "file1.out\n")
+test.must_match('destination/file2.out', "file2.in\n")
+test.must_match('destination/subdir/file3.out', "subdir/file3.in\n")
+
+#
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/tool.py b/test/Install/tool.py
new file mode 100644
index 0000000..1e49584
--- /dev/null
+++ b/test/Install/tool.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that we can still call Install() and InstallAs() even when
+no Tool modules have been loaded.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('iii')
+
+test.write('SConstruct', """
+env = Environment(tools = [])
+env.Install('iii', 'foo.in')
+env.InstallAs('foo.out', 'foo.in')
+""")
+
+test.write('foo.in', "foo.in\n")
+
+test.run(arguments = '.')
+
+test.must_match(['iii', 'foo.in'], "foo.in\n")
+test.must_match('foo.out', "foo.in\n")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Install/wrap-by-attribute.py b/test/Install/wrap-by-attribute.py
new file mode 100644
index 0000000..02513af
--- /dev/null
+++ b/test/Install/wrap-by-attribute.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+
+Verify that we handle the case where Install() and InstallAs()
+Builder instances are saved and then re-used from a different, Clone()d
+construction environment, after the .Install() and .InstallAs() methods
+are replaced by wrappers that fetch the saved methods from a different
+environment.
+"""
+
+import os.path
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('outside', 'sub')
+
+test.write('SConstruct', """\
+import os.path
+
+def cat(env, source, target):
+ target = str(target[0])
+ f = open(target, "wb")
+ for src in source:
+ f.write(open(str(src), "rb").read())
+ f.close()
+
+env = Environment(DESTDIR='dest')
+env.Append(BUILDERS={'Cat':Builder(action=cat)})
+
+env.SconsInternalInstallFunc = env.Install
+env.SconsInternalInstallAsFunc = env.InstallAs
+
+def InstallWithDestDir(dir, source):
+ abspath = os.path.splitdrive(env.Dir(dir).get_abspath())[1]
+ return env.SconsInternalInstallFunc('$DESTDIR'+abspath, source)
+def InstallAsWithDestDir(target, source):
+ abspath = os.path.splitdrive(env.File(target).get_abspath())[1]
+ return env.SconsInternalInstallAsFunc('$DESTDIR'+abspath, source)
+
+# Add the wrappers directly as attributes.
+env.Install = InstallWithDestDir
+env.InstallAs = InstallAsWithDestDir
+
+e1 = env
+
+t = e1.Cat(target='f1.out', source='f1.in')
+e1.Install('export', source=t)
+t = e1.Cat(target='f2.out', source='f2.in')
+e1.InstallAs('export/f2-new.out', source=t)
+
+e2 = env.Clone()
+
+t = e2.Cat(target='f3.out', source='f3.in')
+e2.Install('export', source=t)
+t = e2.Cat(target='f4.out', source='f4.in')
+e2.InstallAs('export/f4-new.out', source=t)
+
+""")
+
+test.write('f1.in', "f1.in\n")
+test.write('f2.in', "f2.in\n")
+test.write('f3.in', "f3.in\n")
+test.write('f4.in', "f4.in\n")
+
+test.run(arguments = '.')
+
+export = os.path.splitdrive(test.workpath('export'))[1]
+
+f1_out = test.workpath('dest') + os.path.join(export, 'f1.out')
+f2_new_out = test.workpath('dest') + os.path.join(export, 'f2-new.out')
+f3_out = test.workpath('dest') + os.path.join(export, 'f3.out')
+f4_new_out = test.workpath('dest') + os.path.join(export, 'f4-new.out')
+
+test.must_match(f1_out, "f1.in\n")
+test.must_match(f2_new_out, "f2.in\n")
+test.must_match(f3_out, "f3.in\n")
+test.must_match(f4_new_out, "f4.in\n")
+
+test.up_to_date(arguments = '.')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: