summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-12-14 04:11:49 (GMT)
committerGitHub <noreply@github.com>2020-12-14 04:11:49 (GMT)
commite64123b82ec401e3b34aefd3f9524b8a69f0d214 (patch)
treeef4a72b6780765c8cc31c62202f8306a57bcf48b
parent465d508842fee8f7b9b693567b1dbde3b896fbf3 (diff)
parent4ab992d0ce34ed12141975082e23a36ccde4d310 (diff)
downloadSCons-e64123b82ec401e3b34aefd3f9524b8a69f0d214.zip
SCons-e64123b82ec401e3b34aefd3f9524b8a69f0d214.tar.gz
SCons-e64123b82ec401e3b34aefd3f9524b8a69f0d214.tar.bz2
Merge pull request #3817 from grossag/topic/grossag/clearcachednodeinfo
Fix invalid cache state when using SCons interactive mode
-rwxr-xr-xCHANGES.txt2
-rw-r--r--SCons/Node/FSTests.py7
-rw-r--r--SCons/Node/NodeTests.py2
-rw-r--r--SCons/Node/__init__.py10
4 files changed, 17 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 631a89a..6c154ed 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -38,6 +38,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
User-facing behavior does not change with this fix (GH Issue #3726).
- Fix occasional test failures caused by not being able to find a file or directory fixture
when running multiple tests with multiple jobs.
+ - Fix incorrect cache hits and/or misses when running in interactive mode by having
+ SCons.Node.Node.clear() clear out all caching-related state.
From Joachim Kuebart:
- Suppress missing SConscript deprecation warning if `must_exist=False`
diff --git a/SCons/Node/FSTests.py b/SCons/Node/FSTests.py
index 17914c1..1f886d7 100644
--- a/SCons/Node/FSTests.py
+++ b/SCons/Node/FSTests.py
@@ -3726,6 +3726,13 @@ class clearTestCase(unittest.TestCase):
assert not f.exists()
assert not f.rexists()
assert str(f) == test.workpath('f'), str(f)
+ # Now verify clear() resets optional File-specific attributes
+ optional_attrs = ['cachedir_csig', 'cachesig', 'contentsig']
+ for attr in optional_attrs:
+ setattr(f, attr, 'xyz')
+ f.clear()
+ for attr in optional_attrs:
+ assert not hasattr(f, attr), attr
class disambiguateTestCase(unittest.TestCase):
diff --git a/SCons/Node/NodeTests.py b/SCons/Node/NodeTests.py
index 6e240d4..29a3887 100644
--- a/SCons/Node/NodeTests.py
+++ b/SCons/Node/NodeTests.py
@@ -1297,6 +1297,7 @@ class NodeTestCase(unittest.TestCase):
n.includes = 'testincludes'
n.Tag('found_includes', {'testkey':'testvalue'})
n.implicit = 'testimplicit'
+ n.cached = 1
x = MyExecutor()
n.set_executor(x)
@@ -1304,6 +1305,7 @@ class NodeTestCase(unittest.TestCase):
n.clear()
assert n.includes is None, n.includes
+ assert n.cached == 0, n.cached
assert x.cleaned_up
def test_get_subst_proxy(self):
diff --git a/SCons/Node/__init__.py b/SCons/Node/__init__.py
index b0c2485..3685af3 100644
--- a/SCons/Node/__init__.py
+++ b/SCons/Node/__init__.py
@@ -861,10 +861,12 @@ class Node(object, metaclass=NoSlotsPyPy):
self.clear_memoized_values()
self.ninfo = self.new_ninfo()
self.executor_cleanup()
- try:
- delattr(self, '_calculated_sig')
- except AttributeError:
- pass
+ for attr in ['cachedir_csig', 'cachesig', 'contentsig']:
+ try:
+ delattr(self, attr)
+ except AttributeError:
+ pass
+ self.cached = 0
self.includes = None
def clear_memoized_values(self):