diff options
author | Stefan Zimmermann <zimmermann.code@gmail.com> | 2014-03-31 15:40:20 (GMT) |
---|---|---|
committer | Stefan Zimmermann <zimmermann.code@gmail.com> | 2014-03-31 15:40:20 (GMT) |
commit | 59ee07b24ed1278d83aa70605f51b6284aa60a82 (patch) | |
tree | e44c28ee21a3d4b59d2cab79a529be6a09907881 /test | |
parent | 2d2df48b33045bb15b543264114c6ef35773ef29 (diff) | |
parent | cb44210566c28d16c1e2c91d898306ad539fa9f5 (diff) | |
download | SCons-59ee07b24ed1278d83aa70605f51b6284aa60a82.zip SCons-59ee07b24ed1278d83aa70605f51b6284aa60a82.tar.gz SCons-59ee07b24ed1278d83aa70605f51b6284aa60a82.tar.bz2 |
Merged with [default]
Diffstat (limited to 'test')
42 files changed, 1569 insertions, 10 deletions
diff --git a/test/CacheDir/option--cr.py b/test/CacheDir/option--cr.py new file mode 100644 index 0000000..de6bbc8 --- /dev/null +++ b/test/CacheDir/option--cr.py @@ -0,0 +1,138 @@ +#!/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 --cache-readonly option when retrieving derived files from a +CacheDir. It should retrieve as normal but not update files. +""" + +import os.path +import shutil + +import TestSCons + +test = TestSCons.TestSCons() + +test.subdir('cache', 'src') + +test.write(['src', 'SConstruct'], """ +def cat(env, source, target): + target = str(target[0]) + open('cat.out', 'ab').write(target + "\\n") + f = open(target, "wb") + for src in source: + f.write(open(str(src), "rb").read()) + f.close() +env = Environment(BUILDERS={'Cat':Builder(action=cat)}) +env.Cat('aaa.out', 'aaa.in') +env.Cat('bbb.out', 'bbb.in') +env.Cat('ccc.out', 'ccc.in') +env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) +CacheDir(r'%s') +""" % test.workpath('cache')) + +test.write(['src', 'aaa.in'], "aaa.in\n") +test.write(['src', 'bbb.in'], "bbb.in\n") +test.write(['src', 'ccc.in'], "ccc.in\n") + +# Verify that a normal build works correctly, and clean up. +# This should populate the cache with our derived files. +test.run(chdir = 'src', arguments = '.') + +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n") + +test.up_to_date(chdir = 'src', arguments = '.') + +test.run(chdir = 'src', arguments = '-c .') +test.unlink(['src', 'cat.out']) + +# Verify that we now retrieve the derived files from cache, +# not rebuild them. Then clean up. +test.run(chdir = 'src', arguments = '--cache-readonly .', + stdout = test.wrap_stdout("""\ +Retrieved `aaa.out' from cache +Retrieved `bbb.out' from cache +Retrieved `ccc.out' from cache +Retrieved `all' from cache +""")) + +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_not_exist(test.workpath('src', 'cat.out')) + +test.up_to_date(chdir = 'src', arguments = '.') + +test.run(chdir = 'src', arguments = '-c .') + +# What we do now is to change one of the files and rebuild +test.write(['src', 'aaa.in'], "aaa.rebuild\n") + +# This should just rebuild aaa.out (and all) +test.run(chdir = 'src', + arguments = '--cache-readonly .', + stdout = test.wrap_stdout("""\ +cat(["aaa.out"], ["aaa.in"]) +Retrieved `bbb.out' from cache +Retrieved `ccc.out' from cache +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) +""")) + +test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n") +# cat.out contains only the things we built (not got from cache) +test.must_match(['src', 'cat.out'], "aaa.out\nall\n") + +test.up_to_date(chdir = 'src', arguments = '.') + +test.run(chdir = 'src', arguments = '-c .') +test.unlink(['src', 'cat.out']) + +# Verify that aaa.out contents weren't updated with the last build +# Then clean up. +test.run(chdir = 'src', + arguments = '--cache-readonly .', + stdout = test.wrap_stdout("""\ +cat(["aaa.out"], ["aaa.in"]) +Retrieved `bbb.out' from cache +Retrieved `ccc.out' from cache +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) +""")) + +test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n") +test.must_match(['src', 'cat.out'], "aaa.out\nall\n") + +test.up_to_date(chdir = 'src', arguments = '.') + +test.run(chdir = 'src', arguments = '-c .') +test.unlink(['src', 'cat.out']) + +# All done. +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basedir/htmlchunked/htmlchunked.py b/test/Docbook/basedir/htmlchunked/htmlchunked.py index c581701..cf5f3d1 100644 --- a/test/Docbook/basedir/htmlchunked/htmlchunked.py +++ b/test/Docbook/basedir/htmlchunked/htmlchunked.py @@ -26,10 +26,16 @@ Test the base_dir argument for the chunked HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py b/test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py new file mode 100644 index 0000000..b507eb1 --- /dev/null +++ b/test/Docbook/basedir/htmlchunked/htmlchunked_cmd.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the base_dir argument for the chunked HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('No xsltproc or no stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('output/index.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('output/index.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd b/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd new file mode 100644 index 0000000..d981b28 --- /dev/null +++ b/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd @@ -0,0 +1,2 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlChunked('manual', xsl='html.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/htmlhelp/htmlhelp.py b/test/Docbook/basedir/htmlhelp/htmlhelp.py index 736f732..22bbd72 100644 --- a/test/Docbook/basedir/htmlhelp/htmlhelp.py +++ b/test/Docbook/basedir/htmlhelp/htmlhelp.py @@ -26,10 +26,16 @@ Test the base_dir argument for the HTMLHELP builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py b/test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py new file mode 100644 index 0000000..a0f5e8a --- /dev/null +++ b/test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the base_dir argument for the HTMLHELP builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('No xsltproc or no stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('output/index.html')) +test.must_exist(test.workpath('htmlhelp.hhp')) +test.must_exist(test.workpath('toc.hhc')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('output/index.html')) +test.must_not_exist(test.workpath('htmlhelp.hhp')) +test.must_not_exist(test.workpath('toc.hhc')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd b/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd new file mode 100644 index 0000000..8c7c9ca --- /dev/null +++ b/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/') + diff --git a/test/Docbook/basedir/slideshtml/image/SConstruct.cmd b/test/Docbook/basedir/slideshtml/image/SConstruct.cmd new file mode 100644 index 0000000..297aeb5 --- /dev/null +++ b/test/Docbook/basedir/slideshtml/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookSlidesHtml('virt', xsl='slides.xsl', base_dir='output/') + diff --git a/test/Docbook/basedir/slideshtml/slideshtml.py b/test/Docbook/basedir/slideshtml/slideshtml.py index 505d36d..a2375e4 100644 --- a/test/Docbook/basedir/slideshtml/slideshtml.py +++ b/test/Docbook/basedir/slideshtml/slideshtml.py @@ -26,10 +26,17 @@ Test the base_dir argument for the Slides HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('Wrong OS or no "slides" stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basedir/slideshtml/slideshtml_cmd.py b/test/Docbook/basedir/slideshtml/slideshtml_cmd.py new file mode 100644 index 0000000..51ed6e4 --- /dev/null +++ b/test/Docbook/basedir/slideshtml/slideshtml_cmd.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the base_dir argument for the Slides HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('No xsltproc or no "slides" stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('output/index.html')) +test.must_exist(test.workpath('output/toc.html')) +test.must_exist(test.workpath('output/foil01.html')) +test.must_exist(test.workpath('output/foilgroup01.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('output/index.html')) +test.must_not_exist(test.workpath('output/toc.html')) +test.must_not_exist(test.workpath('output/foil01.html')) +test.must_not_exist(test.workpath('output/foilgroup01.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/epub/epub.py b/test/Docbook/basic/epub/epub.py new file mode 100644 index 0000000..19e08a0 --- /dev/null +++ b/test/Docbook/basic/epub/epub.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the EPUB builder. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +try: + import libxml2 +except: + try: + import lxml + except: + test.skip_test('Cannot find installed Python binding for libxml2 or lxml, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(stderr=None) +test.must_exist(test.workpath('manual.epub')) +test.must_exist(test.workpath('OEBPS','toc.ncx')) +test.must_exist(test.workpath('OEBPS','content.opf')) +test.must_exist(test.workpath('META-INF','container.xml')) + +# Cleanup +test.run(arguments='-c') +test.must_not_exist(test.workpath('manual.epub')) +test.must_not_exist(test.workpath('OEBPS')) +test.must_not_exist(test.workpath('META-INF')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/epub/epub_cmd.py b/test/Docbook/basic/epub/epub_cmd.py new file mode 100644 index 0000000..b79d185 --- /dev/null +++ b/test/Docbook/basic/epub/epub_cmd.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the EPUB builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('manual.epub')) +test.must_exist(test.workpath('OEBPS','toc.ncx')) +test.must_exist(test.workpath('OEBPS','content.opf')) +test.must_exist(test.workpath('META-INF','container.xml')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('manual.epub')) +test.must_not_exist(test.workpath('OEBPS')) +test.must_not_exist(test.workpath('META-INF')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/epub/image/SConstruct b/test/Docbook/basic/epub/image/SConstruct new file mode 100644 index 0000000..16a0699 --- /dev/null +++ b/test/Docbook/basic/epub/image/SConstruct @@ -0,0 +1,2 @@ +env = Environment(tools=['docbook']) +env.DocbookEpub('manual') diff --git a/test/Docbook/basic/epub/image/SConstruct.cmd b/test/Docbook/basic/epub/image/SConstruct.cmd new file mode 100644 index 0000000..27cf2c8 --- /dev/null +++ b/test/Docbook/basic/epub/image/SConstruct.cmd @@ -0,0 +1,2 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookEpub('manual') diff --git a/test/Docbook/basic/epub/image/manual.xml b/test/Docbook/basic/epub/image/manual.xml new file mode 100644 index 0000000..ca12e0e --- /dev/null +++ b/test/Docbook/basic/epub/image/manual.xml @@ -0,0 +1,388 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright (c) 2001-2010 The SCons Foundation + + 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. + +--> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" +"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<article> + <title>The SCons qt4 tool</title> + + <articleinfo> + <author> + <surname>Dirk Baechle</surname> + </author> + + <pubdate>2010-12-06</pubdate> + </articleinfo> + + <section id="basics"> + <title>Basics</title> + + <para>This tool can be used to compile Qt projects, designed for versions + 4.x.y and higher. It is not usable for Qt3 and older versions, since some + of the helper tools (<literal>moc</literal>, <literal>uic</literal>) + behave different.</para> + + <section id="install"> + <title>Install</title> + + <para>Installing it, requires you to copy (or, even better: checkout) + the contents of the package's <literal>qt4</literal> folder to</para> + + <orderedlist> + <listitem> + <para><quote><literal>/path_to_your_project/site_scons/site_tools/qt4</literal></quote>, + if you need the Qt4 Tool in one project only, or</para> + </listitem> + + <listitem> + <para><quote><literal>~/.scons/site_scons/site_tools/qt4</literal></quote>, + for a system-wide installation under your current login.</para> + </listitem> + </orderedlist> + + <para>For more infos about this, please refer to</para> + + <itemizedlist> + <listitem> + <para>the SCons User's Guide, chap. 17.7 "Where to put your custom + Builders and Tools" and</para> + </listitem> + + <listitem> + <para>the SCons Tools Wiki page at <ulink + url="http://scons.org/wiki/ToolsIndex">http://scons.org/wiki/ToolsIndex</ulink>.</para> + </listitem> + </itemizedlist> + </section> + + <section id="activation"> + <title>How to activate</title> + + <para>For activating the tool "qt4", you have to add its name to the + Environment constructor, like this</para> + + <screen>env = Environment(tools=['default','qt4']) +</screen> + + <para>On its startup, the Qt4 tool tries to read the variable + <literal>QT4DIR</literal> from the current Environment and + <literal>os.environ</literal>. If it is not set, the value of + <literal>QTDIR</literal> (in Environment/<literal>os.environ</literal>) + is used as a fallback.</para> + + <para>So, you either have to explicitly give the path of your Qt4 + installation to the Environment with</para> + + <screen>env['QT4DIR'] = '/usr/local/Trolltech/Qt-4.2.3' +</screen> + + <para>or set the <literal>QT4DIR</literal> as environment variable in + your shell.</para> + </section> + + <section id="requirements"> + <title>Requirements</title> + + <para>Under Linux, "qt4" uses the system tool + <literal>pkg-config</literal> for automatically setting the required + compile and link flags of the single Qt4 modules (like QtCore, + QtGui,...). This means that</para> + + <orderedlist> + <listitem> + <para>you should have <literal>pkg-config</literal> installed, + and</para> + </listitem> + + <listitem> + <para>you additionally have to set + <literal>PKG_CONFIG_PATH</literal> in your shell environment, such + that it points to $<literal>QT4DIR/lib/pkgconfig</literal> (or + $<literal>QT4DIR/lib</literal> for some older versions).</para> + </listitem> + </orderedlist> + + <para>Based on these two environment variables + (<literal>QT4DIR</literal> and <literal>PKG_CONFIG_PATH</literal>), the + "qt4" tool initializes all <literal>QT4_*</literal> construction + variables listed in the Reference manual. This happens when the tool is + "detected" during Environment construction. As a consequence, the setup + of the tool gets a two-stage process, if you want to override the values + provided by your current shell settings:</para> + + <screen># Stage 1: create plain environment +qtEnv = Environment() +# Set new vars +qtEnv['QT4DIR'] = '/usr/local/Trolltech/Qt-4.2.3 +qtEnv['ENV']['PKG_CONFIG_PATH'] = '/usr/local/Trolltech/Qt-4.2.3/lib/pkgconfig' +# Stage 2: add qt4 tool +qtEnv.Tool('qt4') +</screen> + </section> + </section> + + <section id="boilerplate"> + <title>Suggested boilerplate</title> + + <para>Based on the requirements above, we suggest a simple ready-to-go + setup as follows:</para> + + <para>SConstruct</para> + + <screen># Detect Qt version +qtdir = detectLatestQtDir() + +# Create base environment +baseEnv = Environment() +#...further customization of base env + +# Clone Qt environment +qtEnv = baseEnv.Clone() +# Set QT4DIR and PKG_CONFIG_PATH +qtEnv['ENV']['PKG_CONFIG_PATH'] = os.path.join(qtdir, 'lib/pkgconfig') +qtEnv['QT4DIR'] = qtdir +# Add qt4 tool +qtEnv.Tool('qt4') +#...further customization of qt env + +# Export environments +Export('baseEnv qtEnv') + +# Your other stuff... +# ...including the call to your SConscripts +</screen> + + <para>In a SConscript</para> + + <screen># Get the Qt4 environment +Import('qtEnv') +# Clone it +env = qtEnv.clone() +# Patch it +env.Append(CCFLAGS=['-m32']) # or whatever +# Use it +env.StaticLibrary('foo', Glob('*.cpp')) +</screen> + + <para>The detection of the Qt directory could be as simple as directly + assigning a fixed path</para> + + <screen>def detectLatestQtDir(): + return "/usr/local/qt4.3.2" +</screen> + + <para>or a little more sophisticated</para> + + <screen># Tries to detect the path to the installation of Qt with +# the highest version number +def detectLatestQtDir(): + if sys.platform.startswith("linux"): + # Simple check: inspect only '/usr/local/Trolltech' + paths = glob.glob('/usr/local/Trolltech/*') + if len(paths): + paths.sort() + return paths[-1] + else: + return "" + else: + # Simple check: inspect only 'C:\Qt' + paths = glob.glob('C:\\Qt\\*') + if len(paths): + paths.sort() + return paths[-1] + else: + return os.environ.get("QTDIR","") +</screen> + </section> + + <section id="firstproject"> + <title>A first project</title> + + <para>The following SConscript is for a simple project with some cxx + files, using the QtCore, QtGui and QtNetwork modules:</para> + + <screen>Import('qtEnv') +env = qtEnv.Clone() +env.EnableQt4Modules([ + 'QtGui', + 'QtCore', + 'QtNetwork' + ]) +# Add your CCFLAGS and CPPPATHs to env here... + +env.Program('foo', Glob('*.cpp')) +</screen> + </section> + + <section id="mocup"> + <title>MOC it up</title> + + <para>For the basic support of automocing, nothing needs to be done by the + user. The tool usually detects the <literal>Q_OBJECT</literal> macro and + calls the <quote><literal>moc</literal></quote> executable + accordingly.</para> + + <para>If you don't want this, you can switch off the automocing by + a</para> + + <screen>env['QT4_AUTOSCAN'] = 0 +</screen> + + <para>in your SConscript file. Then, you have to moc your files + explicitly, using the Moc4 builder.</para> + + <para>You can also switch to an extended automoc strategy with</para> + + <screen>env['QT4_AUTOSCAN_STRATEGY'] = 1 +</screen> + + <para>Please read the description of the + <literal>QT4_AUTOSCAN_STRATEGY</literal> variable in the Reference manual + for details.</para> + + <para>For debugging purposes, you can set the variable + <literal>QT4_DEBUG</literal> with</para> + + <screen>env['QT4_DEBUG'] = 1 +</screen> + + <para>which outputs a lot of messages during automocing.</para> + </section> + + <section id="forms"> + <title>Forms (.ui)</title> + + <para>The header files with setup code for your GUI classes, are not + compiled automatically from your <literal>.ui</literal> files. You always + have to call the Uic4 builder explicitly like</para> + + <screen>env.Uic4(Glob('*.ui')) +env.Program('foo', Glob('*.cpp')) +</screen> + </section> + + <section id="resources"> + <title>Resource files (.qrc)</title> + + <para>Resource files are not built automatically, you always have to add + the names of the <literal>.qrc</literal> files to the source list for your + program or library:</para> + + <screen>env.Program('foo', Glob('*.cpp')+Glob('*.qrc')) +</screen> + + <para>For each of the Resource input files, its prefix defines the name of + the resulting resource. An appropriate + <quote><literal>-name</literal></quote> option is added to the call of the + <literal>rcc</literal> executable by default.</para> + + <para>You can also call the Qrc4 builder explicitly as</para> + + <screen>qrccc = env.Qrc4('foo') # ['foo.qrc'] -> ['qrc_foo.cc'] +</screen> + + <para>or (overriding the default suffix)</para> + + <screen>qrccc = env.Qrc4('myprefix_foo.cxx','foo.qrc') # -> ['qrc_myprefix_foo.cxx'] +</screen> + + <para>and then add the resulting cxx file to the sources of your + Program/Library:</para> + + <screen>env.Program('foo', Glob('*.cpp') + qrccc) +</screen> + </section> + + <section id="translation"> + <title>Translation files</title> + + <para>The update of the <literal>.ts</literal> files and the conversion to + binary <literal>.qm</literal> files is not done automatically. You have to + call the corresponding builders on your own.</para> + + <para>Example for updating a translation file:</para> + + <screen>env.Ts4('foo.ts','.') # -> ['foo.ts'] +</screen> + + <para>By default, the <literal>.ts</literal> files are treated as + <emphasis>precious</emphasis> targets. This means that they are not + removed prior to a rebuild, but simply get updated. Additionally, they do + not get cleaned on a <quote><literal>scons -c</literal></quote>. If you + want to delete the translation files on the + <quote><literal>-c</literal></quote> SCons command, you can set the + variable <quote><literal>QT4_CLEAN_TS</literal></quote> like this</para> + + <screen>env['QT4_CLEAN_TS']=1 +</screen> + + <para>Example for releasing a translation file, i.e. compiling it to a + <literal>.qm</literal> binary file:</para> + + <screen>env.Qm4('foo') # ['foo.ts'] -> ['foo.qm'] +</screen> + + <para>or (overriding the output prefix)</para> + + <screen>env.Qm4('myprefix','foo') # ['foo.ts'] -> ['myprefix.qm'] +</screen> + + <para>As an extension both, the Ts4() and Qm4 builder, support the + definition of multiple targets. So, calling</para> + + <screen>env.Ts4(['app_en','app_de'], Glob('*.cpp')) +</screen> + + <para>and</para> + + <screen>env.Qm4(['app','copy'], Glob('*.ts')) +</screen> + + <para>should work fine.</para> + + <para>Finally, two short notes about the support of directories for the + Ts4() builder. You can pass an arbitrary mix of cxx files and subdirs to + it, as in</para> + + <screen>env.Ts4('app_en',['sub1','appwindow.cpp','main.cpp'])) +</screen> + + <para>where <literal>sub1</literal> is a folder that gets scanned + recursively for cxx files by <literal>lupdate</literal>. But like this, + you lose all dependency information for the subdir, i.e. if a file inside + the folder changes, the .ts file is not updated automatically! In this + case you should tell SCons to always update the target:</para> + + <screen>ts = env.Ts4('app_en',['sub1','appwindow.cpp','main.cpp']) +env.AlwaysBuild(ts) +</screen> + + <para>Last note: specifying the current folder + <quote><literal>.</literal></quote> as input to Ts4() and storing the + resulting .ts file in the same directory, leads to a dependency cycle! You + then have to store the .ts and .qm files outside of the current folder, or + use <literal>Glob('*.cpp'))</literal> instead.</para> + </section> +</article> diff --git a/test/Docbook/basic/html/html_cmd.py b/test/Docbook/basic/html/html_cmd.py new file mode 100644 index 0000000..acb4dad --- /dev/null +++ b/test/Docbook/basic/html/html_cmd.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the HTML builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd']) +test.must_exist(test.workpath('manual.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('manual.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/html/image/SConstruct.cmd b/test/Docbook/basic/html/image/SConstruct.cmd new file mode 100644 index 0000000..20b4aa2 --- /dev/null +++ b/test/Docbook/basic/html/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtml('manual') + diff --git a/test/Docbook/basic/htmlchunked/htmlchunked_cmd.py b/test/Docbook/basic/htmlchunked/htmlchunked_cmd.py new file mode 100644 index 0000000..e1ad49a --- /dev/null +++ b/test/Docbook/basic/htmlchunked/htmlchunked_cmd.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the chunked HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('index.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('index.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/htmlchunked/image/SConstruct.cmd b/test/Docbook/basic/htmlchunked/image/SConstruct.cmd new file mode 100644 index 0000000..e2406f2 --- /dev/null +++ b/test/Docbook/basic/htmlchunked/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlChunked('manual') + diff --git a/test/Docbook/basic/htmlhelp/htmlhelp_cmd.py b/test/Docbook/basic/htmlhelp/htmlhelp_cmd.py new file mode 100644 index 0000000..8e1c1b6 --- /dev/null +++ b/test/Docbook/basic/htmlhelp/htmlhelp_cmd.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the HTMLHELP builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('index.html')) +test.must_exist(test.workpath('htmlhelp.hhp')) +test.must_exist(test.workpath('toc.hhc')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('index.html')) +test.must_not_exist(test.workpath('htmlhelp.hhp')) +test.must_not_exist(test.workpath('toc.hhc')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/htmlhelp/image/SConstruct.cmd b/test/Docbook/basic/htmlhelp/image/SConstruct.cmd new file mode 100644 index 0000000..29fb4fa --- /dev/null +++ b/test/Docbook/basic/htmlhelp/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookHtmlhelp('manual') + diff --git a/test/Docbook/basic/man/image/SConstruct.cmd b/test/Docbook/basic/man/image/SConstruct.cmd new file mode 100644 index 0000000..8b1406b --- /dev/null +++ b/test/Docbook/basic/man/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookMan('refdb') + diff --git a/test/Docbook/basic/man/man_cmd.py b/test/Docbook/basic/man/man_cmd.py new file mode 100644 index 0000000..f5127e3 --- /dev/null +++ b/test/Docbook/basic/man/man_cmd.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the Man builder while using +the xsltproc executable, if it exists. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not xsltproc: + test.skip_test('No xsltproc executable found, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('refdb.8')) +test.must_exist(test.workpath('refdb.sh.8')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('refdb.8')) +test.must_not_exist(test.workpath('refdb.sh.8')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/basic/slideshtml/image/SConstruct.cmd b/test/Docbook/basic/slideshtml/image/SConstruct.cmd new file mode 100644 index 0000000..133cb11 --- /dev/null +++ b/test/Docbook/basic/slideshtml/image/SConstruct.cmd @@ -0,0 +1,3 @@ +env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) +env.DocbookSlidesHtml('virt') + diff --git a/test/Docbook/basic/slideshtml/slideshtml.py b/test/Docbook/basic/slideshtml/slideshtml.py index d4636d4..37c2be0 100644 --- a/test/Docbook/basic/slideshtml/slideshtml.py +++ b/test/Docbook/basic/slideshtml/slideshtml.py @@ -26,10 +26,17 @@ Test the Slides HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('Wrong OS or no "slides" stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/basic/slideshtml/slideshtml_cmd.py b/test/Docbook/basic/slideshtml/slideshtml_cmd.py new file mode 100644 index 0000000..ce5c30b --- /dev/null +++ b/test/Docbook/basic/slideshtml/slideshtml_cmd.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001-2010 The SCons Foundation +# +# 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. +# + +""" +Test the Slides HTML builder while using +the xsltproc executable, if it exists. +""" + +import os +import sys +import TestSCons + +test = TestSCons.TestSCons() + +xsltproc = test.where_is('xsltproc') +if not (xsltproc and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('No xsltproc executable or no "slides" stylesheets installed, skipping test.\n') + +test.dir_fixture('image') + +# Normal invocation +test.run(arguments=['-f','SConstruct.cmd'], stderr=None) +test.must_exist(test.workpath('index.html')) +test.must_exist(test.workpath('toc.html')) +test.must_exist(test.workpath('foil01.html')) +test.must_exist(test.workpath('foilgroup01.html')) + +# Cleanup +test.run(arguments=['-f','SConstruct.cmd','-c']) +test.must_not_exist(test.workpath('index.html')) +test.must_not_exist(test.workpath('toc.html')) +test.must_not_exist(test.workpath('foil01.html')) +test.must_not_exist(test.workpath('foilgroup01.html')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Docbook/rootname/htmlchunked/htmlchunked.py b/test/Docbook/rootname/htmlchunked/htmlchunked.py index 2489019..8ab91d2 100644 --- a/test/Docbook/rootname/htmlchunked/htmlchunked.py +++ b/test/Docbook/rootname/htmlchunked/htmlchunked.py @@ -26,10 +26,16 @@ Test the root.name argument for the chunked HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/rootname/htmlhelp/htmlhelp.py b/test/Docbook/rootname/htmlhelp/htmlhelp.py index 84be5d9..ee37e1a 100644 --- a/test/Docbook/rootname/htmlhelp/htmlhelp.py +++ b/test/Docbook/rootname/htmlhelp/htmlhelp.py @@ -26,10 +26,16 @@ Test the root.name argument for the HTMLHELP builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl')): + test.skip_test('Wrong OS or no stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Docbook/rootname/slideshtml/slideshtml.py b/test/Docbook/rootname/slideshtml/slideshtml.py index c316ada..4d55035 100644 --- a/test/Docbook/rootname/slideshtml/slideshtml.py +++ b/test/Docbook/rootname/slideshtml/slideshtml.py @@ -26,10 +26,17 @@ Test the root.name argument for the Slides HTML builder. """ +import os +import sys import TestSCons test = TestSCons.TestSCons() +if not (sys.platform.startswith('linux') and + os.path.isdir('/usr/share/xml/docbook/stylesheet/docbook-xsl/slides') and + os.path.isdir('/usr/share/xml/docbook/custom/slides/3.3.1')): + test.skip_test('Wrong OS or no "slides" stylesheets installed, skipping test.\n') + try: import libxml2 except: diff --git a/test/Ghostscript/GS.py b/test/Ghostscript/GS.py index 2cae8b8..daeea09 100644 --- a/test/Ghostscript/GS.py +++ b/test/Ghostscript/GS.py @@ -51,6 +51,7 @@ env = Environment(GS = r'%(_python_)s mygs.py', GSCOM = r'$GS $TARGET $SOURCE', tools=['gs']) env.PDF(target = 'test1.pdf', source = 'test1.ps') +env.Gs(target = 'test2.pdf', source = 'test1.ps') """ % locals()) test.write('test1.ps', r"""This is a .ps test. @@ -60,6 +61,7 @@ test.write('test1.ps', r"""This is a .ps test. test.run(arguments = '.', stderr = None) test.fail_test(test.read('test1.pdf') != "This is a .ps test.\n") +test.fail_test(test.read('test2.pdf') != "This is a .ps test.\n") diff --git a/test/Libs/SharedLibrary-update-deps.py b/test/Libs/SharedLibrary-update-deps.py new file mode 100644 index 0000000..5394bc7 --- /dev/null +++ b/test/Libs/SharedLibrary-update-deps.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__" + +""" +Test that SharedLibrary() updates when a different lib is linked, even if it has the same md5. +This is Tigris bug #2903. +""" + +import sys +import os.path +import TestSCons + +test = TestSCons.TestSCons() + +test.dir_fixture( "bug2903" ) + +# Build the sub-libs (don't care about details of this) +test.run(arguments='-f SConstruct-libs') + +# This should build the main lib, using libfoo.so +test.run(arguments='libname=foo') +# This should rebuild the main lib, using libbar.so; +# it should NOT say it's already up to date. +test.run(arguments='libname=bar') +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) +# Try it again, in reverse, to make sure: +test.run(arguments='libname=foo') +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) + +# Now try changing the link command line (in an innocuous way); should rebuild. +if sys.platform == 'win32': + extraflags='shlinkflags=/DEBUG' +else: + extraflags='shlinkflags=-g' + +test.run(arguments=['libname=foo', extraflags]) +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) +test.run(arguments=['libname=foo', extraflags, '--debug=explain']) +test.must_contain_all_lines(test.stdout(), ["is up to date"]) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Libs/SharedLibrary.py b/test/Libs/SharedLibrary.py index b7d1374..eac575c 100644 --- a/test/Libs/SharedLibrary.py +++ b/test/Libs/SharedLibrary.py @@ -60,6 +60,13 @@ obj = env.SharedObject('bar', 'foo.c') Default(env.Library(target = 'foo', source = obj)) """) +test.write('SConstructBaz', """ +env=Environment() +env['SHLIBVERSION'] = '1.0.0' +obj = env.SharedObject('baz', 'foo.c') +Default(env.SharedLibrary(target = 'baz', source = obj)) +""") + test.write('foo.c', r""" #include <stdio.h> @@ -287,6 +294,12 @@ main(int argc, char *argv[]) test.run(program = test.workpath('progbar'), stdout = "f4.c\nprogbar.c\n") +if sys.platform.startswith('openbsd'): + # Make sure we don't link libraries with -Wl,-soname on OpenBSD. + test.run(arguments = '-f SConstructBaz') + for line in test.stdout().split('\n'): + test.fail_test(line.find('-Wl,-soname=libbaz.so') != -1) + test.pass_test() # Local Variables: diff --git a/test/Libs/bug2903/SConstruct b/test/Libs/bug2903/SConstruct new file mode 100644 index 0000000..12919ce --- /dev/null +++ b/test/Libs/bug2903/SConstruct @@ -0,0 +1,13 @@ +# SConstruct for testing but #2903. +# The test changes the lib name to make sure it rebuilds +# when the name changes, even if the content of the lib is the same. +# Also, the test passes in extra shlinkflags to ensure things rebuild +# when other linker options change, and not when they don't. +# (This doesn't specifically test LIBPATH, but there's a test for +# that already.) +env=Environment() +libname=ARGUMENTS.get('libname', 'foo') +env.Append(SHLINKFLAGS=' $EXTRA_SHLINKFLAGS') +shlinkflags=ARGUMENTS.get('shlinkflags', '') +env.SharedLibrary('myshared', ['main.c'], + LIBS=[libname], LIBPATH='.', EXTRA_SHLINKFLAGS=shlinkflags) diff --git a/test/Libs/bug2903/SConstruct-libs b/test/Libs/bug2903/SConstruct-libs new file mode 100644 index 0000000..1590062 --- /dev/null +++ b/test/Libs/bug2903/SConstruct-libs @@ -0,0 +1,5 @@ +env=Environment() +libfoo = env.SharedLibrary('foo', 'lib.c') +env.InstallAs('${SHLIBPREFIX}bar${SHLIBSUFFIX}', libfoo[0]) +if len(libfoo) > 1: # on Windows, there's an import lib (also a .exp, but we don't want that) + env.InstallAs('${LIBPREFIX}bar${LIBSUFFIX}', libfoo[1]) diff --git a/test/Libs/bug2903/lib.c b/test/Libs/bug2903/lib.c new file mode 100644 index 0000000..65f4cd2 --- /dev/null +++ b/test/Libs/bug2903/lib.c @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int i; diff --git a/test/Libs/bug2903/main.c b/test/Libs/bug2903/main.c new file mode 100644 index 0000000..a4b1ecc --- /dev/null +++ b/test/Libs/bug2903/main.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +void func() +{ +} diff --git a/test/Pseudo.py b/test/Pseudo.py new file mode 100644 index 0000000..db3c30c --- /dev/null +++ b/test/Pseudo.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__" + +import TestSCons + +test = TestSCons.TestSCons() + +# Firstly, build a pseudo target and make sure we get no warnings it +# doesn't exist under any circumstances +test.write('SConstruct', """ +env = Environment() +env.Pseudo(env.Command('foo.out', [], '@echo boo')) +""") + +test.run(arguments='-Q', stdout = 'boo\n') + +test.run(arguments='-Q --warning=target-not-built', stdout = "boo\n") + +# Now do the same thing again but create the target and check we get an +# error if it exists after the build +test.write('SConstruct', """ +env = Environment() +env.Pseudo(env.Command('foo.out', [], Touch('$TARGET'))) +""") + +test.run(arguments='-Q', stdout = 'Touch("foo.out")\n', stderr = None, + status = 2) +test.must_contain_all_lines(test.stderr(), + 'scons: *** Pseudo target foo.out must not exist') +test.run(arguments='-Q --warning=target-not-built', + stdout = 'Touch("foo.out")\n', + stderr = None, status = 2) +test.must_contain_all_lines(test.stderr(), + 'scons: *** Pseudo target foo.out must not exist') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/builderrors.py b/test/builderrors.py index 0133107..3d443bf 100644 --- a/test/builderrors.py +++ b/test/builderrors.py @@ -107,9 +107,6 @@ test.fail_test(os.path.exists(test.workpath('f3.out'))) test.write('SConstruct', """ env=Environment() -if env['PLATFORM'] == 'posix': - from SCons.Platform.posix import fork_spawn - env['SPAWN'] = fork_spawn env['ENV']['PATH'] = '' env.Command(target='foo.out', source=[], action='not_a_program') """) @@ -123,9 +120,6 @@ test.must_not_contain_any_line(test.stderr(), ['Exception', 'Traceback']) long_cmd = 'xyz ' + "foobarxyz" * 100000 test.write('SConstruct', """ env=Environment() -if env['PLATFORM'] == 'posix': - from SCons.Platform.posix import fork_spawn - env['SPAWN'] = fork_spawn env.Command(target='longcmd.out', source=[], action='echo %s') """%long_cmd) @@ -147,9 +141,6 @@ test.must_not_contain_any_line(test.stderr(), ['Exception', 'Traceback']) # with error "Permission denied" or "No such file or directory". test.write('SConstruct', """ env=Environment() -if env['PLATFORM'] in ('posix', 'darwin'): - from SCons.Platform.posix import fork_spawn - env['SPAWN'] = fork_spawn env['SHELL'] = 'one' env.Command(target='badshell.out', source=[], action='foo') """) @@ -191,7 +182,7 @@ env2.Install("target", "dir2/myFile") def print_build_failures(): from SCons.Script import GetBuildFailures for bf in GetBuildFailures(): - print bf.action + print bf.action atexit.register(print_build_failures) """) diff --git a/test/leaky-handles.py b/test/leaky-handles.py new file mode 100644 index 0000000..9502d1b --- /dev/null +++ b/test/leaky-handles.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify that file handles aren't leaked to child processes +""" + +import os + +import TestSCons + +test = TestSCons.TestSCons() + +if os.name != 'posix': + msg = "Skipping fork leak test on non-posix platform '%s'\n" % os.name + test.skip_test(msg) + +test.write('SConstruct', """ + +#Leak a file handle +open('/dev/null') + +#Check it gets closed +test2 = Command('test2', [], '@ls /proc/$$$$/fd|wc -l') +""") + +# In theory that should have 3 lines (handles 0/1/2). This is v. unix specific + +test.run(arguments = '-Q', stdout='3\n') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/option/debug-multiple.py b/test/option/debug-multiple.py new file mode 100644 index 0000000..f5bbdf0 --- /dev/null +++ b/test/option/debug-multiple.py @@ -0,0 +1,86 @@ +#!/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 --debug can take multiple options +""" + +import re + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +def cat(target, source, env): + open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read()) +env = Environment(BUILDERS={'Cat':Builder(action=Action(cat))}) +env.Cat('file.out', 'file.in') +""") + +test.write('file.in', "file.in\n") + +# Just check that object counts for some representative classes +# show up in the output. + +def find_object_count(s, stdout): + re_string = '\d+ +\d+ %s' % re.escape(s) + return re.search(re_string, stdout) + +objects = [ + 'Action.CommandAction', + 'Builder.BuilderBase', + 'Environment.Base', + 'Executor.Executor', + 'Node.FS', + 'Node.FS.Base', + 'Node.Node', +] + +for args in ['--debug=prepare,count', '--debug=count,prepare']: + test.run(arguments = args) + stdout = test.stdout() + missing = [o for o in objects if find_object_count(o, stdout) is None] + + if missing: + print "Missing the following object lines from '%s' output:" % args + print "\t", ' '.join(missing) + print "STDOUT ==========" + print stdout + test.fail_test(1) + + if 'Preparing target file.out...' not in stdout: + print "Missing 'Preparing' lines from '%s' output:" % args + print "STDOUT ==========" + print stdout + test.fail_test(1) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/option/warn-dependency.py b/test/option/warn-dependency.py index 95d8fed..ca0c2aa 100644 --- a/test/option/warn-dependency.py +++ b/test/option/warn-dependency.py @@ -43,6 +43,7 @@ env=Environment() env['BUILDERS']['test'] = Builder(action=build, source_scanner=SCons.Defaults.ObjSourceScan) env.test(target='foo', source='foo.c') +env.Pseudo('foo') """) test.write("foo.c",""" diff --git a/test/warning-TargetNotBuiltWarning.py b/test/warning-TargetNotBuiltWarning.py new file mode 100644 index 0000000..76fdc5c --- /dev/null +++ b/test/warning-TargetNotBuiltWarning.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +foo = Command('foo.out', [], '@echo boo') +bill = Command('bill.out', [], Touch('$TARGET')) +Depends(bill, foo) +Alias('jim', bill) +""") + +test.run(arguments='-Q jim', stdout = 'boo\nTouch("bill.out")\n') + +test.run(arguments='-Q jim --warning=target-not-built', + stdout = "boo\nscons: `jim' is up to date.\n", + stderr = None) +test.must_contain_all_lines(test.stderr(), + 'scons: warning: Cannot find target foo.out after building') + +test.run(arguments='-Q jim --warning=target-not-built -n', + stdout = "scons: `jim' is up to date.\n") + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |