summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-03-04 09:47:16 -0500
committerGitHub <noreply@github.com>2019-03-04 09:47:16 -0500
commitd6f6ae54248286a4501f683654f1bc54a2ade591 (patch)
tree6e09642b68b346ea7531769a5e4d72808b9a9d66
parent54354a11e1b4273490cf0410bcd45837c2979aed (diff)
parent9fe21847c4c987792326d515a851b673d96af930 (diff)
downloadscons-git-d6f6ae54248286a4501f683654f1bc54a2ade591.tar.gz
Merge pull request #3317 from bdbaddog/fix_win_md5_decider_malfunction_on_fresh_build
MD5-Timestamp was causing build failures on windows only. (Mesa Project affected)
-rw-r--r--src/engine/SCons/Node/FS.py58
-rw-r--r--test/Decider/MD5-winonly-firstbuild.py60
-rw-r--r--test/Decider/MD5-winonly-fixture/SConstruct10
-rw-r--r--test/Decider/MD5-winonly-fixture/sconstest.skip0
-rw-r--r--test/Decider/MD5-winonly-fixture/test_lex.l10
-rw-r--r--test/Decider/MD5-winonly-fixture/test_parse.y43
6 files changed, 174 insertions, 7 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 77c340f2a..61054f319 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -61,6 +61,8 @@ from . import DeciderNeedsNode
print_duplicate = 0
+MD5_TIMESTAMP_DEBUG = False
+
def sconsign_none(node):
raise NotImplementedError
@@ -3335,20 +3337,42 @@ class File(Base):
List of csigs for provided list of children
"""
prev = []
+ # MD5_TIMESTAMP_DEBUG = False
+
+ if len(dmap) == 0:
+ if MD5_TIMESTAMP_DEBUG: print("Nothing dmap shortcutting")
+ return None
+ if MD5_TIMESTAMP_DEBUG: print("len(dmap):%d"%len(dmap))
# First try the simple name for node
c_str = str(self)
+ if MD5_TIMESTAMP_DEBUG: print("Checking :%s"%c_str)
+ df = dmap.get(c_str, None)
+ if df:
+ return df
+
if os.altsep:
c_str = c_str.replace(os.sep, os.altsep)
- df = dmap.get(c_str, None)
+ df = dmap.get(c_str, None)
+ if MD5_TIMESTAMP_DEBUG: print("-->%s"%df)
+ if df:
+ return df
+
if not df:
try:
# this should yield a path which matches what's in the sconsign
c_str = self.get_path()
+ df = dmap.get(c_str, None)
+ if MD5_TIMESTAMP_DEBUG: print("-->%s"%df)
+ if df:
+ return df
+
if os.altsep:
c_str = c_str.replace(os.sep, os.altsep)
-
- df = dmap.get(c_str, None)
+ df = dmap.get(c_str, None)
+ if MD5_TIMESTAMP_DEBUG: print("-->%s"%df)
+ if df:
+ return df
except AttributeError as e:
raise FileBuildInfoFileToCsigMappingError("No mapping from file name to content signature for :%s"%c_str)
@@ -3388,16 +3412,36 @@ class File(Base):
dependency_map = self._build_dependency_map(bi)
rebuilt = True
- prev_ni = self._get_previous_signatures(dependency_map)
+ if len(dependency_map) == 0:
+ # If there's no dependency map, there's no need to find the
+ # prev_ni as there aren't any
+ # shortcut the rest of the logic
+ if MD5_TIMESTAMP_DEBUG: print("Skipping checks len(dmap)=0")
+
+ # We still need to get the current file's csig
+ # This should be slightly faster than calling self.changed_content(target, new_prev_ni)
+ self.get_csig()
+ return True
+
+ new_prev_ni = self._get_previous_signatures(dependency_map)
+ new = self.changed_timestamp_match(target, new_prev_ni)
+
+ if MD5_TIMESTAMP_DEBUG:
+ old = self.changed_timestamp_match(target, prev_ni)
+
+ if old != new:
+ print("Mismatch self.changed_timestamp_match(%s, prev_ni) old:%s new:%s"%(str(target), old, new))
+ new_prev_ni = self._get_previous_signatures(dependency_map)
+
- if not self.changed_timestamp_match(target, prev_ni):
+ if not new:
try:
# NOTE: We're modifying the current node's csig in a query.
- self.get_ninfo().csig = prev_ni.csig
+ self.get_ninfo().csig = new_prev_ni.csig
except AttributeError:
pass
return False
- return self.changed_content(target, prev_ni)
+ return self.changed_content(target, new_prev_ni)
def changed_timestamp_newer(self, target, prev_ni):
try:
diff --git a/test/Decider/MD5-winonly-firstbuild.py b/test/Decider/MD5-winonly-firstbuild.py
new file mode 100644
index 000000000..87f799988
--- /dev/null
+++ b/test/Decider/MD5-winonly-firstbuild.py
@@ -0,0 +1,60 @@
+#!/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 but which only shows on windows when one generated file depends on another generated file
+In this case flex and yacc are an example.
+"""
+
+import os
+import stat
+
+import TestSCons
+from TestCmd import IS_WINDOWS
+
+
+test = TestSCons.TestSCons()
+
+if IS_WINDOWS:
+ yacc = test.where_is('yacc') or test.where_is('bison') or test.where_is('win_bison')
+ lex = test.where_is('flex') or test.where_is('lex') or test.where_is('win_flex')
+ # print("Lex:%s yacc:%s"%(lex,yacc))
+ if not yacc or not lex:
+ test.skip_test("On windows but no flex/lex/win_flex and yacc/bison/win_bison required for test\n")
+else:
+ test.skip_test("Windows only test\n")
+
+
+test.dir_fixture('MD5-winonly-fixture')
+test.run()
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Decider/MD5-winonly-fixture/SConstruct b/test/Decider/MD5-winonly-fixture/SConstruct
new file mode 100644
index 000000000..9775a43ff
--- /dev/null
+++ b/test/Decider/MD5-winonly-fixture/SConstruct
@@ -0,0 +1,10 @@
+DefaultEnvironment(tools=[])
+env=Environment()
+env.Decider('MD5-timestamp')
+env.AppendENVPath('PATH', r'd:\mesa\flexbison')
+env.Tool('lex')
+env.Tool('yacc')
+env['YACCFLAGS'] = '-d'
+if env['YACC'] == 'win_flex':
+ env.Append(LEXFLAGS = ['--wincompat'])
+env.SharedLibrary('dummy',['test_lex.l','test_parse.y'])
diff --git a/test/Decider/MD5-winonly-fixture/sconstest.skip b/test/Decider/MD5-winonly-fixture/sconstest.skip
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/Decider/MD5-winonly-fixture/sconstest.skip
diff --git a/test/Decider/MD5-winonly-fixture/test_lex.l b/test/Decider/MD5-winonly-fixture/test_lex.l
new file mode 100644
index 000000000..269b98487
--- /dev/null
+++ b/test/Decider/MD5-winonly-fixture/test_lex.l
@@ -0,0 +1,10 @@
+%{
+
+#include <stdio.h>
+#include "test_parse.h"
+int c;
+%}
+%%
+
+%%
+
diff --git a/test/Decider/MD5-winonly-fixture/test_parse.y b/test/Decider/MD5-winonly-fixture/test_parse.y
new file mode 100644
index 000000000..3ead9d2b8
--- /dev/null
+++ b/test/Decider/MD5-winonly-fixture/test_parse.y
@@ -0,0 +1,43 @@
+%{
+#include<stdio.h>
+
+int regs[26];
+int base;
+
+%}
+
+%start digit
+
+%union { int a; }
+
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /*supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+digit: DIGIT;
+
+
+%%
+main()
+{
+ return(yyparse());
+}
+
+yyerror(s)
+char *s;
+{
+ fprintf(stderr, "%s\n",s);
+ return(0);
+}
+
+yywrap()
+{
+ return(1);
+} \ No newline at end of file