diff options
author | William Deegan <bill@baddogconsulting.com> | 2021-07-21 21:08:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 21:08:14 (GMT) |
commit | f1961a01a79f7d910ef78b76b8cd33b05fd29d1d (patch) | |
tree | 472901d6c75b060671a2ee332d4c13d3fa0c969c | |
parent | c72d768db1028ba4b9c76fb1d3ea59dc92b26f21 (diff) | |
parent | 209dea8fed5dd17751a374341da381a25a10316e (diff) | |
download | SCons-f1961a01a79f7d910ef78b76b8cd33b05fd29d1d.zip SCons-f1961a01a79f7d910ef78b76b8cd33b05fd29d1d.tar.gz SCons-f1961a01a79f7d910ef78b76b8cd33b05fd29d1d.tar.bz2 |
Merge pull request #3980 from dmoody256/testing_ninja_mongo
make multi target and intermediate SConf files marked is_conftest
-rwxr-xr-x | CHANGES.txt | 4 | ||||
-rwxr-xr-x | RELEASE.txt | 2 | ||||
-rw-r--r-- | SCons/Builder.py | 4 | ||||
-rw-r--r-- | SCons/SConf.py | 20 | ||||
-rw-r--r-- | SCons/SConfTests.py | 2 | ||||
-rw-r--r-- | test/Configure/is_conftest/fixture/SConstruct | 24 | ||||
-rw-r--r-- | test/Configure/is_conftest/fixture/sconstest.skip | 0 | ||||
-rw-r--r-- | test/Configure/is_conftest/is_conftest.py | 47 |
8 files changed, 91 insertions, 12 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index ccc2b21..a50e8ac 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -70,8 +70,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 6886739..dc3415f 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 38eadf8..9472345 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: + 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 38a2b94..0ad712d 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/SCons/SConfTests.py b/SCons/SConfTests.py index 008dfc2..1badad8 100644 --- a/SCons/SConfTests.py +++ b/SCons/SConfTests.py @@ -168,7 +168,7 @@ class SConfTestCase(unittest.TestCase): # need action because temporary file name uses hash of actions get_contents() self.action = MyAction() - def __call__(self, env, target, source): + def __call__(self, env, target, source, *args, **kw): class MyNode: def __init__(self, name): self.name = name diff --git a/test/Configure/is_conftest/fixture/SConstruct b/test/Configure/is_conftest/fixture/SConstruct new file mode 100644 index 0000000..b0d4288 --- /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(conf.confdir.path + '/*'): + 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 0000000..e69de29 --- /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 0000000..8dab66d --- /dev/null +++ b/test/Configure/is_conftest/is_conftest.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# MIT License +# +# Copyright The SCons Foundation +# +# 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. + +""" +Verify is_conftest is marking nodes, even for intermediate files. +""" + +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: |