diff options
| author | William Deegan <bill@baddogconsulting.com> | 2015-09-21 17:03:12 (GMT) |
|---|---|---|
| committer | William Deegan <bill@baddogconsulting.com> | 2015-09-21 17:03:12 (GMT) |
| commit | 0941093e0e5a030faa49968457638a3a6aee7ad8 (patch) | |
| tree | 6d33513c14eb6eac0531dd050de0ecca4c39bd79 /test/scons-time/run/config | |
| download | SCons-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/scons-time/run/config')
| -rw-r--r-- | test/scons-time/run/config/archive_list.py | 83 | ||||
| -rw-r--r-- | test/scons-time/run/config/initial_commands.py | 62 | ||||
| -rw-r--r-- | test/scons-time/run/config/prefix.py | 58 | ||||
| -rw-r--r-- | test/scons-time/run/config/python.py | 74 | ||||
| -rw-r--r-- | test/scons-time/run/config/scons.py | 70 | ||||
| -rw-r--r-- | test/scons-time/run/config/subdir.py | 71 | ||||
| -rw-r--r-- | test/scons-time/run/config/targets.py | 92 |
7 files changed, 510 insertions, 0 deletions
diff --git a/test/scons-time/run/config/archive_list.py b/test/scons-time/run/config/archive_list.py new file mode 100644 index 0000000..d393a69 --- /dev/null +++ b/test/scons-time/run/config/archive_list.py @@ -0,0 +1,83 @@ +#!/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 specifying a list of archives through the archive_list setting +in a config file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +archive_list = ['foo.tar.gz', 'foo-file'] +""") + +test.write('foo-file', "foo-file\n") + +test.run(arguments = 'run -f config') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.must_exist('foo-file') + + +test.write_sample_project('bar.tar.gz') + +test.run(arguments = 'run -f config bar.tar.gz') + +test.must_not_exist('foo-001-0.log', + 'foo-001-0.prof', + 'foo-001-1.log', + 'foo-001-1.prof', + 'foo-001-2.log', + 'foo-001-2.prof') + +test.must_exist('bar-000-0.log', + 'bar-000-0.prof', + 'bar-000-1.log', + 'bar-000-1.prof', + 'bar-000-2.log', + 'bar-000-2.prof') + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/run/config/initial_commands.py b/test/scons-time/run/config/initial_commands.py new file mode 100644 index 0000000..167ed49 --- /dev/null +++ b/test/scons-time/run/config/initial_commands.py @@ -0,0 +1,62 @@ +#!/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 specifying a list of initial commands through a config file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +def touch(arg): + open(arg, 'w') +initial_commands = [(touch, 'touch %%%%s', r'%s')] +""" % test.workpath('INITIAL')) + +test.run(arguments = 'run -f config foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +test.must_exist('INITIAL') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/run/config/prefix.py b/test/scons-time/run/config/prefix.py new file mode 100644 index 0000000..5ef673b --- /dev/null +++ b/test/scons-time/run/config/prefix.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify specifying an alternate file prefix through a config file. +""" + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +prefix = 'bar' +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +test.must_exist('bar-000-0.log', + 'bar-000-0.prof', + 'bar-000-1.log', + 'bar-000-1.prof', + 'bar-000-2.log', + 'bar-000-2.prof') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py new file mode 100644 index 0000000..6cf965b --- /dev/null +++ b/test/scons-time/run/config/python.py @@ -0,0 +1,74 @@ +#!/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 specifying an alternate Python executable in a config file. +""" + +import os + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +my_python_py = test.workpath('my_python.py') + +test.write('config', """\ +python = r'%(my_python_py)s' +""" % locals()) + +test.write(my_python_py, """\ +#!/usr/bin/env python +import sys +profile = '' +for arg in sys.argv[1:]: + if arg.startswith('--profile='): + profile = arg[10:] + break +print 'my_python.py: %s' % profile +""") + +os.chmod(my_python_py, 0755) + +test.run(arguments = 'run -f config foo.tar.gz') + +prof0 = test.workpath('foo-000-0.prof') +prof1 = test.workpath('foo-000-1.prof') +prof2 = test.workpath('foo-000-2.prof') + +test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0) +test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1) +test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/run/config/scons.py b/test/scons-time/run/config/scons.py new file mode 100644 index 0000000..73f041d --- /dev/null +++ b/test/scons-time/run/config/scons.py @@ -0,0 +1,70 @@ +#!/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 specifying an alternate SCons through a config file. +""" + + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_sample_project('foo.tar.gz') + +my_scons_py = test.workpath('my_scons.py') + +test.write('config', """\ +scons = r'%(my_scons_py)s' +""" % locals()) + +test.write(my_scons_py, """\ +import sys +profile = '' +for arg in sys.argv[1:]: + if arg.startswith('--profile='): + profile = arg[10:] + break +print 'my_scons.py: %s' % profile +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +prof0 = test.workpath('foo-000-0.prof') +prof1 = test.workpath('foo-000-1.prof') +prof2 = test.workpath('foo-000-2.prof') + +test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0) +test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1) +test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/run/config/subdir.py b/test/scons-time/run/config/subdir.py new file mode 100644 index 0000000..1d7ca8e --- /dev/null +++ b/test/scons-time/run/config/subdir.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__" + +""" +Verify picking up the subdir value from a config file. +""" + +import os +import re + +import TestSCons_time + +test = TestSCons_time.TestSCons_time() + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz', 'subdir') + +test.write('config', """\ +subdir = 'subdir' +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +test.must_exist('foo-000-0.log', + 'foo-000-0.prof', + 'foo-000-1.log', + 'foo-000-1.prof', + 'foo-000-2.log', + 'foo-000-2.prof') + +content = test.read(test.workpath('foo-000-0.log'), mode='r') + +expect = [ + 'SConstruct file directory: .*%ssubdir$' % re.escape(os.sep), +] + +def re_find(content, line): + return re.search(line, content) +test.must_contain_all_lines(content, expect, 'foo-000-0.log', re_find) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/scons-time/run/config/targets.py b/test/scons-time/run/config/targets.py new file mode 100644 index 0000000..482a44d --- /dev/null +++ b/test/scons-time/run/config/targets.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify specifying a list of targets through a config file. +""" + +import os +import re + +import TestSCons_time + +test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re) + +test.write_fake_scons_py() + +test.write_sample_project('foo.tar.gz') + +test.write('config', """\ +targets = 'target1 target2' +""") + +test.run(arguments = 'run -f config foo.tar.gz') + +scons_py = re.escape(test.workpath('src', 'script', 'scons.py')) +src_engine = re.escape(test.workpath('src', 'engine')) + +prof1 = re.escape(test.workpath('foo-000-1.prof')) +prof2 = re.escape(test.workpath('foo-000-2.prof')) + +sep = re.escape(os.sep) + +expect = """\ +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof1)s + target1 + target2 +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: .*scons-time-.*%(sep)sfoo +""" % locals() + +test.must_match('foo-000-1.log', expect, mode='r') + +expect = """\ +%(scons_py)s + --debug=count + --debug=memory + --debug=time + --debug=memoizer + --profile=%(prof2)s + target1 + target2 +SCONS_LIB_DIR = %(src_engine)s +SConstruct file directory: .*scons-time-.*%(sep)sfoo +""" % locals() + +test.must_match('foo-000-2.log', expect, mode='r') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |
