summaryrefslogtreecommitdiffstats
path: root/tests/crashme
diff options
context:
space:
mode:
Diffstat (limited to 'tests/crashme')
-rw-r--r--tests/crashme/run_tests.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/crashme/run_tests.py b/tests/crashme/run_tests.py
index 93f62cd..ccb4775 100644
--- a/tests/crashme/run_tests.py
+++ b/tests/crashme/run_tests.py
@@ -3,6 +3,7 @@ import subprocess
import pathlib
import os
import json
+import threading
from plugins.agl_test_base import AGLBaseTest
@@ -10,6 +11,30 @@ class CrashmeBase(AGLBaseTest):
def __init__(self):
super().__init__(name="crashme")
+ def killer(self):
+ killer_cmd = "killall -15 crashme"
+ subprocess.run(killer_cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+
+ # killer eta due to env variable "STRESS_VALE", 5 per cent larger than runtime in spec file
+ def setup_killer_eta_timer(self):
+ # Get env 'STRESS_LEVEL'
+ env_dist=os.environ
+ local_stress_level = str(env_dist.get("STRESS_LEVEL"))
+
+ # If not set correctly or just not set, set default to "low"
+ if local_stress_level not in ("low", "mid", "high"):
+ local_stress_level = "low"
+
+ # expected_runtime_limit is counted by seconds, spare 5 per cent jam time
+ if local_stress_level == "low":
+ expected_runtime_limit = 945
+ elif local_stress_level == "mid":
+ expected_runtime_limit = 1890
+ elif local_stress_level == "high":
+ expected_runtime_limit = 3780
+
+ return expected_runtime_limit
+
def setup_runtest_params(self):
# Get env 'STRESS_LEVEL'
env_dist=os.environ
@@ -50,6 +75,11 @@ class CrashmeBase(AGLBaseTest):
' | grep "^Test complete\\|^exit status\\|' + \
'^child_kill_count\\|[.]\\{3\\}\\|^Number of distinct cases"'
+ # call killer to come ETA in some seconds
+ eta_time = self.setup_killer_eta_timer()
+ countdown = threading.Timer(eta_time, self.killer)
+ countdown.start()
+
with open(log_file, 'w') as log_f:
run_test_crashme = subprocess.run(run_test_cmd, shell=True,
cwd=cwd_buf, stdout=log_f, stderr=subprocess.DEVNULL)