diff options
author | Steven Knight <knight@baldmt.com> | 2005-01-07 00:42:01 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-01-07 00:42:01 (GMT) |
commit | 4e17c7182977812c7751523ef08f7b221ae6aa61 (patch) | |
tree | 2207659ec602bdd8a4ae9c462692b5cdce26ea76 /test | |
parent | 8209788c5d6a2554317a13416bb953b6c3f572ab (diff) | |
download | SCons-4e17c7182977812c7751523ef08f7b221ae6aa61.zip SCons-4e17c7182977812c7751523ef08f7b221ae6aa61.tar.gz SCons-4e17c7182977812c7751523ef08f7b221ae6aa61.tar.bz2 |
Finish the display-customization variables: , , , , , and .
Diffstat (limited to 'test')
-rw-r--r-- | test/Ghostscript/GSFLAGS.py (renamed from test/GSFLAGS.py) | 0 | ||||
-rw-r--r-- | test/IDL/IDLSUFFIXES.py (renamed from test/IDLSUFFIXES.py) | 0 | ||||
-rw-r--r-- | test/IDL/MIDLCOM.py | 63 | ||||
-rw-r--r-- | test/IDL/MIDLCOMSTR.py | 67 | ||||
-rw-r--r-- | test/IDL/midl.py (renamed from test/midl.py) | 0 | ||||
-rw-r--r-- | test/MSVC/PCHCOM.py | 63 | ||||
-rw-r--r-- | test/MSVC/PCHCOMSTR.py | 67 | ||||
-rw-r--r-- | test/MSVC/RCCOM.py | 64 | ||||
-rw-r--r-- | test/MSVC/RCCOMSTR.py | 67 | ||||
-rw-r--r-- | test/MSVC/msvc.py (renamed from test/msvc.py) | 0 | ||||
-rw-r--r-- | test/MinGW/RCCOM.py | 64 | ||||
-rw-r--r-- | test/MinGW/RCCOMSTR.py | 67 | ||||
-rw-r--r-- | test/QT/QT.py (renamed from test/QT.py) | 0 | ||||
-rw-r--r-- | test/QT/QTFLAGS.py (renamed from test/QTFLAGS.py) | 0 | ||||
-rw-r--r-- | test/rpcgen.py | 99 |
15 files changed, 522 insertions, 99 deletions
diff --git a/test/GSFLAGS.py b/test/Ghostscript/GSFLAGS.py index 14ce769..14ce769 100644 --- a/test/GSFLAGS.py +++ b/test/Ghostscript/GSFLAGS.py diff --git a/test/IDLSUFFIXES.py b/test/IDL/IDLSUFFIXES.py index 2aaf9fe..2aaf9fe 100644 --- a/test/IDLSUFFIXES.py +++ b/test/IDL/IDLSUFFIXES.py diff --git a/test/IDL/MIDLCOM.py b/test/IDL/MIDLCOM.py new file mode 100644 index 0000000..d3f6420 --- /dev/null +++ b/test/IDL/MIDLCOM.py @@ -0,0 +1,63 @@ +#!/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 $MIDLCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mymidl.py', """ +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 != '/*midl*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'midl'], + MIDLCOM = r'%s mymidl.py $TARGET $SOURCES') +env.TypeLibrary(target = 'aaa', source = 'aaa.idl') +""" % python) + +test.write('aaa.idl', "aaa.idl\n/*midl*/\n") + +test.run(arguments = '.') + +test.must_match('aaa.tlb', "aaa.idl\n") + + + +test.pass_test() diff --git a/test/IDL/MIDLCOMSTR.py b/test/IDL/MIDLCOMSTR.py new file mode 100644 index 0000000..89a6e25 --- /dev/null +++ b/test/IDL/MIDLCOMSTR.py @@ -0,0 +1,67 @@ +#!/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 $MIDLCOMSTR construction variable allows you to customize +the displayed string when midl is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mymidl.py', """ +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 != '/*midl*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'midl'], + MIDLCOM = r'%s mymidl.py $TARGET $SOURCES', + MIDLCOMSTR = 'MIDLing $TARGET from $SOURCE') +env.TypeLibrary(target = 'aaa', source = 'aaa.idl') +""" % python) + +test.write('aaa.idl', "aaa.idl\n/*midl*/\n") + +test.run(stdout = test.wrap_stdout("""\ +MIDLing aaa.tlb from aaa.idl +""")) + +test.must_match('aaa.tlb', "aaa.idl\n") + + + +test.pass_test() diff --git a/test/midl.py b/test/IDL/midl.py index a41ac01..a41ac01 100644 --- a/test/midl.py +++ b/test/IDL/midl.py diff --git a/test/MSVC/PCHCOM.py b/test/MSVC/PCHCOM.py new file mode 100644 index 0000000..593a1c1 --- /dev/null +++ b/test/MSVC/PCHCOM.py @@ -0,0 +1,63 @@ +#!/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 $MIDLCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mypch.py', """ +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 != '/*pch*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + PCHCOM = r'%s mypch.py $TARGET $SOURCES') +env.PCH(target = 'aaa', source = 'aaa.h') +""" % python) + +test.write('aaa.h', "aaa.h\n/*pch*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.pch', "aaa.h\n") + + + +test.pass_test() diff --git a/test/MSVC/PCHCOMSTR.py b/test/MSVC/PCHCOMSTR.py new file mode 100644 index 0000000..c5ab9f5 --- /dev/null +++ b/test/MSVC/PCHCOMSTR.py @@ -0,0 +1,67 @@ +#!/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 $PCHCOMSTR construction variable allows you to customize +the displayed string when pch is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mypch.py', """ +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 != '/*pch*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + PCHCOM = r'%s mypch.py $TARGET $SOURCES', + PCHCOMSTR = 'PCHing $TARGET from $SOURCE') +env.PCH(target = 'aaa', source = 'aaa.h') +""" % python) + +test.write('aaa.h', "aaa.h\n/*pch*/\n") + +test.run(stdout = test.wrap_stdout("""\ +PCHing aaa.pch from aaa.h +""")) + +test.must_match('aaa.pch', "aaa.h\n") + + + +test.pass_test() diff --git a/test/MSVC/RCCOM.py b/test/MSVC/RCCOM.py new file mode 100644 index 0000000..3262f0c --- /dev/null +++ b/test/MSVC/RCCOM.py @@ -0,0 +1,64 @@ +#!/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 $RCCOM construction variable +when using MSVC. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +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 != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.res', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/MSVC/RCCOMSTR.py b/test/MSVC/RCCOMSTR.py new file mode 100644 index 0000000..33e192b --- /dev/null +++ b/test/MSVC/RCCOMSTR.py @@ -0,0 +1,67 @@ +#!/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 $RCCOMSTR construction variable allows you to customize +the displayed string when rc is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +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 != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES', + RCCOMSTR = 'RCing $TARGET from $SOURCE') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(stdout = test.wrap_stdout("""\ +RCing aaa.res from aaa.rc +""")) + +test.must_match('aaa.res', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/msvc.py b/test/MSVC/msvc.py index fe5bfee..fe5bfee 100644 --- a/test/msvc.py +++ b/test/MSVC/msvc.py diff --git a/test/MinGW/RCCOM.py b/test/MinGW/RCCOM.py new file mode 100644 index 0000000..4ddcd91 --- /dev/null +++ b/test/MinGW/RCCOM.py @@ -0,0 +1,64 @@ +#!/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 $RCCOM construction variable +when using MinGW. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +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 != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'mingw'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.o', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/MinGW/RCCOMSTR.py b/test/MinGW/RCCOMSTR.py new file mode 100644 index 0000000..e095847 --- /dev/null +++ b/test/MinGW/RCCOMSTR.py @@ -0,0 +1,67 @@ +#!/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 $RCCOMSTR construction variable allows you to customize +the displayed string when rc is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +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 != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'mingw'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES', + RCCOMSTR = 'RCing $TARGET from $SOURCE') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(stdout = test.wrap_stdout("""\ +RCing aaa.o from aaa.rc +""")) + +test.must_match('aaa.o', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/QT.py b/test/QT/QT.py index 680784f..680784f 100644 --- a/test/QT.py +++ b/test/QT/QT.py diff --git a/test/QTFLAGS.py b/test/QT/QTFLAGS.py index f9cb917..f9cb917 100644 --- a/test/QTFLAGS.py +++ b/test/QT/QTFLAGS.py diff --git a/test/rpcgen.py b/test/rpcgen.py deleted file mode 100644 index 7c9f8ec..0000000 --- a/test/rpcgen.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/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 os -import string -import sys -import TestSCons - -_exe = TestSCons._exe -test = TestSCons.TestSCons() - -rpcgen = test.where_is('rpcgen') -if not rpcgen: - print "rpcgen not found, skipping test" - test.pass_test(1) - -test.subdir('do_rpcgen') - -test.write('SConstruct', """\ -import os -env = Environment(ENV=os.environ) -env.Program('rpcclnt', ['rpcclnt.c', 'do_rpcgen/rpcif_clnt.c']) -env.RPCGenHeader('do_rpcgen/rpcif') -env.RPCGenClient('do_rpcgen/rpcif') -env.RPCGenService('do_rpcgen/rpcif') -env.RPCGenXDR('do_rpcgen/rpcif') -""") - -test.write(['do_rpcgen', 'rpcif.x'], """\ -program RPCTEST_IF -{ - version RPCTEST_IF_VERSION - { - int START(unsigned long) = 1; - int STOP(unsigned long) = 2; - int STATUS(unsigned long) = 3; - } = 1; /* version */ -} = 0xfeedf00d; /* portmap program ID */ -""") - -# Following test tries to make sure it can compile and link, but when -# it's run it doesn't actually invoke any rpc operations because that -# would have significant dependencies on network configuration, -# portmapper, etc. that aren't necessarily appropriate for an scons -# test. - -test.write('rpcclnt.c', """\ -#include <rpc/rpc.h> -#include <rpc/pmap_clnt.h> -#include "do_rpcgen/rpcif.h" - -int main(int argc, char **args) { - const char* const SERVER = "localhost"; - CLIENT *cl; - int *rslt; - unsigned long arg = 0; - if (argc > 2) { - cl = clnt_create( SERVER, RPCTEST_IF, RPCTEST_IF_VERSION, "udp" ); - if (cl == 0 ) { return 1; } - rslt = start_1(&arg, cl); - if (*rslt == 0) { clnt_perror( cl, SERVER ); return 1; } - clnt_destroy(cl); - } else - printf("Hello!\\n"); - return 0; -} -""") - - -test.run() - -test.run(program=test.workpath('rpcclnt'+_exe)) - -test.fail_test(not test.stdout() in ["Hello!\n", "Hello!\r\n"]) - -test.pass_test() |