__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
-Test that files are correctly located in the build directory even when
+Test that files are correctly located in the variant directory even when
Scons does not have a global view of all targets.
Sometimes, it might be interesting to not tell scons about every
a subset of the targets need to be rebuilt.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
test.subdir('dir2')
test.write('SConstruct', """\
-opts = Options()
-opts.AddOptions(
- BoolOption('view_all_dependencies', 'View all dependencies', True),
- BoolOption('duplicate', 'Duplicate sources to build dir', True)
+opts = Variables()
+opts.AddVariables(
+ BoolVariable('view_all_dependencies', 'View all dependencies', True),
+ BoolVariable('duplicate', 'Duplicate sources to variant dir', True)
)
env = Environment(options=opts)
Export('env')
-SConscript(dirs='.', build_dir='build', duplicate=env['duplicate'])
+SConscript(dirs='.', variant_dir='build', duplicate=env['duplicate'])
""" % locals())
# Build everything first.
test.run(arguments = 'duplicate=False view_all_dependencies=True .')
test.must_exist('build/dir1/x.cpp')
-test.fail_test(string.find(test.stdout(), "`.' is up to date.") != -1)
+test.must_not_contain_any_line(test.stdout(), ["`.' is up to date."])
# Double check that targets are not rebuilt.
test.run(arguments = 'duplicate=False view_all_dependencies=True .')
test.must_exist('build/dir1/x.cpp')
-test.fail_test(string.find(test.stdout(), "`.' is up to date.") == -1)
+test.must_contain_all_lines(test.stdout(), ["`.' is up to date."])
# Clean-up only the object file
test.run(arguments = 'duplicate=False view_all_dependencies=False -c .')
# Rebuild the only object file without seeing all the dependencies.
test.run(arguments = 'duplicate=False view_all_dependencies=False .')
test.must_exist('build/dir1/x.cpp')
-test.fail_test(string.find(test.stdout(), "`.' is up to date.") != -1)
+test.must_not_contain_any_line(test.stdout(), ["`.' is up to date."])
# Double check that targets are not rebuilt without and with all the
# dependencies.
test.run(arguments = 'duplicate=False view_all_dependencies=False .')
test.must_exist('build/dir1/x.cpp')
-test.fail_test(string.find(test.stdout(), "`.' is up to date.") == -1)
+test.must_contain_all_lines(test.stdout(), ["`.' is up to date."])
test.run(arguments = 'duplicate=False view_all_dependencies=True .')
test.must_exist('build/dir1/x.cpp')
-test.fail_test(string.find(test.stdout(), "`.' is up to date.") == -1)
+test.must_contain_all_lines(test.stdout(), ["`.' is up to date."])
# Clean-up everything.
test.run(arguments = 'duplicate=False view_all_dependencies=True -c .')
# # Build everything first.
# test.run(arguments = 'duplicate=True view_all_dependencies=True .')
# test.must_exist('build/dir1/x.cpp')
-# test.fail_test(string.find(test.stdout(), "`.' is up to date.") != -1)
+# test.must_not_contain_any_line(test.stdout(), ["`.' is up to date."])
# # Double check that targets are not rebuilt.
# test.run(arguments = 'duplicate=True view_all_dependencies=True .')
# test.must_exist('build/dir1/x.cpp')
-# test.fail_test(string.find(test.stdout(), "`.' is up to date.") == -1)
+# test.must_contain_all_lines(test.stdout(), ["`.' is up to date."])
# # Clean-up only the object file
# test.run(arguments = 'duplicate=True view_all_dependencies=False -c .')
# # Rebuild the only object file without seeing all the dependencies.
# test.run(arguments = 'duplicate=True view_all_dependencies=False .')
# test.must_exist('build/dir1/x.cpp')
-# test.fail_test(string.find(test.stdout(), "`.' is up to date.") != -1)
+# test.must_not_contain_any_line(test.stdout(), ["`.' is up to date."])
# # Double check that targets are not rebuilt without and with all the
# # dependencies.
# test.run(arguments = 'duplicate=True view_all_dependencies=False .')
# test.must_exist('build/dir1/x.cpp')
-# test.fail_test(string.find(test.stdout(), "`.' is up to date.") == -1)
+# test.must_contain_all_lines(test.stdout(), ["`.' is up to date."])
# test.run(arguments = 'duplicate=True view_all_dependencies=True .')
# test.must_exist('build/dir1/x.cpp')
-# test.fail_test(string.find(test.stdout(), "`.' is up to date.") == -1)
+# test.must_contain_all_lines(test.stdout(), ["`.' is up to date."])
# # Clean-up everything.
# test.run(arguments = 'duplicate=True view_all_dependencies=True -c .')
test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: