From d5e8a048c87eac0361f14911a2d224bfb94884f0 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 30 Oct 2018 13:37:20 -0600 Subject: Fix some problems found if no MS compiler at all A few tests blew up with exceptions (AttributeError, IndexError) if no compiler is installed on Windows - from where they are it could possibly happen on other platforms as well. Signed-off-by: Mats Wichmann --- src/CHANGES.txt | 1 + testing/framework/TestCmd.py | 5 ++++- testing/framework/TestSCons.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index ddc7e60..f26769d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -165,6 +165,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE Three uses of variables not defined are changed. - Some script changes in trying to find scons engine - Update (pep8) configure-cache script, add a --show option. + - Fix for a couple of "what if tool not found" exceptions in framework. From Bernhard M. Wiedemann: - Update SCons' internal scons build logic to allow overriding build date diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index 96b8b5d..6699d88 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -1590,7 +1590,10 @@ class TestCmd(object): elif run < 0: run = len(self._stdout) + run run = run - 1 - return self._stdout[run] + try: + return self._stdout[run] + except IndexError: + return None def subdir(self, *subdirs): """Create new subdirectories under the temporary working diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 68641f0..69d4bd5 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -310,7 +310,7 @@ class TestSCons(TestCommon): if v != prog: return None result = env.WhereIs(prog) - if norm and os.sep != '/': + if result and norm and os.sep != '/': result = result.replace(os.sep, '/') return result -- cgit v0.12