5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test Environment's FindSourceFiles method.
34 test
= TestSCons
.TestSCons()
36 package_format
= "src_tarbz2"
37 if not test
.where_is('tar') or sys
.platform
== 'win32':
38 if not test
.where_is('zip'):
39 test
.skip_test("neither 'tar' nor 'zip' found; skipping test\n")
40 package_format
= "src_zip"
42 # Quite complex, but real-life test.
43 # 0. Setup VariantDir, "var", without duplication. The "src" is source dir.
44 # 1. Generate souce file var/foo.c from src/foo.c.in. Define program foo.
45 # 2. Gather all sources necessary to create '.' node and create source
46 # tarball. We expect 'src/foo.c.in' file within tarball, and no content
47 # under 'var' directory.
50 test
.write('SConstruct', """
51 VariantDir(src_dir = 'src', variant_dir = 'var', duplicate = 0)
52 env = Environment(tools = ['default','textfile','packaging'])
53 SConscript(['var/SConscript'], exports = 'env')
54 sources = env.FindSourceFiles('.')
55 pkg = env.Package( NAME = 'foo', VERSION = '1.0', PACKAGETYPE = '%s',
60 test
.write('src/SConscript', """
62 foo_c = env.Substfile('foo.c.in', SUBST_DICT = {'__A__' : '0' })
63 foo = env.Program(foo_c)
66 test
.write('src/foo.c.in', """ int main(void) { return __A__;}
69 test
.run(arguments
= 'package')
71 test
.must_exist('foo-1.0/src/SConscript')
72 test
.must_exist('foo-1.0/src/foo.c.in')
73 test
.must_not_exist('foo-1.0/var/SConscript')
74 test
.must_not_exist('foo-1.0/var/foo.c.in')
80 # indent-tabs-mode:nil
82 # vim: set expandtab tabstop=4 shiftwidth=4: