summaryrefslogtreecommitdiff
path: root/src/engine/SCons/ExecutorTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/ExecutorTests.py')
-rw-r--r--src/engine/SCons/ExecutorTests.py41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py
index 105256e..519dff0 100644
--- a/src/engine/SCons/ExecutorTests.py
+++ b/src/engine/SCons/ExecutorTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2016 The SCons Foundation
+# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/ExecutorTests.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
+__revision__ = "src/engine/SCons/ExecutorTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
import sys
import unittest
@@ -53,7 +53,11 @@ class MyAction(object):
def genstring(self, target, source, env):
return ' '.join(['GENSTRING'] + list(map(str, self.actions)) + target + source)
def get_contents(self, target, source, env):
- return ' '.join(self.actions + target + source)
+ return b' '.join(
+ [SCons.Util.to_bytes(aa) for aa in self.actions] +
+ [SCons.Util.to_bytes(tt) for tt in target] +
+ [SCons.Util.to_bytes(ss) for ss in source]
+ )
def get_implicit_deps(self, target, source, env):
return []
@@ -70,8 +74,12 @@ class MyNode(object):
self.pre_actions = pre
self.post_actions = post
self.missing_val = None
+ self.always_build = False
+ self.up_to_date = False
+
def __str__(self):
return self.name
+
def build(self):
executor = SCons.Executor.Executor(MyAction(self.pre_actions +
[self.builder.action] +
@@ -96,6 +104,9 @@ class MyNode(object):
def disambiguate(self):
return self
+ def is_up_to_date(self):
+ return self.up_to_date
+
class MyScanner(object):
def __init__(self, prefix):
self.prefix = prefix
@@ -311,7 +322,7 @@ class ExecutorTestCase(unittest.TestCase):
try:
r = x.prepare()
- except SCons.Errors.StopError, e:
+ except SCons.Errors.StopError as e:
assert str(e) == "Source `s2' not found, needed by target `t1'.", e
else:
raise AssertionError("did not catch expected StopError: %s" % r)
@@ -381,14 +392,14 @@ class ExecutorTestCase(unittest.TestCase):
x = SCons.Executor.Executor(MyAction(), env, [], ['t'], ['s'])
c = x.get_contents()
- assert c == 'action1 action2 t s', c
+ assert c == b'action1 action2 t s', c
x = SCons.Executor.Executor(MyAction(actions=['grow']), env, [],
['t'], ['s'])
x.add_pre_action(MyAction(['pre']))
x.add_post_action(MyAction(['post']))
c = x.get_contents()
- assert c == 'pre t sgrow t spost t s', c
+ assert c == b'pre t sgrow t spost t s', c
def test_get_timestamp(self):
"""Test fetching the "timestamp" """
@@ -451,6 +462,24 @@ class ExecutorTestCase(unittest.TestCase):
r = x.get_unignored_sources(None, [s1, s3])
assert r == [s2], list(map(str, r))
+ def test_changed_sources_for_alwaysBuild(self):
+ """
+ Ensure if a target is marked always build that the sources are always marked changed sources
+ :return:
+ """
+ env = MyEnvironment()
+ s1 = MyNode('s1')
+ s2 = MyNode('s2')
+ t1 = MyNode('t1')
+ t1.up_to_date = True
+ t1.always_build = True
+
+ x = SCons.Executor.Executor('b', env, [{}], [t1], [s1, s2])
+
+ changed_sources = x._get_changed_sources()
+ assert changed_sources == [s1, s2], "If target marked AlwaysBuild sources should always be marked changed"
+
+
if __name__ == "__main__":