diff options
Diffstat (limited to 'src/engine/SCons/ActionTests.py')
| -rw-r--r-- | src/engine/SCons/ActionTests.py | 36 | 
1 files changed, 31 insertions, 5 deletions
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 1b11eea..9372240 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -21,7 +21,7 @@  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  # -__revision__ = "src/engine/SCons/ActionTests.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog" +__revision__ = "src/engine/SCons/ActionTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"  # Define a null function and a null class for use as builder actions. @@ -44,6 +44,7 @@ import re  import sys  import types  import unittest +import subprocess  import SCons.Action  import SCons.Environment @@ -1529,6 +1530,7 @@ class CommandGeneratorActionTestCase(unittest.TestCase):              (3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),              (3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),              (3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), +            (3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),          }          meth_matches = [ @@ -1554,19 +1556,19 @@ class CommandGeneratorActionTestCase(unittest.TestCase):          assert c == func_matches[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + repr(              func_matches[sys.version_info[:2]]) -        def f_global(target, source, env, for_signature): +        def f_global2(target, source, env, for_signature):              return SCons.Action.Action(GlobalFunc, varlist=['XYZ']) -        def f_local(target, source, env, for_signature): +        def f_local2(target, source, env, for_signature):              return SCons.Action.Action(LocalFunc, varlist=['XYZ'])          matches_foo = func_matches[sys.version_info[:2]] + b'foo' -        a = self.factory(f_global) +        a = self.factory(f_global2)          c = a.get_contents(target=[], source=[], env=env)          assert c in matches_foo, repr(c) -        a = self.factory(f_local) +        a = self.factory(f_local2)          c = a.get_contents(target=[], source=[], env=env)          assert c in matches_foo, repr(c) @@ -1707,6 +1709,7 @@ class FunctionActionTestCase(unittest.TestCase):              (3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),              (3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),              (3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), +            (3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),          } @@ -1715,6 +1718,7 @@ class FunctionActionTestCase(unittest.TestCase):              (3, 5): bytearray(b'1, 1, 0, 0,(),(),(d\x00\x00S),(),()'),              (3, 6): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),              (3, 7): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), +            (3, 8): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'),          }          def factory(act, **kw): @@ -1959,6 +1963,7 @@ class LazyActionTestCase(unittest.TestCase):              (3, 5): bytearray(b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'),              (3, 6): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),              (3, 7): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), +            (3, 8): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'),          }          meth_matches = [ @@ -2017,6 +2022,7 @@ class ActionCallerTestCase(unittest.TestCase):              (3, 5): b'd\x00\x00S',              (3, 6): b'd\x00S\x00',              (3, 7): b'd\x00S\x00', +            (3, 8): b'd\x00S\x00',          } @@ -2217,6 +2223,7 @@ class ObjectContentsTestCase(unittest.TestCase):              (3, 5): bytearray(b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()'),              (3, 6): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),              (3, 7): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'), +            (3, 8): bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),          }          c = SCons.Action._function_contents(func1) @@ -2242,6 +2249,8 @@ class ObjectContentsTestCase(unittest.TestCase):                  b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"),              (3, 7): bytearray(                  b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"), +            (3, 8): bytearray( +                b"{TestClass:__main__}[[[(<class \'object\'>, ()), [(<class \'__main__.TestClass\'>, (<class \'object\'>,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(d\x01|\x00_\x00d\x02|\x00_\x01d\x00S\x00),(),(),2, 2, 0, 0,(),(),(d\x00S\x00),(),()}}{{{a=a,b=b}}}"),          }          assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr( @@ -2259,11 +2268,28 @@ class ObjectContentsTestCase(unittest.TestCase):              (3, 5): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)'),              (3, 6): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'),              (3, 7): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'), +            (3, 8): bytearray(b'0, 0, 0, 0,(Hello, World!),(print),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)'),          }          assert c == expected[sys.version_info[:2]], "Got\n" + repr(c) + "\nExpected \n" + "\n" + repr(expected[              sys.version_info[:2]]) +    def test_uncaught_exception_bubbles(self): +        """Test that _subproc bubbles uncaught exceptions""" +        try: +            pobj = SCons.Action._subproc(Environment(), +                                         None, +                                         stdin='devnull', +                                         stderr='devnull', +                                         stdout=subprocess.PIPE) +            pobj.wait() +        except EnvironmentError: +            pass +        except Exception: +            # pass the test +            return + +        raise Exception("expected a non-EnvironmentError exception")  if __name__ == "__main__":      unittest.main()  | 
