diff options
author | Steven Knight <knight@baldmt.com> | 2004-11-21 21:14:41 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-11-21 21:14:41 (GMT) |
commit | 9ee53a60a770d6f5a33624405d35ad4063378367 (patch) | |
tree | 361012066ed284ecad1482552d177f86a0cd664d /test | |
parent | 07c75889f874a050aff782d1488d0269fb936744 (diff) | |
download | SCons-9ee53a60a770d6f5a33624405d35ad4063378367.zip SCons-9ee53a60a770d6f5a33624405d35ad4063378367.tar.gz SCons-9ee53a60a770d6f5a33624405d35ad4063378367.tar.bz2 |
More command-line output customizability: , , , .
Diffstat (limited to 'test')
-rw-r--r-- | test/Java/JAR.py (renamed from test/JAR.py) | 0 | ||||
-rw-r--r-- | test/Java/JARCOM.py | 65 | ||||
-rw-r--r-- | test/Java/JARCOMSTR.py | 69 | ||||
-rw-r--r-- | test/Java/JARFLAGS.py (renamed from test/JARFLAGS.py) | 0 | ||||
-rw-r--r-- | test/Java/JAVAC.py (renamed from test/JAVAC.py) | 0 | ||||
-rw-r--r-- | test/Java/JAVACCOM.py | 68 | ||||
-rw-r--r-- | test/Java/JAVACCOMSTR.py | 72 | ||||
-rw-r--r-- | test/Java/JAVACFLAGS.py (renamed from test/JAVACFLAGS.py) | 0 | ||||
-rw-r--r-- | test/Java/JAVAH.py (renamed from test/JAVAH.py) | 0 | ||||
-rw-r--r-- | test/Java/JAVAHCOM.py | 69 | ||||
-rw-r--r-- | test/Java/JAVAHCOMSTR.py | 85 | ||||
-rw-r--r-- | test/Java/RMIC.py (renamed from test/RMIC.py) | 0 | ||||
-rw-r--r-- | test/Java/RMICCOM.py | 79 | ||||
-rw-r--r-- | test/Java/RMICCOMSTR.py | 85 |
14 files changed, 592 insertions, 0 deletions
diff --git a/test/JAR.py b/test/Java/JAR.py index ea51213..ea51213 100644 --- a/test/JAR.py +++ b/test/Java/JAR.py diff --git a/test/Java/JARCOM.py b/test/Java/JARCOM.py new file mode 100644 index 0000000..0d7ebba --- /dev/null +++ b/test/Java/JARCOM.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 the ability to configure the $JARCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myjar.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*jar*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'jar'], + JARCOM = r'%(python)s myjar.py $TARGET $SOURCES') +env.Jar(target = 'test1', source = ['file1.in', 'file2.in', 'file3.in']) +""" % locals()) + +test.write('file1.in', "file1.in\n/*jar*/\n") +test.write('file2.in', "file2.in\n/*jar*/\n") +test.write('file3.in', "file3.in\n/*jar*/\n") + +test.run() + +test.must_match('test1.jar', "file1.in\nfile2.in\nfile3.in\n") + + + +test.pass_test() diff --git a/test/Java/JARCOMSTR.py b/test/Java/JARCOMSTR.py new file mode 100644 index 0000000..aa8a6ad --- /dev/null +++ b/test/Java/JARCOMSTR.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__" + +""" +Test that the $JARCOMSTR construction variable allows you to configure +the jar output. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myjar.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*jar*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'jar'], + JARCOM = r'%(python)s myjar.py $TARGET $SOURCES', + JARCOMSTR = "Jar'ing up $TARGET from $SOURCES") +env.Jar(target = 'test1', source = ['file1.in', 'file2.in', 'file3.in']) +""" % locals()) + +test.write('file1.in', "file1.in\n/*jar*/\n") +test.write('file2.in', "file2.in\n/*jar*/\n") +test.write('file3.in', "file3.in\n/*jar*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Jar'ing up test1.jar from file1.in file2.in file3.in +""")) + +test.must_match('test1.jar', "file1.in\nfile2.in\nfile3.in\n") + + + +test.pass_test() diff --git a/test/JARFLAGS.py b/test/Java/JARFLAGS.py index 7e3669d..7e3669d 100644 --- a/test/JARFLAGS.py +++ b/test/Java/JARFLAGS.py diff --git a/test/JAVAC.py b/test/Java/JAVAC.py index 779045f..779045f 100644 --- a/test/JAVAC.py +++ b/test/Java/JAVAC.py diff --git a/test/Java/JAVACCOM.py b/test/Java/JAVACCOM.py new file mode 100644 index 0000000..171649c --- /dev/null +++ b/test/Java/JAVACCOM.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__" + +""" +Test the ability to configure the $JAVACCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + +test.subdir('src') + + + +test.write('myjavac.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*javac*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'javac'], + JAVACCOM = r'%(python)s myjavac.py $TARGET $SOURCES') +env.Java(target = 'classes', source = 'src') +""" % locals()) + +test.write(['src', 'file1.java'], "file1.java\n/*javac*/\n") +test.write(['src', 'file2.java'], "file2.java\n/*javac*/\n") +test.write(['src', 'file3.java'], "file3.java\n/*javac*/\n") + +test.run() + +test.must_match(['classes', 'src', 'file1.class'], + "file1.java\nfile2.java\nfile3.java\n") + + + +test.pass_test() diff --git a/test/Java/JAVACCOMSTR.py b/test/Java/JAVACCOMSTR.py new file mode 100644 index 0000000..306ae57 --- /dev/null +++ b/test/Java/JAVACCOMSTR.py @@ -0,0 +1,72 @@ +#!/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 $JAVACCOMSTR construction variable allows you to configure +the javac output. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + +test.subdir('src') + + + +test.write('myjavac.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*javac*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'javac'], + JAVACCOM = r'%(python)s myjavac.py $TARGET $SOURCES', + JAVACCOMSTR = "Compiling class(es) $TARGET from $SOURCES") +env.Java(target = 'classes', source = 'src') +""" % locals()) + +test.write(['src', 'file1.java'], "file1.java\n/*javac*/\n") +test.write(['src', 'file2.java'], "file2.java\n/*javac*/\n") +test.write(['src', 'file3.java'], "file3.java\n/*javac*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Compiling class(es) classes/src/file1.class from src/file1.java src/file2.java src/file3.java +""")) + +test.must_match(['classes', 'src', 'file1.class'], + "file1.java\nfile2.java\nfile3.java\n") + + + +test.pass_test() diff --git a/test/JAVACFLAGS.py b/test/Java/JAVACFLAGS.py index ef084cd..ef084cd 100644 --- a/test/JAVACFLAGS.py +++ b/test/Java/JAVACFLAGS.py diff --git a/test/JAVAH.py b/test/Java/JAVAH.py index b70fde0..b70fde0 100644 --- a/test/JAVAH.py +++ b/test/Java/JAVAH.py diff --git a/test/Java/JAVAHCOM.py b/test/Java/JAVAHCOM.py new file mode 100644 index 0000000..1cc4208 --- /dev/null +++ b/test/Java/JAVAHCOM.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__" + +""" +Test the ability to configure the $JAVAHCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myjavah.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*javah*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'javah'], + JAVAHCOM = r'%(python)s myjavah.py $TARGET $SOURCES') +env.JavaH(target = 'out', source = 'file1.class') +env.JavaH(target = 'out', source = 'file2.class') +env.JavaH(target = 'out', source = 'file3.class') +""" % locals()) + +test.write('file1.class', "file1.class\n/*javah*/\n") +test.write('file2.class', "file2.class\n/*javah*/\n") +test.write('file3.class', "file3.class\n/*javah*/\n") + +test.run() + +test.must_match(['out', 'file1.h'], "file1.class\n") +test.must_match(['out', 'file2.h'], "file2.class\n") +test.must_match(['out', 'file3.h'], "file3.class\n") + + + +test.pass_test() diff --git a/test/Java/JAVAHCOMSTR.py b/test/Java/JAVAHCOMSTR.py new file mode 100644 index 0000000..2a14e1c --- /dev/null +++ b/test/Java/JAVAHCOMSTR.py @@ -0,0 +1,85 @@ +#!/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 $JAVAHCOMSTR construction variable allows you to configure +the javah output. +""" + +import os.path + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + +test.subdir('src') + + + +out_file1_h = os.path.join('out', 'file1.h') +out_file2_h = os.path.join('out', 'file2.h') +out_file3_h = os.path.join('out', 'file3.h') + + + +test.write('myjavah.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*javah*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'javah'], + JAVAHCOM = r'%(python)s myjavah.py $TARGET $SOURCES', + JAVAHCOMSTR = 'Building javah $TARGET from $SOURCES') +env.JavaH(target = 'out', source = 'file1.class') +env.JavaH(target = 'out', source = 'file2.class') +env.JavaH(target = 'out', source = 'file3.class') +""" % locals()) + +test.write('file1.class', "file1.class\n/*javah*/\n") +test.write('file2.class', "file2.class\n/*javah*/\n") +test.write('file3.class', "file3.class\n/*javah*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Building javah %(out_file1_h)s from file1.class +Building javah %(out_file2_h)s from file2.class +Building javah %(out_file3_h)s from file3.class +""" % locals())) + +test.must_match(['out', 'file1.h'], "file1.class\n") +test.must_match(['out', 'file2.h'], "file2.class\n") +test.must_match(['out', 'file3.h'], "file3.class\n") + + + +test.pass_test() diff --git a/test/RMIC.py b/test/Java/RMIC.py index 8f3623c..8f3623c 100644 --- a/test/RMIC.py +++ b/test/Java/RMIC.py diff --git a/test/Java/RMICCOM.py b/test/Java/RMICCOM.py new file mode 100644 index 0000000..109c22e --- /dev/null +++ b/test/Java/RMICCOM.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__" + +""" +Test the ability to configure the $RMICCOM construction variable. +""" + +import os.path + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + +test.subdir('src') + + + +out_file1 = os.path.join('out', 'file1', 'class_Skel.class') +out_file2 = os.path.join('out', 'file2', 'class_Skel.class') +out_file3 = os.path.join('out', 'file3', 'class_Skel.class') + + + +test.write('myrmic.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*rmic*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'rmic'], + RMICCOM = r'%(python)s myrmic.py $TARGET $SOURCES') +env.RMIC(target = 'out', source = 'file1.class') +env.RMIC(target = 'out', source = 'file2.class') +env.RMIC(target = 'out', source = 'file3.class') +""" % locals()) + +test.write('file1.class', "file1.class\n/*rmic*/\n") +test.write('file2.class', "file2.class\n/*rmic*/\n") +test.write('file3.class', "file3.class\n/*rmic*/\n") + +test.run() + +test.must_match(out_file1, "file1.class\n") +test.must_match(out_file2, "file2.class\n") +test.must_match(out_file3, "file3.class\n") + + + +test.pass_test() diff --git a/test/Java/RMICCOMSTR.py b/test/Java/RMICCOMSTR.py new file mode 100644 index 0000000..1bcf300 --- /dev/null +++ b/test/Java/RMICCOMSTR.py @@ -0,0 +1,85 @@ +#!/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 $RMICCOMSTR construction variable allows you to configure +the rmic output. +""" + +import os.path + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + +test.subdir('src') + + + +out_file1 = os.path.join('out', 'file1', 'class_Skel.class') +out_file2 = os.path.join('out', 'file2', 'class_Skel.class') +out_file3 = os.path.join('out', 'file3', 'class_Skel.class') + + + +test.write('myrmic.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*rmic*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['default', 'rmic'], + RMICCOM = r'%(python)s myrmic.py $TARGET $SOURCES', + RMICCOMSTR = 'Building rmic $TARGET from $SOURCES') +env.RMIC(target = 'out', source = 'file1.class') +env.RMIC(target = 'out', source = 'file2.class') +env.RMIC(target = 'out', source = 'file3.class') +""" % locals()) + +test.write('file1.class', "file1.class\n/*rmic*/\n") +test.write('file2.class', "file2.class\n/*rmic*/\n") +test.write('file3.class', "file3.class\n/*rmic*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Building rmic %(out_file1)s from file1.class +Building rmic %(out_file2)s from file2.class +Building rmic %(out_file3)s from file3.class +""" % locals())) + +test.must_match(out_file1, "file1.class\n") +test.must_match(out_file2, "file2.class\n") +test.must_match(out_file3, "file3.class\n") + + + +test.pass_test() |