summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <dmoody256@gmail.com>2021-07-20 13:38:49 -0500
committerDaniel Moody <dmoody256@gmail.com>2021-07-20 14:08:26 -0500
commit051d06b45c0628bfaf391ab7a4ee91c1424a1aeb (patch)
treefdc5d54eca1e2548ab1f2c502f87804e13bee106
parent3fa73b75c1fa7591dab51746cd78dd0685d65e9f (diff)
downloadscons-git-051d06b45c0628bfaf391ab7a4ee91c1424a1aeb.tar.gz
make sure multi target and intermediate SConf files are mark is_conftest
-rwxr-xr-xCHANGES.txt4
-rwxr-xr-xRELEASE.txt2
-rw-r--r--SCons/Builder.py4
-rw-r--r--SCons/SConf.py20
-rw-r--r--test/Configure/is_conftest/fixture/SConstruct24
-rw-r--r--test/Configure/is_conftest/fixture/sconstest.skip0
-rw-r--r--test/Configure/is_conftest/is_conftest.py48
7 files changed, 91 insertions, 11 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index ccf231cf0..4d370e9e0 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -68,8 +68,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
object.
- Fix a potential race condition in shared cache environments where the permissions are
not writeable for a moment after the file has been renamed and other builds (users) will copy
- it out of the cacheSmall reorganization of logic to copy files from cachedir. Moved CacheDir
+ it out of the cache. Small reorganization of logic to copy files from cachedir. Moved CacheDir
writeable permission code for copy to cache behind the atomic rename operation.
+ - Added marking of intermediate and and multi target nodes generated from SConf tests so that
+ is_conftest() is more accurate.
From Mats Wichmann:
diff --git a/RELEASE.txt b/RELEASE.txt
index 688673980..dc3415f53 100755
--- a/RELEASE.txt
+++ b/RELEASE.txt
@@ -76,6 +76,8 @@ FIXES
not writeable for a moment after the file has been renamed and other builds (users) will copy
it out of the cacheSmall reorganization of logic to copy files from cachedir. Moved CacheDir
writeable permission code for copy to cache behind the atomic rename operation.
+ - Fixed intermediate and and multi target nodes generated from SConf tests not being marked
+ as is_conftest().
IMPROVEMENTS
diff --git a/SCons/Builder.py b/SCons/Builder.py
index 38eadf83e..1178884b1 100644
--- a/SCons/Builder.py
+++ b/SCons/Builder.py
@@ -613,6 +613,10 @@ class BuilderBase:
t.set_executor(executor)
t.set_explicit(self.is_explicit)
+ if env.get("SCONF_NODE"):
+ for node in tlist + slist:
+ node.attributes.conftest_node = 1
+
return SCons.Node.NodeList(tlist)
def __call__(self, env, target=None, source=None, chdir=_null, **kw):
diff --git a/SCons/SConf.py b/SCons/SConf.py
index 38a2b945a..0ad712d20 100644
--- a/SCons/SConf.py
+++ b/SCons/SConf.py
@@ -73,6 +73,9 @@ FORCE=1 # force all tests to be rebuilt
CACHE=2 # force all tests to be taken from cache (raise an error, if necessary)
cache_mode = AUTO
+def _set_conftest_node(node):
+ node.attributes.conftest_node = 1
+
def SetCacheMode(mode):
"""Set the Configure cache mode. mode must be one of "auto", "force",
or "cache"."""
@@ -518,7 +521,7 @@ class SConfBase:
# we override the store_info() method with a null place-holder
# so we really control how it gets written.
for n in nodes:
- self._set_conftest_node(n)
+ _set_conftest_node(n)
n.store_info = 0
if not hasattr(n, 'attributes'):
n.attributes = SCons.Node.Node.Attrs()
@@ -531,7 +534,7 @@ class SConfBase:
for c in n.children(scan=False):
# Keep debug code here.
# print("Checking [%s] for builders and then setting keep_targetinfo"%c)
- self._set_conftest_node(c)
+ _set_conftest_node(c)
if c.has_builder():
n.store_info = 0
if not hasattr(c, 'attributes'):
@@ -596,7 +599,7 @@ class SConfBase:
nodesToBeBuilt = []
sourcetext = self.env.Value(text)
- self._set_conftest_node(sourcetext)
+ _set_conftest_node(sourcetext)
f = "conftest"
if text is not None:
@@ -606,14 +609,14 @@ class SConfBase:
f = "_".join([f, textSig, textSigCounter])
textFile = self.confdir.File(f + extension)
- self._set_conftest_node(textFile)
+ _set_conftest_node(textFile)
textFileNode = self.env.SConfSourceBuilder(target=textFile,
source=sourcetext)
nodesToBeBuilt.extend(textFileNode)
source = textFile
target = textFile.File(f + "SConfActionsContentDummyTarget")
- self._set_conftest_node(target)
+ _set_conftest_node(target)
else:
source = None
target = None
@@ -625,14 +628,14 @@ class SConfBase:
pref = self.env.subst( builder.builder.prefix )
suff = self.env.subst( builder.builder.suffix )
target = self.confdir.File(pref + f + suff)
- self._set_conftest_node(target)
+ _set_conftest_node(target)
try:
# Slide our wrapper into the construction environment as
# the SPAWN function.
self.env['SPAWN'] = self.pspawn_wrapper
- nodes = builder(target = target, source = source)
+ nodes = builder(target = target, source = source, SCONF_NODE=True)
if not SCons.Util.is_List(nodes):
nodes = [nodes]
nodesToBeBuilt.extend(nodes)
@@ -733,9 +736,6 @@ class SConfBase:
if not os.path.isdir( dirName ):
os.makedirs( dirName )
- def _set_conftest_node(self, node):
- node.attributes.conftest_node = 1
-
def _startup(self):
"""Private method. Set up logstream, and set the environment
variables necessary for a piped build
diff --git a/test/Configure/is_conftest/fixture/SConstruct b/test/Configure/is_conftest/fixture/SConstruct
new file mode 100644
index 000000000..8118db285
--- /dev/null
+++ b/test/Configure/is_conftest/fixture/SConstruct
@@ -0,0 +1,24 @@
+"""
+Test the nodes are created as conftest nodes in configure tests.
+"""
+import sys
+DefaultEnvironment(tools=[])
+
+env = Environment()
+
+conf = Configure(env)
+if sys.platform == "win32":
+ conf.env.Append(
+ CCFLAGS="/DEBUG /Z7 /INCREMENTAL:NO",
+ LINKFLAGS="/DEBUG /INCREMENTAL:NO",
+ PDB='${TARGET.base}.pdb')
+if not conf.TryRun("int main( int argc, char* argv[] ){return 0;}", '.c'):
+ print("FAIL")
+
+env = conf.Finish()
+
+for node in env.Glob('.sconf_temp/*'):
+ if not node.is_conftest():
+ print("FAIL")
+
+
diff --git a/test/Configure/is_conftest/fixture/sconstest.skip b/test/Configure/is_conftest/fixture/sconstest.skip
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/Configure/is_conftest/fixture/sconstest.skip
diff --git a/test/Configure/is_conftest/is_conftest.py b/test/Configure/is_conftest/is_conftest.py
new file mode 100644
index 000000000..58dbdfeac
--- /dev/null
+++ b/test/Configure/is_conftest/is_conftest.py
@@ -0,0 +1,48 @@
+#!/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 is_conftest is marking nodes.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.file_fixture('./fixture/SConstruct')
+
+test.run('-Q --silent')
+
+if "FAIL" in test.stdout():
+ test.fail_test()
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: