From 198c2f2d555b8e9e08fcf545f56540af718ae026 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 5 Jun 2017 13:20:04 +0530 Subject: [PATCH] unit tests: Skip tests if no readelf found --- run_unittests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run_unittests.py b/run_unittests.py index 21b1109c1..63f6def3a 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -37,8 +37,12 @@ from run_tests import ensure_backend_detects_changes def get_dynamic_section_entry(fname, entry): - raw_out = subprocess.check_output(['readelf', '-d', fname], - universal_newlines=True) + try: + raw_out = subprocess.check_output(['readelf', '-d', fname], + universal_newlines=True) + except FileNotFoundError: + # FIXME: Try using depfixer.py:Elf() as a fallback + raise unittest.SkipTest('readelf not found') pattern = re.compile(entry + r': \[(.*?)\]') for line in raw_out.split('\n'): m = pattern.search(line)