aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xafdo_tools/bisection/afdo_prof_analysis.py6
-rwxr-xr-xafdo_tools/bisection/afdo_prof_analysis_e2e_test.py19
-rwxr-xr-xafdo_tools/bisection/problemstatus_external.sh3
3 files changed, 26 insertions, 2 deletions
diff --git a/afdo_tools/bisection/afdo_prof_analysis.py b/afdo_tools/bisection/afdo_prof_analysis.py
index 095adf0c..d974a7a8 100755
--- a/afdo_tools/bisection/afdo_prof_analysis.py
+++ b/afdo_tools/bisection/afdo_prof_analysis.py
@@ -142,6 +142,12 @@ class DeciderState(object):
if return_code in statuses:
status = StatusEnum(return_code)
+ if status == StatusEnum.PROBLEM_STATUS:
+ prof_file = prof_to_tmp(prof)
+ raise RuntimeError('Provided decider script returned PROBLEM_STATUS '
+ 'when run on profile stored at %s. AFDO Profile '
+ 'analysis aborting' % prof_file)
+
if save_run:
self.accumulated_results.append(status.value)
logging.info('Run %d of external script %s returned %s',
diff --git a/afdo_tools/bisection/afdo_prof_analysis_e2e_test.py b/afdo_tools/bisection/afdo_prof_analysis_e2e_test.py
index 3f7c844a..f95d46e7 100755
--- a/afdo_tools/bisection/afdo_prof_analysis_e2e_test.py
+++ b/afdo_tools/bisection/afdo_prof_analysis_e2e_test.py
@@ -112,13 +112,28 @@ class AfdoProfAnalysisE2ETest(unittest.TestCase):
loaded_run = json.load(f)
self.assertEqual(initial_run, loaded_run)
+ def test_exit_on_problem_status(self):
+ temp_dir = tempfile.mkdtemp()
+ self.addCleanup(shutil.rmtree, temp_dir, ignore_errors=True)
+
+ fd_state, state_file = tempfile.mkstemp(dir=temp_dir)
+ os.close(fd_state)
+ with self.assertRaises(RuntimeError):
+ self.run_check(
+ self.good_prof,
+ self.bad_prof,
+ self.expected,
+ state_file=state_file,
+ extern_decider='problemstatus_external.sh')
+
def run_check(self,
good_prof,
bad_prof,
expected,
state_file=None,
no_resume=True,
- out_file=None):
+ out_file=None,
+ extern_decider=None):
temp_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, temp_dir, ignore_errors=True)
@@ -139,7 +154,7 @@ class AfdoProfAnalysisE2ETest(unittest.TestCase):
analysis.FLAGS.analysis_output_file = out_file or '/dev/null'
dir_path = os.path.dirname(os.path.realpath(__file__)) # dir of this file
- external_script = '%s/e2e_external.sh' % (dir_path)
+ external_script = '%s/%s' % (dir_path, extern_decider or 'e2e_external.sh')
analysis.FLAGS.external_decider = external_script
actual = analysis.main(None)
diff --git a/afdo_tools/bisection/problemstatus_external.sh b/afdo_tools/bisection/problemstatus_external.sh
new file mode 100755
index 00000000..3b53875b
--- /dev/null
+++ b/afdo_tools/bisection/problemstatus_external.sh
@@ -0,0 +1,3 @@
+#!/bin/bash -eu
+
+exit 127