summaryrefslogtreecommitdiffstats
path: root/test/site_scons
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/site_scons
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/site_scons')
-rw-r--r--test/site_scons/basic.py75
-rw-r--r--test/site_scons/no-site-dir.py93
-rw-r--r--test/site_scons/nonexistent.py53
-rw-r--r--test/site_scons/override.py68
-rw-r--r--test/site_scons/site-dir.py79
-rw-r--r--test/site_scons/site_init.py141
-rw-r--r--test/site_scons/sys-path.py69
-rw-r--r--test/site_scons/sysdirs.py71
8 files changed, 649 insertions, 0 deletions
diff --git a/test/site_scons/basic.py b/test/site_scons/basic.py
new file mode 100644
index 0000000..1868723
--- /dev/null
+++ b/test/site_scons/basic.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__"
+
+import TestSCons
+
+"""
+Verify basic functionality of the site_scons dir and
+site_scons/site_init.py file:
+Make sure the site_scons/site_init.py file gets loaded,
+and make sure a tool can be loaded from the site_scons/site_tools subdir,
+even when executing out of a subdirectory.
+"""
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons', ['site_scons', 'site_tools'])
+
+test.write(['site_scons', 'site_init.py'], """
+from SCons.Script import *
+print "Hi there, I am in site_scons/site_init.py!"
+""")
+
+test.write(['site_scons', 'site_tools', 'mytool.py'], """
+import SCons.Tool
+def generate(env):
+ env['MYTOOL']='mytool'
+def exists(env):
+ return 1
+""")
+
+
+test.write('SConstruct', """
+e=Environment(tools=['default', 'mytool'])
+print e.subst('My site tool is $MYTOOL')
+""")
+
+test.run(arguments = '-Q .',
+ stdout = """Hi there, I am in site_scons/site_init.py!
+My site tool is mytool
+scons: `.' is up to date.\n""")
+
+
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/no-site-dir.py b/test/site_scons/no-site-dir.py
new file mode 100644
index 0000000..d01d419
--- /dev/null
+++ b/test/site_scons/no-site-dir.py
@@ -0,0 +1,93 @@
+#!/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 use of the --no-site-dir option:
+the site_scons/site_init.py script should NOT be loaded.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons', ['site_scons', 'site_tools'])
+
+test.write(['site_scons', 'site_init.py'], """
+from SCons.Script import *
+print "Hi there, I am in site_scons/site_init.py!"
+""")
+
+test.write(['site_scons', 'site_tools', 'mytool.py'], """
+import SCons.Tool
+def generate(env):
+ env['MYTOOL']='mytool'
+def exists(env):
+ return 1
+""")
+
+test.write(['site_scons', 'site_tools', 'm4.py'], """
+import SCons.Tool
+def generate(env):
+ env['M4']='my_m4'
+ env['M4_MINE']=1
+def exists(env):
+ return 1
+""")
+
+test.write('SConstruct', """
+e=Environment()
+""")
+
+test.run(arguments = '-Q --no-site-dir .',
+ stdout = "scons: `.' is up to date.\n")
+
+# With --no-site-dir, shouldn't override default m4 tool
+
+test.write('SConstruct', """
+e=Environment()
+print e.subst('no site: M4 is $M4, M4_MINE is $M4_MINE')
+""")
+
+test.run(arguments = '-Q --no-site-dir .')
+
+not_expected = """Hi there, I am in site_scons/site_init.py!
+no site: M4 is my_m4, M4_MINE is 1
+scons: `.' is up to date.
+"""
+
+test.fail_test(test.stdout() == not_expected)
+
+
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/nonexistent.py b/test/site_scons/nonexistent.py
new file mode 100644
index 0000000..6617ff2
--- /dev/null
+++ b/test/site_scons/nonexistent.py
@@ -0,0 +1,53 @@
+#!/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 specifying --site-dir= with a nonexistent directory
+gives an error and nonzero status.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "\n")
+
+test.run(arguments = '-Q --site-dir=whatever .',
+ stderr = r".*site dir .*whatever not found.*",
+ status = 2,
+ match = TestSCons.match_re_dotall)
+
+
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/override.py b/test/site_scons/override.py
new file mode 100644
index 0000000..e33bb88
--- /dev/null
+++ b/test/site_scons/override.py
@@ -0,0 +1,68 @@
+#!/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 a that a tool module in site_tools overrides base tool.
+
+Use 'm4' as test tool since it's likely to be found,
+and not commonly overridden by platform-specific stuff the way cc is.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons', ['site_scons', 'site_tools'])
+
+test.write(['site_scons', 'site_tools', 'm4.py'], """
+import SCons.Tool
+def generate(env):
+ env['M4']='my_m4'
+ env['M4_MINE']=1
+def exists(env):
+ return 1
+""")
+
+test.write('SConstruct', """
+e=Environment(tools=['m4'])
+print e.subst('M4 is $M4, M4_MINE is $M4_MINE')
+""")
+test.run(arguments = '-Q .',
+ stdout = """M4 is my_m4, M4_MINE is 1
+scons: `.' is up to date.\n""")
+
+
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/site-dir.py b/test/site_scons/site-dir.py
new file mode 100644
index 0000000..8e82e94
--- /dev/null
+++ b/test/site_scons/site-dir.py
@@ -0,0 +1,79 @@
+#!/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 --site-dir=otherdir loads the site_init.py script
+from the other dir;
+the usual site_scons/site_init.py should NOT be loaded.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons', ['site_scons', 'site_tools'])
+
+test.write(['site_scons', 'site_init.py'], """
+from SCons.Script import *
+print "Hi there, I am in site_scons/site_init.py!"
+""")
+
+test.write(['site_scons', 'site_tools', 'mytool.py'], """
+import SCons.Tool
+def generate(env):
+ env['MYTOOL']='mytool'
+def exists(env):
+ return 1
+""")
+
+
+
+test.subdir('alt_site', ['alt_site', 'site_tools'])
+
+test.write(['alt_site', 'site_init.py'], """
+from SCons.Script import *
+print "Hi there, I am in alt_site/site_init.py!"
+""")
+
+test.write('SConstruct', """
+e=Environment()
+""")
+
+test.run(arguments = '-Q --site-dir=alt_site .',
+ stdout = """Hi there, I am in alt_site/site_init.py!
+scons: `.' is up to date.\n""")
+
+
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/site_init.py b/test/site_scons/site_init.py
new file mode 100644
index 0000000..9f2e411
--- /dev/null
+++ b/test/site_scons/site_init.py
@@ -0,0 +1,141 @@
+#!/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 various aspects of the handling of site_init.py.
+
+And more ..
+"""
+
+import TestSCons
+import sys
+import os.path
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons')
+
+
+def _test_metadata():
+ """Test site_init's module metadata.
+
+ The following special variables should be predefined: __doc__,
+ __file__ and __name__. No special variables should be transferred from
+ SCons.Script.
+ """
+ test.write(['site_scons', 'site_init.py'], """\
+import os.path
+import re
+
+special = []
+for x in globals().keys():
+ if re.match("__[^_]+__", x):
+ if x in ("__builtins__", "__package__",):
+ # Ignore certain keywords, as they are known to be added by Python
+ continue
+ special.append(x)
+
+print sorted(special)
+print __doc__
+print os.path.realpath(__file__)
+print __name__
+""")
+
+ test.write('SConstruct', "\n")
+ test.run(arguments = '-Q .',
+ stdout = """\
+['__doc__', '__file__', '__name__']
+None
+%s
+site_init
+scons: `.' is up to date.
+""" % (os.path.realpath(os.path.join('site_scons', 'site_init.py')),))
+
+_test_metadata()
+
+
+"""
+Verify site_scons/site_init.py file can define a tool, and it shows up
+automatically in the SCons.Script namespace.
+"""
+
+if sys.platform == 'win32':
+ cat_cmd='type'
+else:
+ cat_cmd='cat'
+
+test.write(['site_scons', 'site_init.py'], """
+def TOOL_FOO(env):
+ env['FOO'] = '%s'
+ bld = Builder(action = '$FOO ${SOURCE} > ${TARGET}',
+ suffix = '.tgt')
+ env.Append(BUILDERS = {'Foo' : bld})
+
+"""%cat_cmd)
+
+test.write('SConstruct', """
+e=Environment(tools=['default', TOOL_FOO])
+e.Foo(target='foo.out', source='SConstruct')
+""")
+
+test.run(arguments = '-Q .',
+ stdout = """%s SConstruct > foo.out\n"""%cat_cmd)
+
+
+"""
+Test errors in site_scons/site_init.py.
+"""
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons')
+
+test.write(['site_scons', 'site_init.py'], """
+raise Exception("Huh?")
+""")
+
+test.write('SConstruct', """
+e=Environment(tools=['default', TOOL_FOO])
+e.Foo(target='foo.out', source='SConstruct')
+""")
+
+test.run(arguments = '-Q .',
+ stdout = "",
+ stderr = """.*Error loading site_init file.*Huh\?.*""",
+ status=2,
+ match=TestSCons.match_re_dotall)
+
+
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/sys-path.py b/test/site_scons/sys-path.py
new file mode 100644
index 0000000..46f84c7
--- /dev/null
+++ b/test/site_scons/sys-path.py
@@ -0,0 +1,69 @@
+#!/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 site_scons dir is added to sys.path as an
+absolute path, so it will work from a subdir.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('site_scons')
+test.subdir('sub1')
+
+test.write(['site_scons', 'testmod1.py'], """
+print "Imported site_scons/testmod1.py."
+""")
+test.write(['site_scons', 'testmod2.py'], """
+print "Imported site_scons/testmod2.py."
+""")
+
+test.write(['sub1', 'SConscript'], """
+import testmod2 # This call did not work before the fix
+
+""")
+
+test.write('SConstruct', """
+import testmod1 # this always worked
+SConscript('sub1/SConscript')
+""")
+
+test.run(arguments = '-Q .',
+ stdout = """Imported site_scons/testmod1.py.
+Imported site_scons/testmod2.py.
+scons: `.' is up to date.\n""")
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/site_scons/sysdirs.py b/test/site_scons/sysdirs.py
new file mode 100644
index 0000000..f50485a
--- /dev/null
+++ b/test/site_scons/sysdirs.py
@@ -0,0 +1,71 @@
+#!/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__"
+
+import TestSCons
+
+"""
+Verify site_scons system dirs are getting loaded.
+Uses an internal test fixture to get at the site_scons dirs.
+
+TODO: it would be great to test if it can actually load site_scons
+files from the system dirs, but the test harness can't put files in
+those dirs (which may not even exist on a build system).
+"""
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+import SCons.Script
+SCons.Script.Main.test_load_all_site_scons_dirs(Dir('.').get_internal_path())
+""")
+
+test.run(arguments = '-Q .')
+
+import SCons.Platform
+platform = SCons.Platform.platform_default()
+if platform in ('win32', 'cygwin'):
+ dir_to_check_for='Application Data'
+elif platform in ('darwin'):
+ dir_to_check_for='Library'
+else:
+ dir_to_check_for='.scons'
+
+if 'Loading site dir' not in test.stdout():
+ print test.stdout()
+ test.fail_test()
+if dir_to_check_for not in test.stdout():
+ print test.stdout()
+ test.fail_test()
+
+test.pass_test()
+
+# end of file
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: