diff options
author | Mats Wichmann <mats@linux.com> | 2020-12-04 08:50:24 -0700 |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-12-04 09:00:28 -0700 |
commit | 2f6a933a155121093e5427fab7e82cefe0cbe6ab (patch) | |
tree | cd0e82d2867251830fe04cc2fce129dcbb84c422 /test/SConsignFile | |
parent | 17097d79ac67adff904deae714ec024f497efcdd (diff) | |
download | scons-git-2f6a933a155121093e5427fab7e82cefe0cbe6ab.tar.gz |
[PR #3836] add example of SConsign(dbm_modue=...) (skip appveyor)
It wasn't clear that you need to pass the module name to
SConsignFile, the expectation might be to pass a string,
so clarified and an example added to show it.
Some of the wording was simplified a bit.
Added a testcase of explicity passing dbm_module=SCons.dblite,
as this should work.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/SConsignFile')
-rw-r--r-- | test/SConsignFile/explicit-dbm-module.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/SConsignFile/explicit-dbm-module.py b/test/SConsignFile/explicit-dbm-module.py new file mode 100644 index 000000000..09b75aef7 --- /dev/null +++ b/test/SConsignFile/explicit-dbm-module.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# +# MIT License +# +# Copyright 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. + +"""Verify SConsignFile() when used with explicit SCons.dblite.""" + +import os.path + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +import SCons.dblite +use_db = 'SCons.dblite' + +test.subdir('subdir') + +test.write('build.py', r""" +import sys +with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp: + ofp.write(ifp.read()) +sys.exit(0) +""") + +test.write('SConstruct', """ +import %(use_db)s +SConsignFile(dbm_module=%(use_db)s) +B = Builder(action=r'%(_python_)s build.py $TARGETS $SOURCES') +DefaultEnvironment(tools=[]) +env = Environment(BUILDERS={'B': B}, tools=[]) +env.B(target='f1.out', source='f1.in') +env.B(target='f2.out', source='f2.in') +env.B(target='subdir/f3.out', source='subdir/f3.in') +env.B(target='subdir/f4.out', source='subdir/f4.in') +""" % locals()) + +test.write('f1.in', "f1.in\n") +test.write('f2.in', "f2.in\n") +test.write(['subdir', 'f3.in'], "subdir/f3.in\n") +test.write(['subdir', 'f4.in'], "subdir/f4.in\n") + +test.run() + +test.must_exist(test.workpath('.sconsign.dblite')) +test.must_not_exist(test.workpath('.sconsign')) +test.must_not_exist(test.workpath('subdir', '.sconsign')) + +test.must_match('f1.out', "f1.in\n") +test.must_match('f2.out', "f2.in\n") +test.must_match(['subdir', 'f3.out'], "subdir/f3.in\n") +test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") + +test.up_to_date(arguments='.') + +test.must_exist(test.workpath('.sconsign.dblite')) +test.must_not_exist(test.workpath('.sconsign')) +test.must_not_exist(test.workpath('subdir', '.sconsign')) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |