From 9c4e6c7a303047e4b26e58af749508f7e254ae89 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 20 Oct 2019 10:13:32 -0600 Subject: Remove deprecated {Source,Target}Signatures These two have been deprecated since 2010 (about SCons 2.0), commit 935e6985. Methods are removed, setoption for setting them removed, doc is removed, tests are migrated to test/Removed/*/Old with a sconstest.skip file so they don't run, and two new tests are added to confirm that using the functions and setoptions generate exceptions. Signed-off-by: Mats Wichmann --- doc/man/scons.xml | 21 -- doc/scons.mod | 3 - doc/user/depends.xml | 178 --------------- src/CHANGES.txt | 1 + src/engine/SCons/Environment.py | 59 +---- src/engine/SCons/Environment.xml | 252 --------------------- src/engine/SCons/EnvironmentTests.py | 91 -------- src/engine/SCons/Script/__init__.py | 2 - src/engine/SCons/Warnings.py | 6 - test/Deprecated/CacheDir/timestamp-content.py | 68 ------ test/Deprecated/CacheDir/timestamp-timestamp.py | 68 ------ test/Deprecated/SourceSignatures/basic.py | 131 ----------- test/Deprecated/SourceSignatures/env.py | 109 --------- test/Deprecated/SourceSignatures/implicit-cache.py | 105 --------- test/Deprecated/SourceSignatures/no-csigs.py | 81 ------- test/Deprecated/SourceSignatures/overrides.py | 68 ------ test/Deprecated/SourceSignatures/switch-rebuild.py | 96 -------- test/Deprecated/TargetSignatures/build-content.py | 142 ------------ test/Deprecated/TargetSignatures/content.py | 95 -------- test/Deprecated/TargetSignatures/overrides.py | 64 ------ test/Removed/CacheDir/Old/sconstest.skip | 0 test/Removed/CacheDir/Old/timestamp-content.py | 68 ++++++ test/Removed/CacheDir/Old/timestamp-timestamp.py | 68 ++++++ test/Removed/CacheDir/README.md | 4 + test/Removed/SourceSignatures/Old/basic.py | 131 +++++++++++ test/Removed/SourceSignatures/Old/env.py | 109 +++++++++ .../Removed/SourceSignatures/Old/implicit-cache.py | 105 +++++++++ test/Removed/SourceSignatures/Old/no-csigs.py | 81 +++++++ test/Removed/SourceSignatures/Old/overrides.py | 68 ++++++ test/Removed/SourceSignatures/Old/sconstest.skip | 0 .../Removed/SourceSignatures/Old/switch-rebuild.py | 96 ++++++++ test/Removed/SourceSignatures/README.md | 6 + test/Removed/SourceSignatures/SConstruct.method | 1 + test/Removed/SourceSignatures/SConstruct.setopt | 1 + test/Removed/SourceSignatures/SourceSignatures.py | 52 +++++ test/Removed/TargetSignatures/Old/build-content.py | 142 ++++++++++++ test/Removed/TargetSignatures/Old/content.py | 95 ++++++++ test/Removed/TargetSignatures/Old/overrides.py | 64 ++++++ test/Removed/TargetSignatures/Old/sconstest.skip | 0 test/Removed/TargetSignatures/README.md | 6 + test/Removed/TargetSignatures/SConstruct.method | 1 + test/Removed/TargetSignatures/SConstruct.setopt | 1 + test/Removed/TargetSignatures/TargetSignatures.py | 52 +++++ test/implicit-cache/basic.py | 7 +- test/sconsign/script/Signatures.py | 3 - test/srcchange.py | 5 +- test/subdivide.py | 5 +- 47 files changed, 1165 insertions(+), 1646 deletions(-) delete mode 100644 test/Deprecated/CacheDir/timestamp-content.py delete mode 100644 test/Deprecated/CacheDir/timestamp-timestamp.py delete mode 100644 test/Deprecated/SourceSignatures/basic.py delete mode 100644 test/Deprecated/SourceSignatures/env.py delete mode 100644 test/Deprecated/SourceSignatures/implicit-cache.py delete mode 100644 test/Deprecated/SourceSignatures/no-csigs.py delete mode 100644 test/Deprecated/SourceSignatures/overrides.py delete mode 100644 test/Deprecated/SourceSignatures/switch-rebuild.py delete mode 100644 test/Deprecated/TargetSignatures/build-content.py delete mode 100644 test/Deprecated/TargetSignatures/content.py delete mode 100644 test/Deprecated/TargetSignatures/overrides.py create mode 100644 test/Removed/CacheDir/Old/sconstest.skip create mode 100644 test/Removed/CacheDir/Old/timestamp-content.py create mode 100644 test/Removed/CacheDir/Old/timestamp-timestamp.py create mode 100644 test/Removed/CacheDir/README.md create mode 100644 test/Removed/SourceSignatures/Old/basic.py create mode 100644 test/Removed/SourceSignatures/Old/env.py create mode 100644 test/Removed/SourceSignatures/Old/implicit-cache.py create mode 100644 test/Removed/SourceSignatures/Old/no-csigs.py create mode 100644 test/Removed/SourceSignatures/Old/overrides.py create mode 100644 test/Removed/SourceSignatures/Old/sconstest.skip create mode 100644 test/Removed/SourceSignatures/Old/switch-rebuild.py create mode 100644 test/Removed/SourceSignatures/README.md create mode 100644 test/Removed/SourceSignatures/SConstruct.method create mode 100644 test/Removed/SourceSignatures/SConstruct.setopt create mode 100644 test/Removed/SourceSignatures/SourceSignatures.py create mode 100644 test/Removed/TargetSignatures/Old/build-content.py create mode 100644 test/Removed/TargetSignatures/Old/content.py create mode 100644 test/Removed/TargetSignatures/Old/overrides.py create mode 100644 test/Removed/TargetSignatures/Old/sconstest.skip create mode 100644 test/Removed/TargetSignatures/README.md create mode 100644 test/Removed/TargetSignatures/SConstruct.method create mode 100644 test/Removed/TargetSignatures/SConstruct.setopt create mode 100644 test/Removed/TargetSignatures/TargetSignatures.py diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 95278e6..a9e0dd7 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -1827,27 +1827,6 @@ method. - - --warn=deprecated-source-signatures, --warn=no-deprecated-source-signatures - -Enables or disables warnings about use of the deprecated -SourceSignatures() -function or -env.SourceSignatures() -method. - - - - - --warn=deprecated-target-signatures, --warn=no-deprecated-target-signatures - -Enables or disables warnings about use of the deprecated -TargetSignatures() -function or -env.TargetSignatures() -method. - - diff --git a/doc/scons.mod b/doc/scons.mod index 71e996d..3e843a0 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -260,11 +260,8 @@ SetDefault"> SetOption"> SideEffect"> -SourceSignature"> -SourceSignatures"> Split"> Tag"> -TargetSignatures"> Task"> Touch"> UnknownOptions"> diff --git a/doc/user/depends.xml b/doc/user/depends.xml index 7947900..5a78eb5 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -765,184 +765,6 @@ int main() { printf("Hello, world!\n"); } -
- The &SourceSignatures; Function - - - - The &SourceSignatures; function is fairly straightforward, - and supports two different argument values - to configure whether source file changes should be decided - using MD5 signatures: - - - - -Program('hello.c') -SourceSignatures('MD5') - - - - - Or using time stamps: - - - - -Program('hello.c') -SourceSignatures('timestamp') - - - - - These are roughly equivalent to specifying - Decider('MD5') - or - Decider('timestamp-match'), - respectively, - although it only affects how SCons makes - decisions about dependencies on - source files--that is, - files that are not built from any other files. - - - -
- -
- The &TargetSignatures; Function - - - - The &TargetSignatures; function - specifies how &SCons; decides - when a target file has changed - when it is used as a - dependency of (input to) another target--that is, - the &TargetSignatures; function configures - how the signatures of "intermediate" target files - are used when deciding if a "downstream" target file - must be rebuilt. - - This easily-overlooked distinction between - how &SCons; decides if the target itself must be rebuilt - and how the target is then used to decide if a different - target must be rebuilt is one of the confusing - things that has led to the &TargetSignatures; - and &SourceSignatures; functions being - replaced by the simpler &Decider; function. - - - - - - - The &TargetSignatures; function supports the same - 'MD5' and 'timestamp' - argument values that are supported by the &SourceSignatures;, - with the same meanings, but applied to target files. - That is, in the example: - - - - -Program('hello.c') -TargetSignatures('MD5') - - - - - The MD5 checksum of the &hello_o; target file - will be used to decide if it has changed since the last - time the "downstream" &hello; target file was built. - And in the example: - - - - -Program('hello.c') -TargetSignatures('timestamp') - - - - - The modification time of the &hello_o; target file - will be used to decide if it has changed since the last - time the "downstream" &hello; target file was built. - - - - - - The &TargetSignatures; function supports - two additional argument values: - 'source' and 'build'. - The 'source' argument - specifies that decisions involving - whether target files have changed - since a previous build - should use the same behavior - for the decisions configured for source files - (using the &SourceSignatures; function). - So in the example: - - - - -Program('hello.c') -TargetSignatures('source') -SourceSignatures('timestamp') - - - - - All files, both targets and sources, - will use modification times - when deciding if an input file - has changed since the last - time a target was built. - - - - - - Lastly, the 'build' argument - specifies that &SCons; should examine - the build status of a target file - and always rebuild a "downstream" target - if the target file was itself rebuilt, - without re-examining the contents or timestamp - of the newly-built target file. - If the target file was not rebuilt during - this &scons; invocation, - then the target file will be examined - the same way as configured by - the &SourceSignature; call - to decide if it has changed. - - - - - - This mimics the behavior of - build signatures - in earlier versions of &SCons;. - A &buildsignature; re-combined - signatures of all the input files - that went into making the target file, - so that the target file itself - did not need to have its contents read - to compute an MD5 signature. - This can improve performance for some configurations, - but is generally not as effective as using - Decider('MD5-timestamp'). - - - -
- - -
Implicit Dependencies: The &cv-CPPPATH; Construction Variable diff --git a/src/CHANGES.txt b/src/CHANGES.txt index df8fb0d..af448d5 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -24,6 +24,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER a file; integrates with existing memoizing of such vars. On vs2019 saves 5+ seconds per SCons invocation, which really helps test suite runs. + - Remove deprecated SourceSignatures, TargetSignatures From Jacek Kuczera: - Fix CheckFunc detection code for Visual 2019. Some functions diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 08104c5..0e1102e 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -46,7 +46,7 @@ import SCons.Builder import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Defaults -import SCons.Errors +from SCons.Errors import UserError, BuildError import SCons.Memoize import SCons.Node import SCons.Node.Alias @@ -75,11 +75,6 @@ CalculatorArgs = {} semi_deepcopy = SCons.Util.semi_deepcopy semi_deepcopy_dict = SCons.Util.semi_deepcopy_dict -# Pull UserError into the global name space for the benefit of -# Environment().SourceSignatures(), which has some import statements -# which seem to mess up its ability to reference SCons directly. -UserError = SCons.Errors.UserError - def alias_builder(env, target, source): pass @@ -154,7 +149,7 @@ def _set_BUILDERS(env, key, value): env._dict[key] = bd for k, v in value.items(): if not SCons.Builder.is_a_Builder(v): - raise SCons.Errors.UserError('%s is not a Builder.' % repr(v)) + raise UserError('%s is not a Builder.' % repr(v)) bd.update(value) def _del_SCANNERS(env, key): @@ -431,7 +426,7 @@ class SubstitutionEnvironment(object): # efficient than calling another function or a method. if key not in self._dict \ and not _is_valid_var.match(key): - raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) + raise UserError("Illegal construction variable `%s'" % key) self._dict[key] = value def get(self, key, default=None): @@ -1621,7 +1616,7 @@ class Base(SubstitutionEnvironment): for td in tdlist: targets.extend(td[0]) if len(targets) > 1: - raise SCons.Errors.UserError( + raise UserError( "More than one dependency target found in `%s': %s" % (filename, targets)) for target, depends in tdlist: @@ -2060,7 +2055,7 @@ class Base(SubstitutionEnvironment): """ action = self.Action(action, *args, **kw) result = action([], [], self) - if isinstance(result, SCons.Errors.BuildError): + if isinstance(result, BuildError): errstr = result.errstr if result.filename: errstr = result.filename + ': ' + errstr @@ -2180,7 +2175,7 @@ class Base(SubstitutionEnvironment): for side_effect in side_effects: if side_effect.multiple_side_effect_has_builder(): - raise SCons.Errors.UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect)) + raise UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect)) side_effect.add_source(targets) side_effect.side_effect = 1 self.Precious(side_effect) @@ -2198,24 +2193,6 @@ class Base(SubstitutionEnvironment): entry.set_src_builder(builder) return entries - def SourceSignatures(self, type): - global _warn_source_signatures_deprecated - if _warn_source_signatures_deprecated: - msg = "The env.SourceSignatures() method is deprecated;\n" + \ - "\tconvert your build to use the env.Decider() method instead." - SCons.Warnings.warn(SCons.Warnings.DeprecatedSourceSignaturesWarning, msg) - _warn_source_signatures_deprecated = False - type = self.subst(type) - self.src_sig_type = type - if type == 'MD5': - if not SCons.Util.md5: - raise UserError("MD5 signatures are not available in this version of Python.") - self.decide_source = self._changed_content - elif type == 'timestamp': - self.decide_source = self._changed_timestamp_match - else: - raise UserError("Unknown source signature type '%s'" % type) - def Split(self, arg): """This function converts a string or list into a list of strings or Nodes. This makes things easier for users by allowing files to @@ -2237,28 +2214,6 @@ class Base(SubstitutionEnvironment): else: return [self.subst(arg)] - def TargetSignatures(self, type): - global _warn_target_signatures_deprecated - if _warn_target_signatures_deprecated: - msg = "The env.TargetSignatures() method is deprecated;\n" + \ - "\tconvert your build to use the env.Decider() method instead." - SCons.Warnings.warn(SCons.Warnings.DeprecatedTargetSignaturesWarning, msg) - _warn_target_signatures_deprecated = False - type = self.subst(type) - self.tgt_sig_type = type - if type in ('MD5', 'content'): - if not SCons.Util.md5: - raise UserError("MD5 signatures are not available in this version of Python.") - self.decide_target = self._changed_content - elif type == 'timestamp': - self.decide_target = self._changed_timestamp_match - elif type == 'build': - self.decide_target = self._changed_build - elif type == 'source': - self.decide_target = self._changed_source - else: - raise UserError("Unknown target signature type '%s'"%type) - def Value(self, value, built_value=None): """ """ @@ -2355,7 +2310,7 @@ class OverrideEnvironment(Base): return self.__dict__['__subject'].__getitem__(key) def __setitem__(self, key, value): if not is_valid_construction_var(key): - raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) + raise UserError("Illegal construction variable `%s'" % key) self.__dict__['overrides'][key] = value def __delitem__(self, key): try: diff --git a/src/engine/SCons/Environment.xml b/src/engine/SCons/Environment.xml index a635108..829bf12 100644 --- a/src/engine/SCons/Environment.xml +++ b/src/engine/SCons/Environment.xml @@ -2987,105 +2987,6 @@ env.SourceCode('no_source.c', None) - - -(type) - - - -Note: Although it is not yet officially deprecated, -use of this function is discouraged. -See the -&f-link-Decider; -function for a more flexible and straightforward way -to configure SCons' decision-making. - - - -The -&f-SourceSignatures; -function tells -&scons; -how to decide if a source file -(a file that is not built from any other files) -has changed since the last time it -was used to build a particular target file. -Legal values are -MD5 -or -timestamp. - - - -If the environment method is used, -the specified type of source signature -is only used when deciding whether targets -built with that environment are up-to-date or must be rebuilt. -If the global function is used, -the specified type of source signature becomes the default -used for all decisions -about whether targets are up-to-date. - - - -MD5 -means -&scons; -decides that a source file has changed -if the MD5 checksum of its contents has changed since -the last time it was used to rebuild a particular target file. - - - -timestamp -means -&scons; -decides that a source file has changed -if its timestamp (modification time) has changed since -the last time it was used to rebuild a particular target file. -(Note that although this is similar to the behavior of Make, -by default it will also rebuild if the dependency is -older -than the last time it was used to rebuild the target file.) - - - -There is no different between the two behaviors -for Python -&f-Value; -node objects. - - - -MD5 -signatures take longer to compute, -but are more accurate than -timestamp -signatures. -The default value is -MD5. - - - -Note that the default -&f-link-TargetSignatures; -setting (see below) -is to use this -&f-SourceSignatures; -setting for any target files that are used -to build other target files. -Consequently, changing the value of -&f-SourceSignatures; -will, by default, -affect the up-to-date decision for all files in the build -(or all files built with a specific construction environment -when -&f-env-SourceSignatures; -is used). - - - - (arg) @@ -3229,159 +3130,6 @@ source_nodes = env.subst('$EXPAND_TO_NODELIST', - - -(type) - - - -Note: Although it is not yet officially deprecated, -use of this function is discouraged. -See the -&f-link-Decider; -function for a more flexible and straightforward way -to configure SCons' decision-making. - - - -The -&f-TargetSignatures; -function tells -&scons; -how to decide if a target file -(a file that -is -built from any other files) -has changed since the last time it -was used to build some other target file. -Legal values are -"build"; -"content" -(or its synonym -"MD5"); -"timestamp"; -or -"source". - - - -If the environment method is used, -the specified type of target signature is only used -for targets built with that environment. -If the global function is used, -the specified type of signature becomes the default -used for all target files that -don't have an explicit target signature type -specified for their environments. - - - -"content" -(or its synonym -"MD5") -means -&scons; -decides that a target file has changed -if the MD5 checksum of its contents has changed since -the last time it was used to rebuild some other target file. -This means -&scons; -will open up -MD5 sum the contents -of target files after they're built, -and may decide that it does not need to rebuild -"downstream" target files if a file was -rebuilt with exactly the same contents as the last time. - - - -"timestamp" -means -&scons; -decides that a target file has changed -if its timestamp (modification time) has changed since -the last time it was used to rebuild some other target file. -(Note that although this is similar to the behavior of Make, -by default it will also rebuild if the dependency is -older -than the last time it was used to rebuild the target file.) - - - -"source" -means -&scons; -decides that a target file has changed -as specified by the corresponding -&f-SourceSignatures; -setting -("MD5" -or -"timestamp"). -This means that -&scons; -will treat all input files to a target the same way, -regardless of whether they are source files -or have been built from other files. - - - -"build" -means -&scons; -decides that a target file has changed -if it has been rebuilt in this invocation -or if its content or timestamp have changed -as specified by the corresponding -&f-SourceSignatures; -setting. -This "propagates" the status of a rebuilt file -so that other "downstream" target files -will always be rebuilt, -even if the contents or the timestamp -have not changed. - - - -"build" -signatures are fastest because -"content" -(or -"MD5") -signatures take longer to compute, -but are more accurate than -"timestamp" -signatures, -and can prevent unnecessary "downstream" rebuilds -when a target file is rebuilt to the exact same contents -as the previous build. -The -"source" -setting provides the most consistent behavior -when other target files may be rebuilt from -both source and target input files. -The default value is -"source". - - - -Because the default setting is -"source", -using -&f-SourceSignatures; -is generally preferable to -&f-TargetSignatures;, -so that the up-to-date decision -will be consistent for all files -(or all files built with a specific construction environment). -Use of -&f-TargetSignatures; -provides specific control for how built target files -affect their "downstream" dependencies. - - - - (string, [toolpath, **kw]) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 70e1a37..f016f22 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -3284,44 +3284,6 @@ def generate(env): s = e.src_builder() assert s is None, s - def test_SourceSignatures(self): - """Test the SourceSignatures() method""" - import SCons.Errors - - env = self.TestEnvironment(M = 'MD5', T = 'timestamp') - - exc_caught = None - try: - env.SourceSignatures('invalid_type') - except SCons.Errors.UserError: - exc_caught = 1 - assert exc_caught, "did not catch expected UserError" - - env.SourceSignatures('MD5') - assert env.src_sig_type == 'MD5', env.src_sig_type - - env.SourceSignatures('$M') - assert env.src_sig_type == 'MD5', env.src_sig_type - - env.SourceSignatures('timestamp') - assert env.src_sig_type == 'timestamp', env.src_sig_type - - env.SourceSignatures('$T') - assert env.src_sig_type == 'timestamp', env.src_sig_type - - try: - import SCons.Util - save_md5 = SCons.Util.md5 - SCons.Util.md5 = None - try: - env.SourceSignatures('MD5') - except SCons.Errors.UserError: - pass - else: - self.fail('Did not catch expected UserError') - finally: - SCons.Util.md5 = save_md5 - def test_Split(self): """Test the Split() method""" env = self.TestEnvironment(FOO = 'fff', BAR = 'bbb') @@ -3338,56 +3300,6 @@ def generate(env): s = env.Split("$FOO$BAR") assert s == ["fffbbb"], s - def test_TargetSignatures(self): - """Test the TargetSignatures() method""" - import SCons.Errors - - env = self.TestEnvironment(B='build', C='content') - - exc_caught = None - try: - env.TargetSignatures('invalid_type') - except SCons.Errors.UserError: - exc_caught = 1 - assert exc_caught, "did not catch expected UserError" - assert not hasattr(env, '_build_signature') - - env.TargetSignatures('build') - assert env.tgt_sig_type == 'build', env.tgt_sig_type - - env.TargetSignatures('$B') - assert env.tgt_sig_type == 'build', env.tgt_sig_type - - env.TargetSignatures('content') - assert env.tgt_sig_type == 'content', env.tgt_sig_type - - env.TargetSignatures('$C') - assert env.tgt_sig_type == 'content', env.tgt_sig_type - - env.TargetSignatures('MD5') - assert env.tgt_sig_type == 'MD5', env.tgt_sig_type - - env.TargetSignatures('timestamp') - assert env.tgt_sig_type == 'timestamp', env.tgt_sig_type - - try: - import SCons.Util - save_md5 = SCons.Util.md5 - SCons.Util.md5 = None - try: - env.TargetSignatures('MD5') - except SCons.Errors.UserError: - pass - else: - self.fail('Did not catch expected UserError') - try: - env.TargetSignatures('content') - except SCons.Errors.UserError: - pass - else: - self.fail('Did not catch expected UserError') - finally: - SCons.Util.md5 = save_md5 def test_Value(self): """Test creating a Value() object @@ -3408,7 +3320,6 @@ def generate(env): assert v3.value == 'c', v3.value - def test_Environment_global_variable(self): """Test setting Environment variable to an Environment.Base subclass""" class MyEnv(SCons.Environment.Base): @@ -3750,8 +3661,6 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture): # Environment() # FindFile() # Scanner() - # SourceSignatures() - # TargetSignatures() # It's unlikely Clone() will ever be called this way, so let the # other methods test that handling overridden values works. diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 007eb0d..24af73e 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -346,10 +346,8 @@ GlobalDefaultEnvironmentFunctions = [ 'SConsignFile', 'SideEffect', 'SourceCode', - 'SourceSignatures', 'Split', 'Tag', - 'TargetSignatures', 'Value', 'VariantDir', ] diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index a5b257b..718b3d5 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -132,12 +132,6 @@ class DeprecatedCopyWarning(MandatoryDeprecatedWarning): class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): pass -class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): - pass - class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): pass diff --git a/test/Deprecated/CacheDir/timestamp-content.py b/test/Deprecated/CacheDir/timestamp-content.py deleted file mode 100644 index 860d0f3..0000000 --- a/test/Deprecated/CacheDir/timestamp-content.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/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 CacheDir() works when using SourceSignatures('timestamp') -and TargetSignatures 'content'. -""" - -import TestSCons - -test = TestSCons.TestSCons() - -test.write('SConstruct', """ -SetOption('warn', 'no-deprecated') -SourceSignatures('timestamp') -TargetSignatures('content') -CacheDir('cache') -Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) -""") - -test.write('file.in', "file.in\n") - -test.run(arguments = '.') - -test.must_match('file.out', "file.in\n") - -test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.sleep() - -test.touch('file.in') - -test.not_up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/CacheDir/timestamp-timestamp.py b/test/Deprecated/CacheDir/timestamp-timestamp.py deleted file mode 100644 index eec70b5..0000000 --- a/test/Deprecated/CacheDir/timestamp-timestamp.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/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 CacheDir() works when using both SourceSignatures() -and TargetSignatures values of 'timestamp'. -""" - -import TestSCons - -test = TestSCons.TestSCons() - -test.write(['SConstruct'], """\ -SetOption('warn', 'no-deprecated') -SourceSignatures('timestamp') -TargetSignatures('timestamp') -CacheDir('cache') -Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) -""") - -test.write('file.in', "file.in\n") - -test.run(arguments = '--cache-show --debug=explain .') - -test.must_match('file.out', "file.in\n") - -test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.sleep() - -test.touch('file.in') - -test.not_up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/basic.py b/test/Deprecated/SourceSignatures/basic.py deleted file mode 100644 index 7951dbd..0000000 --- a/test/Deprecated/SourceSignatures/basic.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/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 os -import re - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - - -base_sconstruct_contents = """\ -SetOption('warn', 'deprecated-source-signatures') -def build(env, target, source): - with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: - ofp.write(ifp.read()) -B = Builder(action = build) -env = Environment(BUILDERS = { 'B' : B }) -env.B(target = 'f1.out', source = 'f1.in') -env.B(target = 'f2.out', source = 'f2.in') -env.B(target = 'f3.out', source = 'f3.in') -env.B(target = 'f4.out', source = 'f4.in') -""" - -def write_SConstruct(test, sigtype): - contents = base_sconstruct_contents - if sigtype: - contents = contents + ("\nSourceSignatures('%s')\n" % sigtype) - test.write('SConstruct', contents) - - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - -write_SConstruct(test, 'timestamp') - -test.write('f1.in', "f1.in\n") -test.write('f2.in', "f2.in\n") -test.write('f3.in', "f3.in\n") -test.write('f4.in', "f4.in\n") - -test.run(arguments = 'f1.out f3.out', stderr = expect) - -test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = re.escape(test.wrap_stdout("""\ -scons: `f1.out' is up to date. -build(["f2.out"], ["f2.in"]) -scons: `f3.out' is up to date. -build(["f4.out"], ["f4.in"]) -""")), - stderr = expect) - - -os.utime(test.workpath('f1.in'), - (os.path.getatime(test.workpath('f1.in')), - os.path.getmtime(test.workpath('f1.in'))+10)) -os.utime(test.workpath('f3.in'), - (os.path.getatime(test.workpath('f3.in')), - os.path.getmtime(test.workpath('f3.in'))+10)) - -test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = re.escape(test.wrap_stdout("""\ -build(["f1.out"], ["f1.in"]) -scons: `f2.out' is up to date. -build(["f3.out"], ["f3.in"]) -scons: `f4.out' is up to date. -""")), - stderr = expect) - - -# Switching to content signatures from timestamps should rebuild, -# because we didn't record the content signatures last time. - -write_SConstruct(test, 'MD5') - -test.not_up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = expect) - - -test.sleep() - -test.write('f1.in', "f1.in\n") -test.write('f2.in', "f2.in\n") -test.write('f3.in', "f3.in\n") -test.write('f4.in', "f4.in\n") - -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) - - -test.touch('f1.in', os.path.getmtime(test.workpath('f1.in'))+10) -test.touch('f3.in', os.path.getmtime(test.workpath('f3.in'))+10) - -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) - - -write_SConstruct(test, None) - -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/env.py b/test/Deprecated/SourceSignatures/env.py deleted file mode 100644 index c63b176..0000000 --- a/test/Deprecated/SourceSignatures/env.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/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 use of env.SourceSignatures() correctly overrides the -default behavior. -""" - -import os -import re - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -base_sconstruct_contents = """\ -SetOption('warn', 'deprecated-source-signatures') -def build(env, target, source): - with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: - ofp.write(ifp.read()) -B = Builder(action = build) -env = Environment(BUILDERS = { 'B' : B }) -env2 = env.Clone() -env2.SourceSignatures('%s') -env.B(target = 'f1.out', source = 'f1.in') -env.B(target = 'f2.out', source = 'f2.in') -env2.B(target = 'f3.out', source = 'f3.in') -env2.B(target = 'f4.out', source = 'f4.in') - -SourceSignatures('%s') -""" - -def write_SConstruct(test, env_sigtype, default_sigtype): - contents = base_sconstruct_contents % (env_sigtype, default_sigtype) - test.write('SConstruct', contents) - - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - - -write_SConstruct(test, 'MD5', 'timestamp') - -test.write('f1.in', "f1.in\n") -test.write('f2.in', "f2.in\n") -test.write('f3.in', "f3.in\n") -test.write('f4.in', "f4.in\n") - -test.run(arguments = 'f1.out f3.out', stderr = expect) - -test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = re.escape(test.wrap_stdout("""\ -scons: `f1.out' is up to date. -build(["f2.out"], ["f2.in"]) -scons: `f3.out' is up to date. -build(["f4.out"], ["f4.in"]) -""")), - stderr = expect) - - -test.sleep() - -test.touch('f1.in') -test.touch('f3.in') - -test.run(arguments = 'f1.out f2.out f3.out f4.out', - stdout = re.escape(test.wrap_stdout("""\ -build(["f1.out"], ["f1.in"]) -scons: `f2.out' is up to date. -scons: `f3.out' is up to date. -scons: `f4.out' is up to date. -""")), - stderr = expect) - -test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/implicit-cache.py b/test/Deprecated/SourceSignatures/implicit-cache.py deleted file mode 100644 index a4bdc78..0000000 --- a/test/Deprecated/SourceSignatures/implicit-cache.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/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 simultaneous use of implicit_cache and -SourceSignatures('timestamp') -""" - -import re - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -test.write('SConstruct', """\ -SetOption('warn', 'deprecated-source-signatures') -SetOption('implicit_cache', 1) -SourceSignatures('timestamp') - -def build(env, target, source): - with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: - ofp.write(ifp.read()) -B = Builder(action = build) -env = Environment(BUILDERS = { 'B' : B }) -env.B(target = 'both.out', source = 'both.in') -""") - - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - - -both_out_both_in = re.escape(test.wrap_stdout('build(["both.out"], ["both.in"])\n')) - -test.write('both.in', "both.in 1\n") - -test.run(arguments = 'both.out', - stdout = both_out_both_in, - stderr = expect) - - -test.sleep(2) - -test.write('both.in', "both.in 2\n") - -test.run(arguments = 'both.out', - stdout = both_out_both_in, - stderr = expect) - - -test.sleep(2) - -test.write('both.in', "both.in 3\n") - -test.run(arguments = 'both.out', - stdout = both_out_both_in, - stderr = expect) - - -test.sleep(2) - -test.write('both.in', "both.in 4\n") - -test.run(arguments = 'both.out', - stdout = both_out_both_in, - stderr = expect) - - -test.sleep(2) - -test.up_to_date(arguments = 'both.out', stderr = None) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/no-csigs.py b/test/Deprecated/SourceSignatures/no-csigs.py deleted file mode 100644 index c4f2a78..0000000 --- a/test/Deprecated/SourceSignatures/no-csigs.py +++ /dev/null @@ -1,81 +0,0 @@ - -#!/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 os - -import TestSCons -import TestSConsign - -test = TestSConsign.TestSConsign(match = TestSConsign.match_re) - - -test.write('SConstruct', """\ -SetOption('warn', 'deprecated-source-signatures') -def build(env, target, source): - with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: - ofp.write(ifp.read()) -B = Builder(action = build) -env = Environment(BUILDERS = { 'B' : B }) -env.B(target = 'f1.out', source = 'f1.in') -env.B(target = 'f2.out', source = 'f2.in') -SourceSignatures('timestamp') -""") - -test.write('f1.in', "f1.in\n") -test.write('f2.in', "f2.in\n") - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - -test.run(arguments = '.', stderr = expect) - - -expect = r"""=== .: -SConstruct: None \d+ \d+ -f1.in: None \d+ \d+ -f1.out: \S+ \d+ \d+ - f1.in: None \d+ \d+ - \S+ \[build\(target, source, env\)\] -f2.in: None \d+ \d+ -f2.out: \S+ \d+ \d+ - f2.in: None \d+ \d+ - \S+ \[build\(target, source, env\)\] -""" - -test.run_sconsign(arguments = test.workpath('.sconsign'), - stdout = expect) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/overrides.py b/test/Deprecated/SourceSignatures/overrides.py deleted file mode 100644 index 4303c0e..0000000 --- a/test/Deprecated/SourceSignatures/overrides.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/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__" - -""" -Make sure that SourceSignatures() works when overrides are used on a -Builder call. (Previous implementations used methods that would stay -bound to the underlying construction environment, which in this case -meant ignoring the 'timestamp' setting and still using the underlying -content signature.) -""" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - -test.write('SConstruct', """\ -SetOption('warn', 'deprecated-source-signatures') -DefaultEnvironment().SourceSignatures('MD5') -env = Environment() -env.SourceSignatures('timestamp') -env.Command('foo.out', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=1) -""") - -test.write('foo.in', "foo.in 1\n") - -test.run(arguments = 'foo.out', stderr = expect) - -test.sleep() - -test.write('foo.in', "foo.in 1\n") - -test.not_up_to_date(arguments = 'foo.out', stderr = expect) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/switch-rebuild.py b/test/Deprecated/SourceSignatures/switch-rebuild.py deleted file mode 100644 index b9cc3d5..0000000 --- a/test/Deprecated/SourceSignatures/switch-rebuild.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/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 switching SourceSignature() types no longer causes rebuilds. -""" - -import re - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - - -base_sconstruct_contents = """\ -SetOption('warn', 'deprecated-source-signatures') -SourceSignatures('%s') - -def build(env, target, source): - with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: - ofp.write(ifp.read()) -B = Builder(action = build) -env = Environment(BUILDERS = { 'B' : B }) -env.B(target = 'switch.out', source = 'switch.in') -""" - -def write_SConstruct(test, sig_type): - contents = base_sconstruct_contents % sig_type - test.write('SConstruct', contents) - - -write_SConstruct(test, 'MD5') - -test.write('switch.in', "switch.in\n") - -switch_out_switch_in = re.escape(test.wrap_stdout('build(["switch.out"], ["switch.in"])\n')) - -test.run(arguments = 'switch.out', - stdout = switch_out_switch_in, - stderr = expect) - -test.up_to_date(arguments = 'switch.out', stderr = None) - - -write_SConstruct(test, 'timestamp') - -test.up_to_date(arguments = 'switch.out', stderr = None) - - -write_SConstruct(test, 'MD5') - -test.not_up_to_date(arguments = 'switch.out', stderr = None) - - -test.write('switch.in', "switch.in 2\n") - -test.run(arguments = 'switch.out', - stdout = switch_out_switch_in, - stderr = expect) - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/TargetSignatures/build-content.py b/test/Deprecated/TargetSignatures/build-content.py deleted file mode 100644 index efdaaee..0000000 --- a/test/Deprecated/TargetSignatures/build-content.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/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 basic interaction of the historic TargetSignatures('build') -and TargetSignatures('content') settings, overriding one with -the other in specific construction environments. -""" - -import re - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -expect = TestSCons.re_escape(""" -scons: warning: The env.TargetSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - - -sconstruct_contents = """\ -SetOption('warn', 'deprecated-target-signatures') -env = Environment() - -def copy1(env, source, target): - with open(str(target[0]), 'wb') as fo, open(str(source[0]), 'rb') as fi: - fo.write(fi.read()) - -def copy2(env, source, target): - %s - return copy1(env, source, target) - -env['BUILDERS']['Copy1'] = Builder(action=copy1) -env['BUILDERS']['Copy2'] = Builder(action=copy2) - -env.Copy2('foo.mid', 'foo.in') -env.Copy1('foo.out', 'foo.mid') - -env2 = env.Clone() -env2.TargetSignatures('%s') -env2.Copy2('bar.mid', 'bar.in') -env2.Copy1('bar.out', 'bar.mid') - -TargetSignatures('%s') -""" - -def write_SConstruct(test, *args): - contents = sconstruct_contents % args - test.write('SConstruct', contents) - - - -write_SConstruct(test, '', 'build', 'content') - -test.write('foo.in', 'foo.in') -test.write('bar.in', 'bar.in') - -test.run(arguments="bar.out foo.out", - stdout=re.escape(test.wrap_stdout("""\ -copy2(["bar.mid"], ["bar.in"]) -copy1(["bar.out"], ["bar.mid"]) -copy2(["foo.mid"], ["foo.in"]) -copy1(["foo.out"], ["foo.mid"]) -""")), - stderr = expect) - -test.up_to_date(arguments='bar.out foo.out', stderr=None) - - - -# Change the code in the the copy2() function, which should change -# its content and trigger a rebuild of the targets built with it. - -write_SConstruct(test, 'x = 2 # added this line', 'build', 'content') - -test.run(arguments="bar.out foo.out", - stdout=re.escape(test.wrap_stdout("""\ -copy2(["bar.mid"], ["bar.in"]) -copy1(["bar.out"], ["bar.mid"]) -copy2(["foo.mid"], ["foo.in"]) -scons: `foo.out' is up to date. -""")), - stderr = expect) - - - -# Swapping content and build signatures no longer causes a rebuild -# because we record the right underlying information regardless. - -write_SConstruct(test, 'x = 2 # added this line', 'content', 'build') - -test.up_to_date(arguments="bar.out foo.out", stderr=None) - - - -# Change the code in the the copy2() function back again, which should -# trigger another rebuild of the targets built with it. - -write_SConstruct(test, '', 'content', 'build') - -test.run(arguments='bar.out foo.out', - stdout=re.escape(test.wrap_stdout("""\ -copy2(["bar.mid"], ["bar.in"]) -scons: `bar.out' is up to date. -copy2(["foo.mid"], ["foo.in"]) -copy1(["foo.out"], ["foo.mid"]) -""")), - stderr = expect) - - - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/TargetSignatures/content.py b/test/Deprecated/TargetSignatures/content.py deleted file mode 100644 index aca63f3..0000000 --- a/test/Deprecated/TargetSignatures/content.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/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 use of the TargetSignatures('content') setting to override -SourceSignatures('timestamp') settings. -""" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -expect = TestSCons.re_escape(""" -scons: warning: The env.SourceSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.re_escape(""" -scons: warning: The env.TargetSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - - -test.write('SConstruct', """\ -SetOption('warn', 'deprecated-source-signatures') -SetOption('warn', 'deprecated-target-signatures') -env = Environment() - -def copy(env, source, target): - with open(str(target[0]), 'wb') as ofp: - for s in source: - with open(str(s), 'rb') as ifp: - ofp.write(ifp.read()) - -copyAction = Action(copy, "Copying $TARGET") - -SourceSignatures('timestamp') - -env['BUILDERS']['Copy'] = Builder(action=copyAction) - -env.Copy('foo.out', 'foo.in') - -env2 = env.Clone() -env2.TargetSignatures('content') -env2.Copy('bar.out', 'bar.in') -AlwaysBuild('bar.out') - -env.Copy('final', ['foo.out', 'bar.out', 'extra.in']) -env.Ignore('final', 'extra.in') -""") - -test.write('foo.in', "foo.in\n") -test.write('bar.in', "bar.in\n") -test.write('extra.in', "extra.in 1\n") - -test.run(stderr = expect) - -test.must_match('final', "foo.in\nbar.in\nextra.in 1\n") - -test.sleep() -test.write('extra.in', "extra.in 2\n") - -test.run(stderr = expect) - -test.must_match('final', "foo.in\nbar.in\nextra.in 1\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/Deprecated/TargetSignatures/overrides.py b/test/Deprecated/TargetSignatures/overrides.py deleted file mode 100644 index 54a66d4..0000000 --- a/test/Deprecated/TargetSignatures/overrides.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/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__" - -""" -Make sure that TargetSignatures() works when overrides are used on a -Builder call. Previous implementations used methods that would stay -bound to the underlying construction environment and cause weird -behavior like infinite recursion. -""" - -import TestSCons - -test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - -test.write('SConstruct', """\ -SetOption('warn', 'deprecated-target-signatures') -env = Environment() -env.TargetSignatures('content') -env.Command('foo.out', 'foo.mid', Copy('$TARGET', '$SOURCE'), FOO=1) -env.Command('foo.mid', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=2) -""") - -test.write('foo.in', "foo.in\n") - -expect = TestSCons.re_escape(""" -scons: warning: The env.TargetSignatures() method is deprecated; -\tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr - -test.run(arguments = '.', stderr = expect) - -test.must_match('foo.mid', "foo.in\n") -test.must_match('foo.out', "foo.in\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/Removed/CacheDir/Old/sconstest.skip b/test/Removed/CacheDir/Old/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/Removed/CacheDir/Old/timestamp-content.py b/test/Removed/CacheDir/Old/timestamp-content.py new file mode 100644 index 0000000..860d0f3 --- /dev/null +++ b/test/Removed/CacheDir/Old/timestamp-content.py @@ -0,0 +1,68 @@ +#!/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 CacheDir() works when using SourceSignatures('timestamp') +and TargetSignatures 'content'. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +SetOption('warn', 'no-deprecated') +SourceSignatures('timestamp') +TargetSignatures('content') +CacheDir('cache') +Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) +""") + +test.write('file.in', "file.in\n") + +test.run(arguments = '.') + +test.must_match('file.out', "file.in\n") + +test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.sleep() + +test.touch('file.in') + +test.not_up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/CacheDir/Old/timestamp-timestamp.py b/test/Removed/CacheDir/Old/timestamp-timestamp.py new file mode 100644 index 0000000..eec70b5 --- /dev/null +++ b/test/Removed/CacheDir/Old/timestamp-timestamp.py @@ -0,0 +1,68 @@ +#!/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 CacheDir() works when using both SourceSignatures() +and TargetSignatures values of 'timestamp'. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write(['SConstruct'], """\ +SetOption('warn', 'no-deprecated') +SourceSignatures('timestamp') +TargetSignatures('timestamp') +CacheDir('cache') +Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) +""") + +test.write('file.in', "file.in\n") + +test.run(arguments = '--cache-show --debug=explain .') + +test.must_match('file.out', "file.in\n") + +test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.sleep() + +test.touch('file.in') + +test.not_up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.up_to_date(options = '--cache-show --debug=explain', arguments = '.') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/CacheDir/README.md b/test/Removed/CacheDir/README.md new file mode 100644 index 0000000..c5b75bf --- /dev/null +++ b/test/Removed/CacheDir/README.md @@ -0,0 +1,4 @@ +CacheDir/Old contains old tests of CacheDir which used the now removed +SourceSignatures and TargetSignatures methods, preserved here for +reference; the presence of an scontest.skip file means they are never +executed. diff --git a/test/Removed/SourceSignatures/Old/basic.py b/test/Removed/SourceSignatures/Old/basic.py new file mode 100644 index 0000000..7951dbd --- /dev/null +++ b/test/Removed/SourceSignatures/Old/basic.py @@ -0,0 +1,131 @@ +#!/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 os +import re + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + + +base_sconstruct_contents = """\ +SetOption('warn', 'deprecated-source-signatures') +def build(env, target, source): + with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: + ofp.write(ifp.read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'f1.out', source = 'f1.in') +env.B(target = 'f2.out', source = 'f2.in') +env.B(target = 'f3.out', source = 'f3.in') +env.B(target = 'f4.out', source = 'f4.in') +""" + +def write_SConstruct(test, sigtype): + contents = base_sconstruct_contents + if sigtype: + contents = contents + ("\nSourceSignatures('%s')\n" % sigtype) + test.write('SConstruct', contents) + + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + +write_SConstruct(test, 'timestamp') + +test.write('f1.in', "f1.in\n") +test.write('f2.in', "f2.in\n") +test.write('f3.in', "f3.in\n") +test.write('f4.in', "f4.in\n") + +test.run(arguments = 'f1.out f3.out', stderr = expect) + +test.run(arguments = 'f1.out f2.out f3.out f4.out', + stdout = re.escape(test.wrap_stdout("""\ +scons: `f1.out' is up to date. +build(["f2.out"], ["f2.in"]) +scons: `f3.out' is up to date. +build(["f4.out"], ["f4.in"]) +""")), + stderr = expect) + + +os.utime(test.workpath('f1.in'), + (os.path.getatime(test.workpath('f1.in')), + os.path.getmtime(test.workpath('f1.in'))+10)) +os.utime(test.workpath('f3.in'), + (os.path.getatime(test.workpath('f3.in')), + os.path.getmtime(test.workpath('f3.in'))+10)) + +test.run(arguments = 'f1.out f2.out f3.out f4.out', + stdout = re.escape(test.wrap_stdout("""\ +build(["f1.out"], ["f1.in"]) +scons: `f2.out' is up to date. +build(["f3.out"], ["f3.in"]) +scons: `f4.out' is up to date. +""")), + stderr = expect) + + +# Switching to content signatures from timestamps should rebuild, +# because we didn't record the content signatures last time. + +write_SConstruct(test, 'MD5') + +test.not_up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = expect) + + +test.sleep() + +test.write('f1.in', "f1.in\n") +test.write('f2.in', "f2.in\n") +test.write('f3.in', "f3.in\n") +test.write('f4.in', "f4.in\n") + +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) + + +test.touch('f1.in', os.path.getmtime(test.workpath('f1.in'))+10) +test.touch('f3.in', os.path.getmtime(test.workpath('f3.in'))+10) + +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) + + +write_SConstruct(test, None) + +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/SourceSignatures/Old/env.py b/test/Removed/SourceSignatures/Old/env.py new file mode 100644 index 0000000..c63b176 --- /dev/null +++ b/test/Removed/SourceSignatures/Old/env.py @@ -0,0 +1,109 @@ +#!/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 use of env.SourceSignatures() correctly overrides the +default behavior. +""" + +import os +import re + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +base_sconstruct_contents = """\ +SetOption('warn', 'deprecated-source-signatures') +def build(env, target, source): + with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: + ofp.write(ifp.read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env2 = env.Clone() +env2.SourceSignatures('%s') +env.B(target = 'f1.out', source = 'f1.in') +env.B(target = 'f2.out', source = 'f2.in') +env2.B(target = 'f3.out', source = 'f3.in') +env2.B(target = 'f4.out', source = 'f4.in') + +SourceSignatures('%s') +""" + +def write_SConstruct(test, env_sigtype, default_sigtype): + contents = base_sconstruct_contents % (env_sigtype, default_sigtype) + test.write('SConstruct', contents) + + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + + +write_SConstruct(test, 'MD5', 'timestamp') + +test.write('f1.in', "f1.in\n") +test.write('f2.in', "f2.in\n") +test.write('f3.in', "f3.in\n") +test.write('f4.in', "f4.in\n") + +test.run(arguments = 'f1.out f3.out', stderr = expect) + +test.run(arguments = 'f1.out f2.out f3.out f4.out', + stdout = re.escape(test.wrap_stdout("""\ +scons: `f1.out' is up to date. +build(["f2.out"], ["f2.in"]) +scons: `f3.out' is up to date. +build(["f4.out"], ["f4.in"]) +""")), + stderr = expect) + + +test.sleep() + +test.touch('f1.in') +test.touch('f3.in') + +test.run(arguments = 'f1.out f2.out f3.out f4.out', + stdout = re.escape(test.wrap_stdout("""\ +build(["f1.out"], ["f1.in"]) +scons: `f2.out' is up to date. +scons: `f3.out' is up to date. +scons: `f4.out' is up to date. +""")), + stderr = expect) + +test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/SourceSignatures/Old/implicit-cache.py b/test/Removed/SourceSignatures/Old/implicit-cache.py new file mode 100644 index 0000000..a4bdc78 --- /dev/null +++ b/test/Removed/SourceSignatures/Old/implicit-cache.py @@ -0,0 +1,105 @@ +#!/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 simultaneous use of implicit_cache and +SourceSignatures('timestamp') +""" + +import re + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConstruct', """\ +SetOption('warn', 'deprecated-source-signatures') +SetOption('implicit_cache', 1) +SourceSignatures('timestamp') + +def build(env, target, source): + with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: + ofp.write(ifp.read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'both.out', source = 'both.in') +""") + + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + + +both_out_both_in = re.escape(test.wrap_stdout('build(["both.out"], ["both.in"])\n')) + +test.write('both.in', "both.in 1\n") + +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = expect) + + +test.sleep(2) + +test.write('both.in', "both.in 2\n") + +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = expect) + + +test.sleep(2) + +test.write('both.in', "both.in 3\n") + +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = expect) + + +test.sleep(2) + +test.write('both.in', "both.in 4\n") + +test.run(arguments = 'both.out', + stdout = both_out_both_in, + stderr = expect) + + +test.sleep(2) + +test.up_to_date(arguments = 'both.out', stderr = None) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/SourceSignatures/Old/no-csigs.py b/test/Removed/SourceSignatures/Old/no-csigs.py new file mode 100644 index 0000000..c4f2a78 --- /dev/null +++ b/test/Removed/SourceSignatures/Old/no-csigs.py @@ -0,0 +1,81 @@ + +#!/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 os + +import TestSCons +import TestSConsign + +test = TestSConsign.TestSConsign(match = TestSConsign.match_re) + + +test.write('SConstruct', """\ +SetOption('warn', 'deprecated-source-signatures') +def build(env, target, source): + with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: + ofp.write(ifp.read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'f1.out', source = 'f1.in') +env.B(target = 'f2.out', source = 'f2.in') +SourceSignatures('timestamp') +""") + +test.write('f1.in', "f1.in\n") +test.write('f2.in', "f2.in\n") + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + +test.run(arguments = '.', stderr = expect) + + +expect = r"""=== .: +SConstruct: None \d+ \d+ +f1.in: None \d+ \d+ +f1.out: \S+ \d+ \d+ + f1.in: None \d+ \d+ + \S+ \[build\(target, source, env\)\] +f2.in: None \d+ \d+ +f2.out: \S+ \d+ \d+ + f2.in: None \d+ \d+ + \S+ \[build\(target, source, env\)\] +""" + +test.run_sconsign(arguments = test.workpath('.sconsign'), + stdout = expect) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/SourceSignatures/Old/overrides.py b/test/Removed/SourceSignatures/Old/overrides.py new file mode 100644 index 0000000..4303c0e --- /dev/null +++ b/test/Removed/SourceSignatures/Old/overrides.py @@ -0,0 +1,68 @@ +#!/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__" + +""" +Make sure that SourceSignatures() works when overrides are used on a +Builder call. (Previous implementations used methods that would stay +bound to the underlying construction environment, which in this case +meant ignoring the 'timestamp' setting and still using the underlying +content signature.) +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + +test.write('SConstruct', """\ +SetOption('warn', 'deprecated-source-signatures') +DefaultEnvironment().SourceSignatures('MD5') +env = Environment() +env.SourceSignatures('timestamp') +env.Command('foo.out', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=1) +""") + +test.write('foo.in', "foo.in 1\n") + +test.run(arguments = 'foo.out', stderr = expect) + +test.sleep() + +test.write('foo.in', "foo.in 1\n") + +test.not_up_to_date(arguments = 'foo.out', stderr = expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/SourceSignatures/Old/sconstest.skip b/test/Removed/SourceSignatures/Old/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/Removed/SourceSignatures/Old/switch-rebuild.py b/test/Removed/SourceSignatures/Old/switch-rebuild.py new file mode 100644 index 0000000..b9cc3d5 --- /dev/null +++ b/test/Removed/SourceSignatures/Old/switch-rebuild.py @@ -0,0 +1,96 @@ +#!/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 switching SourceSignature() types no longer causes rebuilds. +""" + +import re + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + + +base_sconstruct_contents = """\ +SetOption('warn', 'deprecated-source-signatures') +SourceSignatures('%s') + +def build(env, target, source): + with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp: + ofp.write(ifp.read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'switch.out', source = 'switch.in') +""" + +def write_SConstruct(test, sig_type): + contents = base_sconstruct_contents % sig_type + test.write('SConstruct', contents) + + +write_SConstruct(test, 'MD5') + +test.write('switch.in', "switch.in\n") + +switch_out_switch_in = re.escape(test.wrap_stdout('build(["switch.out"], ["switch.in"])\n')) + +test.run(arguments = 'switch.out', + stdout = switch_out_switch_in, + stderr = expect) + +test.up_to_date(arguments = 'switch.out', stderr = None) + + +write_SConstruct(test, 'timestamp') + +test.up_to_date(arguments = 'switch.out', stderr = None) + + +write_SConstruct(test, 'MD5') + +test.not_up_to_date(arguments = 'switch.out', stderr = None) + + +test.write('switch.in', "switch.in 2\n") + +test.run(arguments = 'switch.out', + stdout = switch_out_switch_in, + stderr = expect) + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/SourceSignatures/README.md b/test/Removed/SourceSignatures/README.md new file mode 100644 index 0000000..05d8d05 --- /dev/null +++ b/test/Removed/SourceSignatures/README.md @@ -0,0 +1,6 @@ +SourceSignatures.py is the "new" test, only makes sure scons actually +fails in the presence of the method or setoption call. + +The Old directory is the former tests from the deprecated state, +preserved here for reference; the presence of an scontest.skip file +means they are never executed. diff --git a/test/Removed/SourceSignatures/SConstruct.method b/test/Removed/SourceSignatures/SConstruct.method new file mode 100644 index 0000000..e68d6bf --- /dev/null +++ b/test/Removed/SourceSignatures/SConstruct.method @@ -0,0 +1 @@ +SourceSignatures('MD5') diff --git a/test/Removed/SourceSignatures/SConstruct.setopt b/test/Removed/SourceSignatures/SConstruct.setopt new file mode 100644 index 0000000..6e1161f --- /dev/null +++ b/test/Removed/SourceSignatures/SConstruct.setopt @@ -0,0 +1 @@ +SetOption('warn', 'deprecated-source-signatures') diff --git a/test/Removed/SourceSignatures/SourceSignatures.py b/test/Removed/SourceSignatures/SourceSignatures.py new file mode 100644 index 0000000..fcc5e43 --- /dev/null +++ b/test/Removed/SourceSignatures/SourceSignatures.py @@ -0,0 +1,52 @@ +#!/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 SourceSignatures and its associated warning flag +are definitely gone. +""" + +import TestSCons + +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) + +test.file_fixture('SConstruct.method', 'SConstruct') +test.run(arguments='-Q -s', status=2, stdout=None, + stderr="""\ +NameError: name 'SourceSignatures' is not defined: + File ".+SConstruct", line 1: + SourceSignatures('MD5') +""") + +test.file_fixture('SConstruct.setopt', 'SConstruct') +test.run(arguments='-Q -s', status=0, stdout=None, + stderr="""\ +No warning type: 'deprecated-source-signatures' +No warning type: 'deprecated-source-signatures' +""") + +test.pass_test() + diff --git a/test/Removed/TargetSignatures/Old/build-content.py b/test/Removed/TargetSignatures/Old/build-content.py new file mode 100644 index 0000000..efdaaee --- /dev/null +++ b/test/Removed/TargetSignatures/Old/build-content.py @@ -0,0 +1,142 @@ +#!/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 basic interaction of the historic TargetSignatures('build') +and TargetSignatures('content') settings, overriding one with +the other in specific construction environments. +""" + +import re + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +expect = TestSCons.re_escape(""" +scons: warning: The env.TargetSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + + +sconstruct_contents = """\ +SetOption('warn', 'deprecated-target-signatures') +env = Environment() + +def copy1(env, source, target): + with open(str(target[0]), 'wb') as fo, open(str(source[0]), 'rb') as fi: + fo.write(fi.read()) + +def copy2(env, source, target): + %s + return copy1(env, source, target) + +env['BUILDERS']['Copy1'] = Builder(action=copy1) +env['BUILDERS']['Copy2'] = Builder(action=copy2) + +env.Copy2('foo.mid', 'foo.in') +env.Copy1('foo.out', 'foo.mid') + +env2 = env.Clone() +env2.TargetSignatures('%s') +env2.Copy2('bar.mid', 'bar.in') +env2.Copy1('bar.out', 'bar.mid') + +TargetSignatures('%s') +""" + +def write_SConstruct(test, *args): + contents = sconstruct_contents % args + test.write('SConstruct', contents) + + + +write_SConstruct(test, '', 'build', 'content') + +test.write('foo.in', 'foo.in') +test.write('bar.in', 'bar.in') + +test.run(arguments="bar.out foo.out", + stdout=re.escape(test.wrap_stdout("""\ +copy2(["bar.mid"], ["bar.in"]) +copy1(["bar.out"], ["bar.mid"]) +copy2(["foo.mid"], ["foo.in"]) +copy1(["foo.out"], ["foo.mid"]) +""")), + stderr = expect) + +test.up_to_date(arguments='bar.out foo.out', stderr=None) + + + +# Change the code in the the copy2() function, which should change +# its content and trigger a rebuild of the targets built with it. + +write_SConstruct(test, 'x = 2 # added this line', 'build', 'content') + +test.run(arguments="bar.out foo.out", + stdout=re.escape(test.wrap_stdout("""\ +copy2(["bar.mid"], ["bar.in"]) +copy1(["bar.out"], ["bar.mid"]) +copy2(["foo.mid"], ["foo.in"]) +scons: `foo.out' is up to date. +""")), + stderr = expect) + + + +# Swapping content and build signatures no longer causes a rebuild +# because we record the right underlying information regardless. + +write_SConstruct(test, 'x = 2 # added this line', 'content', 'build') + +test.up_to_date(arguments="bar.out foo.out", stderr=None) + + + +# Change the code in the the copy2() function back again, which should +# trigger another rebuild of the targets built with it. + +write_SConstruct(test, '', 'content', 'build') + +test.run(arguments='bar.out foo.out', + stdout=re.escape(test.wrap_stdout("""\ +copy2(["bar.mid"], ["bar.in"]) +scons: `bar.out' is up to date. +copy2(["foo.mid"], ["foo.in"]) +copy1(["foo.out"], ["foo.mid"]) +""")), + stderr = expect) + + + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/TargetSignatures/Old/content.py b/test/Removed/TargetSignatures/Old/content.py new file mode 100644 index 0000000..aca63f3 --- /dev/null +++ b/test/Removed/TargetSignatures/Old/content.py @@ -0,0 +1,95 @@ +#!/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 use of the TargetSignatures('content') setting to override +SourceSignatures('timestamp') settings. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +expect = TestSCons.re_escape(""" +scons: warning: The env.SourceSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + TestSCons.re_escape(""" +scons: warning: The env.TargetSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + + +test.write('SConstruct', """\ +SetOption('warn', 'deprecated-source-signatures') +SetOption('warn', 'deprecated-target-signatures') +env = Environment() + +def copy(env, source, target): + with open(str(target[0]), 'wb') as ofp: + for s in source: + with open(str(s), 'rb') as ifp: + ofp.write(ifp.read()) + +copyAction = Action(copy, "Copying $TARGET") + +SourceSignatures('timestamp') + +env['BUILDERS']['Copy'] = Builder(action=copyAction) + +env.Copy('foo.out', 'foo.in') + +env2 = env.Clone() +env2.TargetSignatures('content') +env2.Copy('bar.out', 'bar.in') +AlwaysBuild('bar.out') + +env.Copy('final', ['foo.out', 'bar.out', 'extra.in']) +env.Ignore('final', 'extra.in') +""") + +test.write('foo.in', "foo.in\n") +test.write('bar.in', "bar.in\n") +test.write('extra.in', "extra.in 1\n") + +test.run(stderr = expect) + +test.must_match('final', "foo.in\nbar.in\nextra.in 1\n") + +test.sleep() +test.write('extra.in', "extra.in 2\n") + +test.run(stderr = expect) + +test.must_match('final', "foo.in\nbar.in\nextra.in 1\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/Removed/TargetSignatures/Old/overrides.py b/test/Removed/TargetSignatures/Old/overrides.py new file mode 100644 index 0000000..54a66d4 --- /dev/null +++ b/test/Removed/TargetSignatures/Old/overrides.py @@ -0,0 +1,64 @@ +#!/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__" + +""" +Make sure that TargetSignatures() works when overrides are used on a +Builder call. Previous implementations used methods that would stay +bound to the underlying construction environment and cause weird +behavior like infinite recursion. +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConstruct', """\ +SetOption('warn', 'deprecated-target-signatures') +env = Environment() +env.TargetSignatures('content') +env.Command('foo.out', 'foo.mid', Copy('$TARGET', '$SOURCE'), FOO=1) +env.Command('foo.mid', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=2) +""") + +test.write('foo.in', "foo.in\n") + +expect = TestSCons.re_escape(""" +scons: warning: The env.TargetSignatures() method is deprecated; +\tconvert your build to use the env.Decider() method instead. +""") + TestSCons.file_expr + +test.run(arguments = '.', stderr = expect) + +test.must_match('foo.mid', "foo.in\n") +test.must_match('foo.out', "foo.in\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/Removed/TargetSignatures/Old/sconstest.skip b/test/Removed/TargetSignatures/Old/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/Removed/TargetSignatures/README.md b/test/Removed/TargetSignatures/README.md new file mode 100644 index 0000000..00a8b6b --- /dev/null +++ b/test/Removed/TargetSignatures/README.md @@ -0,0 +1,6 @@ +TargetSignatures.py is the "new" test, only makes sure scons actually +fails in the presence of the method or setoption call. + +The Old directory is the former tests from the deprecated state, +preserved here for reference; the presence of an scontest.skip file +means they are never executed. diff --git a/test/Removed/TargetSignatures/SConstruct.method b/test/Removed/TargetSignatures/SConstruct.method new file mode 100644 index 0000000..5e974b6 --- /dev/null +++ b/test/Removed/TargetSignatures/SConstruct.method @@ -0,0 +1 @@ +TargetSignatures('MD5') diff --git a/test/Removed/TargetSignatures/SConstruct.setopt b/test/Removed/TargetSignatures/SConstruct.setopt new file mode 100644 index 0000000..c887ce4 --- /dev/null +++ b/test/Removed/TargetSignatures/SConstruct.setopt @@ -0,0 +1 @@ +SetOption('warn', 'deprecated-target-signatures') diff --git a/test/Removed/TargetSignatures/TargetSignatures.py b/test/Removed/TargetSignatures/TargetSignatures.py new file mode 100644 index 0000000..0b3a37b --- /dev/null +++ b/test/Removed/TargetSignatures/TargetSignatures.py @@ -0,0 +1,52 @@ +#!/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 TargetSignatures and its associated warning flag +are definitely gone. +""" + +import TestSCons + +test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) + +test.file_fixture('SConstruct.method', 'SConstruct') +test.run(arguments='-Q -s', status=2, stdout=None, + stderr="""\ +NameError: name 'TargetSignatures' is not defined: + File ".+SConstruct", line 1: + TargetSignatures('MD5') +""") + +test.file_fixture('SConstruct.setopt', 'SConstruct') +test.run(arguments="-Q -s", status=0, stdout=None, + stderr="""\ +No warning type: 'deprecated-target-signatures' +No warning type: 'deprecated-target-signatures' +""") + +test.pass_test() + diff --git a/test/implicit-cache/basic.py b/test/implicit-cache/basic.py index c03a320..7eece88 100644 --- a/test/implicit-cache/basic.py +++ b/test/implicit-cache/basic.py @@ -27,11 +27,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify basic interactions of the --implicit-cache-* options. -This test used to set TargetSignatures('build') because we were -relying on the old behavior of non-essential changes in .h files -propagate to cause a rebuilt executable. We now just rely on -the default Decider('content') behavior and only check for the -rebuild of the object file itself when necessary. +We rely on the default Decider('content') behavior and only +check for the rebuild of the object file itself when necessary. """ import os.path diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py index 24ffaf7..34737d5 100644 --- a/test/sconsign/script/Signatures.py +++ b/test/sconsign/script/Signatures.py @@ -28,9 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Verify that the sconsign script works when using a .sconsign file in each subdirectory (SConsignFile(None)) written with the non-default value of Decider('timestamp-newer'). - -This used to test the non-default combination of -SourceSignatures('timestamp') with TargetSignatures('content'). """ import TestSCons diff --git a/test/srcchange.py b/test/srcchange.py index f1f67c1..c2356b6 100644 --- a/test/srcchange.py +++ b/test/srcchange.py @@ -29,9 +29,8 @@ Test changing the C source files based on an always-executed revision extraction and substitution. This makes sure we evaluate the content of intermediate files as -expected. We used to configure this explicitly using -TargetSignatures('content') but we now rely on the default behavior -being the equivalent of Decider('content'). +expected. This relies on the default behavior being the equivalent +of Decider('content'). """ import os.path diff --git a/test/subdivide.py b/test/subdivide.py index a4a128e..9461d4b 100644 --- a/test/subdivide.py +++ b/test/subdivide.py @@ -29,9 +29,8 @@ Verify that rebuilds do not occur when SConsignFile(None) is used to put a .sconsign file in each directory and we subdvide the dependency tree with subsidiary *SConstruct* files in various subdirectories. -This depends on using content signatures for evaluation of intermediate -Nodes. We used to configure this explicitly using -TargetSignatures('content'), but we now rely on the default behavior +This depends on using content signatures for evaluation of +intermediate Nodes. This relies on the default behavior being the equivalent of Decider('content'). """ -- cgit v0.12 From 9c900844191f129d899dd48cc2fa96f9539d4ff6 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 21 Oct 2019 13:42:39 -0600 Subject: [PR 3464] rework new tests so they match stderr The re.DOTALL match function somehow wasn't matching the SConstruct error path, so build it up from known information instead. Signed-off-by: Mats Wichmann --- test/Removed/SourceSignatures/SourceSignatures.py | 15 ++++++++++----- test/Removed/TargetSignatures/TargetSignatures.py | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/test/Removed/SourceSignatures/SourceSignatures.py b/test/Removed/SourceSignatures/SourceSignatures.py index fcc5e43..014c163 100644 --- a/test/Removed/SourceSignatures/SourceSignatures.py +++ b/test/Removed/SourceSignatures/SourceSignatures.py @@ -31,15 +31,15 @@ are definitely gone. import TestSCons -test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) +test = TestSCons.TestSCons() test.file_fixture('SConstruct.method', 'SConstruct') -test.run(arguments='-Q -s', status=2, stdout=None, - stderr="""\ +expect = """\ NameError: name 'SourceSignatures' is not defined: - File ".+SConstruct", line 1: + File "{}", line 1: SourceSignatures('MD5') -""") +""".format(test.workpath('SConstruct')) +test.run(arguments='-Q -s', status=2, stdout=None, stderr=expect) test.file_fixture('SConstruct.setopt', 'SConstruct') test.run(arguments='-Q -s', status=0, stdout=None, @@ -50,3 +50,8 @@ No warning type: 'deprecated-source-signatures' test.pass_test() +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Removed/TargetSignatures/TargetSignatures.py b/test/Removed/TargetSignatures/TargetSignatures.py index 0b3a37b..889f992 100644 --- a/test/Removed/TargetSignatures/TargetSignatures.py +++ b/test/Removed/TargetSignatures/TargetSignatures.py @@ -31,15 +31,15 @@ are definitely gone. import TestSCons -test = TestSCons.TestSCons(match=TestSCons.match_re_dotall) +test = TestSCons.TestSCons() test.file_fixture('SConstruct.method', 'SConstruct') -test.run(arguments='-Q -s', status=2, stdout=None, - stderr="""\ +expect = """\ NameError: name 'TargetSignatures' is not defined: - File ".+SConstruct", line 1: + File "{}", line 1: TargetSignatures('MD5') -""") +""".format(test.workpath('SConstruct')) +test.run(arguments='-Q -s', status=2, stdout=None, stderr=expect) test.file_fixture('SConstruct.setopt', 'SConstruct') test.run(arguments="-Q -s", status=0, stdout=None, @@ -50,3 +50,8 @@ No warning type: 'deprecated-target-signatures' test.pass_test() +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 88387d1ebd5e7ee4c18f32a331ff5ad9d419dd9d Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 21 Oct 2019 14:01:34 -0600 Subject: [PR 3464] quiet sider complaints unused imports in a pair of tests that were moved and thus "touched". Signed-off-by: Mats Wichmann --- test/Removed/SourceSignatures/Old/env.py | 1 - test/Removed/SourceSignatures/Old/no-csigs.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/test/Removed/SourceSignatures/Old/env.py b/test/Removed/SourceSignatures/Old/env.py index c63b176..bf86d4d 100644 --- a/test/Removed/SourceSignatures/Old/env.py +++ b/test/Removed/SourceSignatures/Old/env.py @@ -29,7 +29,6 @@ Test that use of env.SourceSignatures() correctly overrides the default behavior. """ -import os import re import TestSCons diff --git a/test/Removed/SourceSignatures/Old/no-csigs.py b/test/Removed/SourceSignatures/Old/no-csigs.py index c4f2a78..60c0460 100644 --- a/test/Removed/SourceSignatures/Old/no-csigs.py +++ b/test/Removed/SourceSignatures/Old/no-csigs.py @@ -25,8 +25,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os - import TestSCons import TestSConsign -- cgit v0.12