diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2018-11-24 21:19:38 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-11-25 18:33:50 +0000 |
commit | 61e63bf4e14eddebdd99814cf2633c2e638cd21c (patch) | |
tree | bf1e33a58f38deb7628a5df94202b9b30c61c621 | |
parent | c2b4dc598149e9aa2e1727259257b2650f95c683 (diff) |
make test: Fix too wide subprocess exceptions
When a command fails, CalledProcessError is raised. testing with except: masks other failures.
Change-Id: I7e3a6739411cb6a4c13e96dd123aff9159213fea
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r-- | test/framework.py | 2 | ||||
-rw-r--r-- | test/test_jvpp.py | 2 | ||||
-rw-r--r-- | test/test_vcl.py | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/test/framework.py b/test/framework.py index 3c4aacb6354..c29346bf56c 100644 --- a/test/framework.py +++ b/test/framework.py @@ -348,7 +348,7 @@ class VppTestCase(unittest.TestCase): stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1) - except Exception as e: + except subprocess.CalledProcessError as e: cls.logger.critical("Couldn't start vpp: %s" % e) raise diff --git a/test/test_jvpp.py b/test/test_jvpp.py index 36dbdb2b391..6151ebdbb20 100644 --- a/test/test_jvpp.py +++ b/test/test_jvpp.py @@ -135,7 +135,7 @@ class TestJVpp(VppTestCase): self.logger.info("Process output : {0}{1}".format(os.linesep, out)) if self.process.returncode != 0: - raise Exception( + raise subprocess.CalledProcessError( "Command {0} failed with return code: {1}.{2}" "Process error output: {2}{3}" .format(command, self.process.returncode, os.linesep, err)) diff --git a/test/test_vcl.py b/test/test_vcl.py index fb358b7a1e9..6027ba75e7d 100644 --- a/test/test_vcl.py +++ b/test/test_vcl.py @@ -251,7 +251,7 @@ class VCLCutThruTestCase(VCLTestCase): try: subprocess.check_output(['iperf3', '-v']) - except: + except subprocess.CalledProcessError: self.logger.error("WARNING: 'iperf3' is not installed,") self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!") return @@ -496,7 +496,7 @@ class VCLThruHostStackIperfTestCase(VCLTestCase): try: subprocess.check_output(['iperf3', '-v']) - except: + except subprocess.CalledProcessError: self.logger.error("WARNING: 'iperf3' is not installed,") self.logger.error( " 'test_ldp_thru_host_stack_iperf3' not run!") @@ -811,7 +811,7 @@ class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase): try: subprocess.check_output(['iperf3', '-v']) - except: + except subprocess.CalledProcessError: self.logger.error("WARNING: 'iperf3' is not installed,") self.logger.error( " 'test_ldp_thru_host_stack_iperf3' not run!") |