aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoryanxk <yanxk.fnst@fujitsu.com>2022-10-14 08:11:47 +0800
committerQiu Tingting <qiutt@fujitsu.com>2023-01-13 02:27:12 +0000
commit6e6d8819c5bfdaee9ea62a3b961efe6090911633 (patch)
tree7863e21a27dd2b4d6300b6dd1027fe15c0a06c79 /tests
parent2b0b2c37da795ae77d006308c96a054734ab6d24 (diff)
agl-test-framework: make sure "crashme" would have return value
a fact is "crashme" would crash qemux86 under mid or high level, but low level looks fine, we provide kill -15 solution to solve "no return" hang up. so there will always be a return value. Bug-AGL: SPEC-4345 Signed-off-by: yanxk <yanxk.fnst@fujitsu.com> Change-Id: I3d9ebb64b8b57a64d0ca002f20cf908141099ad6
Diffstat (limited to 'tests')
-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)