summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-04-15 18:43:38 (GMT)
committerSteven Knight <knight@baldmt.com>2002-04-15 18:43:38 (GMT)
commita8176f609ff3ecc090f51830408d3b4dc6338d7e (patch)
treebab059042f2f8cbc85dcf7a619dbebbbe23dc4fb /test
parent05029e336146444501a66b53e4699c09d6e08977 (diff)
downloadSCons-a8176f609ff3ecc090f51830408d3b4dc6338d7e.zip
SCons-a8176f609ff3ecc090f51830408d3b4dc6338d7e.tar.gz
SCons-a8176f609ff3ecc090f51830408d3b4dc6338d7e.tar.bz2
Big change for shared libraries and a bunch of other flexibility. (Charles Crain)
Diffstat (limited to 'test')
-rw-r--r--test/Command.py4
-rw-r--r--test/LIBPATH.py6
-rw-r--r--test/LIBPREFIXES.py71
-rw-r--r--test/LIBSUFFIXES.py71
-rw-r--r--test/SHCC.py86
-rw-r--r--test/SHCCFLAGS.py84
-rw-r--r--test/SHCXX.py90
-rw-r--r--test/SHCXXFLAGS.py87
-rw-r--r--test/SHF77.py205
-rw-r--r--test/SHF77FLAGS.py208
-rw-r--r--test/SHLIBPREFIX.py55
-rw-r--r--test/SHLIBSUFFIX.py55
-rw-r--r--test/SHLINK.py88
-rw-r--r--test/SHLINKFLAGS.py88
-rw-r--r--test/SharedLibrary.py165
-rw-r--r--test/multiline.py4
16 files changed, 1359 insertions, 8 deletions
diff --git a/test/Command.py b/test/Command.py
index 1f4a490..557b34e 100644
--- a/test/Command.py
+++ b/test/Command.py
@@ -53,8 +53,8 @@ env.Command(target = 'f1.out', source = 'f1.in',
env.Command(target = 'f2.out', source = 'f2.in',
action = r'%s' + " build.py temp2 $SOURCES\\n" + r'%s' + " build.py $TARGET temp2")
env.Command(target = 'f3.out', source = 'f3.in',
- action = [r'%s build.py temp3 $SOURCES',
- r'%s build.py $TARGET temp3'])
+ action = [ [ r'%s', 'build.py', 'temp3', '$SOURCES' ],
+ [ r'%s', 'build.py', '$TARGET', 'temp3'] ])
""" % (python, python, python, python))
test.write('f1.in', "f1.in\n")
diff --git a/test/LIBPATH.py b/test/LIBPATH.py
index 30bc421..afb87c6 100644
--- a/test/LIBPATH.py
+++ b/test/LIBPATH.py
@@ -101,9 +101,7 @@ test.run(program = prog1,
stdout = "f1.c 1\nprog.c\n")
test.run(program = prog2,
stdout = "f1.c 1\nprog.c\n")
-
-test.up_to_date(arguments = '.')
-
+#test.up_to_date(arguments = '.')
# Change LIBPATH and make sure we don't rebuild because of it.
test.write('SConstruct', """
env1 = Environment(LIBS = [ 'foo1' ],
@@ -117,7 +115,7 @@ env2.Program(target = 'prog2', source = 'prog.c')
env2.Library(target = 'foo2', source = 'f1.c')
""")
-test.up_to_date(arguments = '.', stderr = None)
+test.up_to_date(arguments = '.', stderr=None)
test.write('f1.c', r"""
void
diff --git a/test/LIBPREFIXES.py b/test/LIBPREFIXES.py
new file mode 100644
index 0000000..5d4f0cc
--- /dev/null
+++ b/test/LIBPREFIXES.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import sys
+import TestSCons
+
+if sys.platform == 'win32':
+ _lib = '.lib'
+else:
+ _lib = '.a'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(LIBPREFIX = 'xxx-',
+ LIBPREFIXES = ['xxx-'])
+lib = env.Library(target = 'foo', source = 'foo.c')
+env.Program(target = 'prog', source = ['prog.c', lib])
+""")
+
+test.write('foo.c', r"""
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.write('prog.c', r"""
+void foo(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.')
+
+test.fail_test(not os.path.exists(test.workpath('xxx-foo' + _lib)))
+
+test.run(program = test.workpath('prog'), stdout = "foo.c\nprog.c\n")
+
+test.pass_test()
diff --git a/test/LIBSUFFIXES.py b/test/LIBSUFFIXES.py
new file mode 100644
index 0000000..69c0d67
--- /dev/null
+++ b/test/LIBSUFFIXES.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import sys
+import TestSCons
+
+if sys.platform == 'win32':
+ lib_ = ''
+else:
+ lib_ = 'lib'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(LIBSUFFIX = '.xxx',
+ LIBSUFFIXES = ['.xxx'])
+lib = env.Library(target = 'foo', source = 'foo.c')
+env.Program(target = 'prog', source = ['prog.c', lib])
+""")
+
+test.write('foo.c', r"""
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.write('prog.c', r"""
+void foo(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.')
+
+test.fail_test(not os.path.exists(test.workpath(lib_ + 'foo.xxx')))
+
+test.run(program = test.workpath('prog'), stdout = "foo.c\nprog.c\n")
+
+test.pass_test()
diff --git a/test/SHCC.py b/test/SHCC.py
new file mode 100644
index 0000000..1313272
--- /dev/null
+++ b/test/SHCC.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import string
+import sys
+import TestSCons
+
+python = sys.executable
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+else:
+ _exe = ''
+
+test = TestSCons.TestSCons()
+
+test.write("wrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'wb').write("wrapper.py\\n")
+os.system(string.join(sys.argv[1:], " "))
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+test.write('SConstruct', """
+foo = Environment()
+shcc = foo.Dictionary('SHCC')
+bar = Environment(SHCC = r'%s wrapper.py ' + shcc)
+foo.Program(target = 'foo', source = 'foo.c', shared = 1)
+bar.Program(target = 'bar', source = 'bar.c', shared = 1)
+""" % python)
+
+test.write('foo.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+test.write('bar.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+
+test.run(arguments = 'foo' + _exe)
+
+test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+
+test.run(arguments = 'bar' + _exe)
+
+test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+
+test.pass_test()
diff --git a/test/SHCCFLAGS.py b/test/SHCCFLAGS.py
new file mode 100644
index 0000000..fc881a3
--- /dev/null
+++ b/test/SHCCFLAGS.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 sys
+import TestSCons
+
+if sys.platform == 'win32':
+ _obj = '.obj'
+ fooflags = '/nologo -DFOO'
+ barflags = '/nologo -DBAR'
+else:
+ _obj = '.o'
+ fooflags = '-DFOO'
+ barflags = '-DBAR'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+foo = Environment(SHCCFLAGS = '%s')
+bar = Environment(SHCCFLAGS = '%s')
+foo.Object(target = 'foo%s', source = 'prog.c', shared = 1)
+bar.Object(target = 'bar%s', source = 'prog.c', shared = 1)
+foo.Program(target = 'foo', source = 'foo%s', shared = 1)
+bar.Program(target = 'bar', source = 'bar%s', shared = 1)
+""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
+
+test.write('prog.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+#ifdef FOO
+ printf("prog.c: FOO\n");
+#endif
+#ifdef BAR
+ printf("prog.c: BAR\n");
+#endif
+ exit (0);
+}
+""")
+
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n")
+test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
+
+test.write('SConstruct', """
+bar = Environment(SHCCFLAGS = '%s')
+bar.Object(target = 'foo%s', source = 'prog.c', shared = 1)
+bar.Object(target = 'bar%s', source = 'prog.c', shared = 1)
+bar.Program(target = 'foo', source = 'foo%s', shared = 1)
+bar.Program(target = 'bar', source = 'bar%s', shared = 1)
+""" % (barflags, _obj, _obj, _obj, _obj))
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('foo'), stdout = "prog.c: BAR\n")
+test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
+
+test.pass_test()
diff --git a/test/SHCXX.py b/test/SHCXX.py
new file mode 100644
index 0000000..0c3e2f2
--- /dev/null
+++ b/test/SHCXX.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import string
+import sys
+import TestSCons
+
+python = sys.executable
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+else:
+ _exe = ''
+
+test = TestSCons.TestSCons()
+
+test.write("wrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'wb').write("wrapper.py\\n")
+os.system(string.join(sys.argv[1:], " "))
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+test.write('SConstruct', """
+foo = Environment()
+shcxx = foo.Dictionary('SHCXX')
+bar = Environment(SHCXX = r'%s wrapper.py ' + shcxx)
+foo.Program(target = 'foo', source = 'foo.cc', shared = 1)
+bar.Program(target = 'bar', source = 'bar.cc', shared = 1)
+""" % python)
+
+test.write('foo.cc', r"""
+#include <stdio.h>
+#include <stdlib.h>
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+test.write('bar.cc', r"""
+#include <stdio.h>
+#include <stdlib.h>
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+
+test.run(arguments = 'foo' + _exe)
+
+test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+
+test.run(arguments = 'bar' + _exe)
+
+test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+
+test.pass_test()
diff --git a/test/SHCXXFLAGS.py b/test/SHCXXFLAGS.py
new file mode 100644
index 0000000..af980fe
--- /dev/null
+++ b/test/SHCXXFLAGS.py
@@ -0,0 +1,87 @@
+
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 sys
+import TestSCons
+
+if sys.platform == 'win32':
+ _obj = '.obj'
+ fooflags = '/nologo -DFOO'
+ barflags = '/nologo -DBAR'
+else:
+ _obj = '.o'
+ fooflags = '-DFOO'
+ barflags = '-DBAR'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+foo = Environment(SHCXXFLAGS = '%s')
+bar = Environment(SHCXXFLAGS = '%s')
+foo.Object(target = 'foo%s', source = 'prog.cc', shared = 1)
+bar.Object(target = 'bar%s', source = 'prog.cc', shared = 1)
+foo.Program(target = 'foo', source = 'foo%s', shared = 1)
+bar.Program(target = 'bar', source = 'bar%s', shared = 1)
+""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
+
+test.write('prog.cc', r"""
+#include <stdio.h>
+#include <stdlib.h>
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+#ifdef FOO
+ printf("prog.c: FOO\n");
+#endif
+#ifdef BAR
+ printf("prog.c: BAR\n");
+#endif
+ exit (0);
+}
+""")
+
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n")
+test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
+
+test.write('SConstruct', """
+bar = Environment(SHCXXFLAGS = '%s')
+bar.Object(target = 'foo%s', source = 'prog.cc', shared = 1)
+bar.Object(target = 'bar%s', source = 'prog.cc', shared = 1)
+bar.Program(target = 'foo', source = 'foo%s', shared = 1)
+bar.Program(target = 'bar', source = 'bar%s', shared = 1)
+""" % (barflags, _obj, _obj, _obj, _obj))
+
+test.run(arguments = '.')
+
+test.run(program = test.workpath('foo'), stdout = "prog.c: BAR\n")
+test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
+
+test.pass_test()
diff --git a/test/SHF77.py b/test/SHF77.py
new file mode 100644
index 0000000..5391170
--- /dev/null
+++ b/test/SHF77.py
@@ -0,0 +1,205 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import string
+import sys
+import TestSCons
+
+python = sys.executable
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+else:
+ _exe = ''
+
+test = TestSCons.TestSCons()
+
+
+
+if sys.platform == 'win32':
+
+ test.write('mylink.py', r"""
+import getopt
+import os
+import sys
+args = sys.argv[1:]
+while args:
+ a = args[0]
+ if a[0] != '/':
+ break
+ args.pop(0)
+ if a[:5] == '/OUT:': out = a[5:]
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+for l in infile.readlines():
+ if l[:5] != '#link':
+ outfile.write(l)
+sys.exit(0)
+""")
+
+else:
+
+ test.write('mylink.py', r"""
+import getopt
+import os
+import sys
+opts, args = getopt.getopt(sys.argv[1:], 'o:')
+for opt, arg in opts:
+ if opt == '-o': out = arg
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+for l in infile.readlines():
+ if l[:5] != '#link':
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('myg77.py', r"""
+import getopt
+import os
+import sys
+opts, args = getopt.getopt(sys.argv[1:], 'cf:o:')
+for opt, arg in opts:
+ if opt == '-o': out = arg
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+for l in infile.readlines():
+ if l[:4] != '#g77':
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(LINK = r'%s mylink.py',
+ SHF77 = r'%s myg77.py')
+env.Program(target = 'test1', source = 'test1.f', shared = 1)
+env.Program(target = 'test2', source = 'test2.for', shared = 1)
+env.Program(target = 'test3', source = 'test3.FOR', shared = 1)
+env.Program(target = 'test4', source = 'test4.F', shared = 1)
+env.Program(target = 'test5', source = 'test5.fpp', shared = 1)
+env.Program(target = 'test6', source = 'test6.FPP', shared = 1)
+""" % (python, python))
+
+test.write('test1.f', r"""This is a .f file.
+#g77
+#link
+""")
+
+test.write('test2.for', r"""This is a .for file.
+#g77
+#link
+""")
+
+test.write('test3.FOR', r"""This is a .FOR file.
+#g77
+#link
+""")
+
+test.write('test4.F', r"""This is a .F file.
+#g77
+#link
+""")
+
+test.write('test5.fpp', r"""This is a .fpp file.
+#g77
+#link
+""")
+
+test.write('test6.FPP', r"""This is a .FPP file.
+#g77
+#link
+""")
+
+test.run(arguments = '.', stderr = None)
+
+test.fail_test(test.read('test1' + _exe) != "This is a .f file.\n")
+
+test.fail_test(test.read('test2' + _exe) != "This is a .for file.\n")
+
+test.fail_test(test.read('test3' + _exe) != "This is a .FOR file.\n")
+
+test.fail_test(test.read('test4' + _exe) != "This is a .F file.\n")
+
+test.fail_test(test.read('test5' + _exe) != "This is a .fpp file.\n")
+
+test.fail_test(test.read('test6' + _exe) != "This is a .FPP file.\n")
+
+
+
+g77 = None
+for dir in string.split(os.environ['PATH'], os.pathsep):
+ g = os.path.join(dir, 'g77' + _exe)
+ if os.path.exists(g):
+ g77 = g
+ break
+
+if g77:
+
+ test.write("wrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'wb').write("wrapper.py\\n")
+os.system(string.join(sys.argv[1:], " "))
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+ test.write('SConstruct', """
+foo = Environment(LIBS = 'g2c')
+shf77 = foo.Dictionary('SHF77')
+bar = foo.Copy(SHF77 = r'%s wrapper.py ' + shf77)
+foo.Program(target = 'foo', source = 'foo.f', shared = 1)
+bar.Program(target = 'bar', source = 'bar.f', shared = 1)
+""" % python)
+
+ test.write('foo.f', r"""
+ PROGRAM FOO
+ PRINT *,'foo.f'
+ STOP
+ END
+""")
+
+ test.write('bar.f', r"""
+ PROGRAM BAR
+ PRINT *,'bar.f'
+ STOP
+ END
+""")
+
+
+ test.run(arguments = 'foo' + _exe, stderr = None)
+
+ test.run(program = test.workpath('foo'), stdout = " foo.f\n")
+
+ test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+
+ test.run(arguments = 'bar' + _exe)
+
+ test.run(program = test.workpath('bar'), stdout = " bar.f\n")
+
+ test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+
+test.pass_test()
diff --git a/test/SHF77FLAGS.py b/test/SHF77FLAGS.py
new file mode 100644
index 0000000..e8b5213
--- /dev/null
+++ b/test/SHF77FLAGS.py
@@ -0,0 +1,208 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import string
+import sys
+import TestSCons
+
+python = sys.executable
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+else:
+ _exe = ''
+
+test = TestSCons.TestSCons()
+
+
+
+if sys.platform == 'win32':
+
+ test.write('mylink.py', r"""
+import getopt
+import os
+import sys
+args = sys.argv[1:]
+while args:
+ a = args[0]
+ if a[0] != '/':
+ break
+ args.pop(0)
+ if a[:5] == '/OUT:': out = a[5:]
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+for l in infile.readlines():
+ if l[:5] != '#link':
+ outfile.write(l)
+sys.exit(0)
+""")
+
+else:
+
+ test.write('mylink.py', r"""
+import getopt
+import os
+import sys
+opts, args = getopt.getopt(sys.argv[1:], 'o:')
+for opt, arg in opts:
+ if opt == '-o': out = arg
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+for l in infile.readlines():
+ if l[:5] != '#link':
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('myg77.py', r"""
+import getopt
+import os
+import sys
+opts, args = getopt.getopt(sys.argv[1:], 'co:x')
+optstring = ''
+for opt, arg in opts:
+ if opt == '-o': out = arg
+ else: optstring = optstring + ' ' + opt
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+outfile.write(optstring + "\n")
+for l in infile.readlines():
+ if l[:4] != '#g77':
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(LINK = r'%s mylink.py',
+ SHF77 = r'%s myg77.py', SHF77FLAGS = '-x')
+env.Program(target = 'test1', source = 'test1.f', shared = 1)
+env.Program(target = 'test2', source = 'test2.for', shared = 1)
+env.Program(target = 'test3', source = 'test3.FOR', shared = 1)
+env.Program(target = 'test4', source = 'test4.F', shared = 1)
+env.Program(target = 'test5', source = 'test5.fpp', shared = 1)
+env.Program(target = 'test6', source = 'test6.FPP', shared = 1)
+""" % (python, python))
+
+test.write('test1.f', r"""This is a .f file.
+#g77
+#link
+""")
+
+test.write('test2.for', r"""This is a .for file.
+#g77
+#link
+""")
+
+test.write('test3.FOR', r"""This is a .FOR file.
+#g77
+#link
+""")
+
+test.write('test4.F', r"""This is a .F file.
+#g77
+#link
+""")
+
+test.write('test5.fpp', r"""This is a .fpp file.
+#g77
+#link
+""")
+
+test.write('test6.FPP', r"""This is a .FPP file.
+#g77
+#link
+""")
+
+test.run(arguments = '.', stderr = None)
+
+test.fail_test(test.read('test1' + _exe) != " -x -c\nThis is a .f file.\n")
+
+test.fail_test(test.read('test2' + _exe) != " -x -c\nThis is a .for file.\n")
+
+test.fail_test(test.read('test3' + _exe) != " -x -c\nThis is a .FOR file.\n")
+
+test.fail_test(test.read('test4' + _exe) != " -x -c\nThis is a .F file.\n")
+
+test.fail_test(test.read('test5' + _exe) != " -x -c\nThis is a .fpp file.\n")
+
+test.fail_test(test.read('test6' + _exe) != " -x -c\nThis is a .FPP file.\n")
+
+
+
+g77 = None
+for dir in string.split(os.environ['PATH'], os.pathsep):
+ g = os.path.join(dir, 'g77' + _exe)
+ if os.path.exists(g):
+ g77 = g
+ break
+
+if g77:
+
+ test.write("wrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'wb').write("wrapper.py\\n")
+os.system(string.join(sys.argv[1:], " "))
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+ test.write('SConstruct', """
+foo = Environment(LIBS = 'g2c')
+shf77 = foo.Dictionary('SHF77')
+bar = foo.Copy(SHF77 = r'%s wrapper.py ' + shf77, SHF77FLAGS = '-Ix')
+foo.Program(target = 'foo', source = 'foo.f', shared = 1)
+bar.Program(target = 'bar', source = 'bar.f', shared = 1)
+""" % python)
+
+ test.write('foo.f', r"""
+ PROGRAM FOO
+ PRINT *,'foo.f'
+ STOP
+ END
+""")
+
+ test.write('bar.f', r"""
+ PROGRAM BAR
+ PRINT *,'bar.f'
+ STOP
+ END
+""")
+
+
+ test.run(arguments = 'foo' + _exe, stderr = None)
+
+ test.run(program = test.workpath('foo'), stdout = " foo.f\n")
+
+ test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+
+ test.run(arguments = 'bar' + _exe)
+
+ test.run(program = test.workpath('bar'), stdout = " bar.f\n")
+
+ test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+
+test.pass_test()
diff --git a/test/SHLIBPREFIX.py b/test/SHLIBPREFIX.py
new file mode 100644
index 0000000..30b422e
--- /dev/null
+++ b/test/SHLIBPREFIX.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import sys
+import TestSCons
+
+if sys.platform == 'win32':
+ _lib = '.dll'
+else:
+ _lib = '.so'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(SHLIBPREFIX = 'shlib-')
+env.Library(target = 'foo', source = 'foo.c', shared = 1)
+""")
+
+test.write('foo.c', r"""
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.run(arguments = '.')
+
+test.fail_test(not os.path.exists(test.workpath('shlib-foo' + _lib)))
+
+test.pass_test()
diff --git a/test/SHLIBSUFFIX.py b/test/SHLIBSUFFIX.py
new file mode 100644
index 0000000..e626e7c
--- /dev/null
+++ b/test/SHLIBSUFFIX.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import sys
+import TestSCons
+
+if sys.platform == 'win32':
+ lib_ = ''
+else:
+ lib_ = 'lib'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(SHLIBSUFFIX = '.shlib')
+env.Library (target = 'foo', source = 'foo.c', shared = 1)
+""")
+
+test.write('foo.c', r"""
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.run(arguments = '.')
+
+test.fail_test(not os.path.exists(test.workpath(lib_ + 'foo.shlib')))
+
+test.pass_test()
diff --git a/test/SHLINK.py b/test/SHLINK.py
new file mode 100644
index 0000000..61060ee
--- /dev/null
+++ b/test/SHLINK.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import string
+import sys
+import TestSCons
+
+python = sys.executable
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+else:
+ _exe = ''
+
+test = TestSCons.TestSCons()
+
+test.pass_test() #XXX Until someone can take a look and fix this.
+
+test.write("wrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'wb').write("wrapper.py\\n")
+os.system(string.join(sys.argv[1:], " "))
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+test.write('SConstruct', """
+foo = Environment()
+shlink = foo.Dictionary('SHLINK')
+bar = Environment(SHLINK = r'%s wrapper.py ' + shlink)
+foo.Program(target = 'foo', source = 'foo.c', shared = 1)
+bar.Program(target = 'bar', source = 'bar.c', shared = 1)
+""" % python)
+
+test.write('foo.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+test.write('bar.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+
+test.run(arguments = 'foo' + _exe)
+
+test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+
+test.run(arguments = 'bar' + _exe)
+
+test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+
+test.pass_test()
diff --git a/test/SHLINKFLAGS.py b/test/SHLINKFLAGS.py
new file mode 100644
index 0000000..a885d84
--- /dev/null
+++ b/test/SHLINKFLAGS.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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 os
+import string
+import sys
+import TestSCons
+
+python = sys.executable
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+else:
+ _exe = ''
+
+test = TestSCons.TestSCons()
+
+test.pass_test() #XXX Until someone can take a look and fix this.
+
+test.write("wrapper.py",
+"""import os
+import string
+import sys
+open('%s', 'wb').write("wrapper.py\\n")
+os.system(string.join(sys.argv[1:], " "))
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+test.write('SConstruct', """
+foo = Environment()
+shlink = foo.Dictionary('SHLINK')
+bar = Environment(SHLINK = '', SHLINKFLAGS = r'%s wrapper.py ' + shlink)
+foo.Program(target = 'foo', source = 'foo.c', shared = 1)
+bar.Program(target = 'bar', source = 'bar.c', shared = 1)
+""" % python)
+
+test.write('foo.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+test.write('bar.c', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
+}
+""")
+
+
+test.run(arguments = 'foo' + _exe)
+
+test.fail_test(os.path.exists(test.workpath('wrapper.out')))
+
+test.run(arguments = 'bar' + _exe)
+
+test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+
+test.pass_test()
diff --git a/test/SharedLibrary.py b/test/SharedLibrary.py
new file mode 100644
index 0000000..038370b
--- /dev/null
+++ b/test/SharedLibrary.py
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# 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
+import os
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env=Environment()
+env2 = Environment(LIBS = [ 'foo1', 'foo2', 'foo3' ],
+ LIBPATH = [ '.' ])
+env.Library(target = 'foo1', source = 'f1.c', shared=1)
+env.Library(target = 'foo2', source = 'f2a.c f2b.c f2c.c', shared=1)
+env.Library(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'], shared=1)
+env2.Program(target = 'prog', source = 'prog.c')
+""")
+
+test.write('f1.c', r"""
+#include <stdio.h>
+
+void
+f1(void)
+{
+ printf("f1.c\n");
+ fflush(stdout);
+}
+""")
+
+test.write("foo1.def", r"""
+LIBRARY "foo1"
+DESCRIPTION "Foo1 Shared Library"
+
+EXPORTS
+ f1
+""")
+
+test.write('f2a.c', r"""
+void
+f2a(void)
+{
+ printf("f2a.c\n");
+}
+""")
+
+test.write('f2b.c', r"""
+void
+f2b(void)
+{
+ printf("f2b.c\n");
+}
+""")
+
+test.write('f2c.c', r"""
+#include <stdio.h>
+
+void
+f2c(void)
+{
+ printf("f2c.c\n");
+ fflush(stdout);
+}
+""")
+
+test.write("foo2.def", r"""
+LIBRARY "foo2"
+DESCRIPTION "Foo2 Shared Library"
+
+EXPORTS
+ f2a
+ f2b
+ f2c
+""")
+
+test.write('f3a.c', r"""
+void
+f3a(void)
+{
+ printf("f3a.c\n");
+}
+""")
+
+test.write('f3b.c', r"""
+void
+f3b(void)
+{
+ printf("f3b.c\n");
+}
+""")
+
+test.write('f3c.c', r"""
+#include <stdio.h>
+
+f3c(void)
+{
+ printf("f3c.c\n");
+ fflush(stdout);
+}
+""")
+
+test.write("foo3.def", r"""
+LIBRARY "foo3"
+DESCRIPTION "Foo3 Shared Library"
+
+EXPORTS
+ f3a
+ f3b
+ f3c
+""")
+
+test.write('prog.c', r"""
+void f1(void);
+void f2a(void);
+void f2b(void);
+void f2c(void);
+void f3a(void);
+void f3b(void);
+void f3c(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ f1();
+ f2a();
+ f2b();
+ f2c();
+ f3a();
+ f3b();
+ f3c();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.')
+
+if os.name == 'posix':
+ os.environ['LD_LIBRARY_PATH'] = '.'
+test.run(program = test.workpath('prog'),
+ stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n")
+
+test.pass_test()
diff --git a/test/multiline.py b/test/multiline.py
index 5ec53e7..56c051b 100644
--- a/test/multiline.py
+++ b/test/multiline.py
@@ -42,8 +42,8 @@ sys.exit(0)
""")
test.write('SConstruct', """
-B1 = Builder(name = 'B1', action = [r'%s build.py .temp $SOURCES',
- r'%s build.py $TARGETS .temp'])
+B1 = Builder(name = 'B1', action = [ [ r'%s', 'build.py', '.temp', '$SOURCES' ],
+ [ r'%s', 'build.py', '$TARGETS', '.temp'] ])
B2 = Builder(name = 'B2', action = r'%s' + " build.py .temp $SOURCES\\n" + r'%s' + " build.py $TARGETS .temp")
env = Environment(BUILDERS = [B1, B2])
env.B1(target = 'foo1.out', source = 'foo1.in')