diff options
author | Jacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com> | 2021-11-09 17:45:16 (GMT) |
---|---|---|
committer | Jacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com> | 2021-11-09 17:45:16 (GMT) |
commit | 699d6b0d571827de973e027d765f64b629f08ed9 (patch) | |
tree | 2c96c3c72a94b2cfea0bcbc41b2715c5bd4b7b2f /testing | |
parent | 1dc541ef4dafed2cd7af68d23856dd99dd7b5644 (diff) | |
download | SCons-699d6b0d571827de973e027d765f64b629f08ed9.zip SCons-699d6b0d571827de973e027d765f64b629f08ed9.tar.gz SCons-699d6b0d571827de973e027d765f64b629f08ed9.tar.bz2 |
Tests pass in python 3.6 and 3.9 in Linux
Modified failing tests to use the new defaulted .sconsign database based on the hash algorithm
For MD5, default database will be .sconsign.dblite
For other algorithms the default will be .sconsign_<hashname>.dblite.
For all cases where the user changes the hash algorithm used, the database will be .sconsign_<hashname>.dblite (including md5)
For sub-scons directories it remains as .sconsign
Also added unit-tests for Util.py for the new hash default changes.
It's difficult to setup a fips-compliant platform using containers, and instead we mock that.
option--config uses multiple types of hash algorithms so was skipped.
Removed one f-string (python 3.5 doesn't support those)
Corrupt.py is using an explicit .sconsign so that was left as-is, and only the parent default .sconsign was changed for work test 1.
A fetch-database name option was added to the testing framework.
The unlink_sconsignfile was not updated as no usages of it were found.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestSCons.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 2a19818..29bd123 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -45,6 +45,7 @@ from collections import namedtuple from TestCommon import * from TestCommon import __all__ +from SCons.Util import get_hash_format, get_current_hash_algorithm_used from TestCmd import Popen from TestCmd import PIPE @@ -719,6 +720,27 @@ class TestSCons(TestCommon): for p in patterns: result.extend(sorted(glob.glob(p))) return result + + def get_sconsignname(self): + """Get the scons database name used, and return both the prefix and full filename. + if the user left the options defaulted AND the default algorithm set by + SCons is md5, then set the database name to be the special default name + + otherwise, if it defaults to something like 'sha1' or the user explicitly + set 'md5' as the hash format, set the database name to .sconsign_<algorithm> + eg .sconsign_sha1, etc. + + Returns: + a pair containing: the current dbname, the dbname.dblite filename + """ + hash_format = get_hash_format() + current_hash_algorithm = get_current_hash_algorithm_used() + if hash_format is None and current_hash_algorithm == 'md5': + return ".sconsign" + else: + database_prefix=".sconsign_%s" % current_hash_algorithm + return database_prefix + def unlink_sconsignfile(self, name='.sconsign.dblite'): """Delete the sconsign file. |