Skip to content

Commit 17b9ec7

Browse files
committed
hijack.sh: kill the cavstool.py after the test
we need to kill the cavstool.py process after the test to prevent the conflicts between each case. Signed-off-by: Keqiao Zhang <keqiao.zhang@intel.com>
1 parent e9b371f commit 17b9ec7

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

case-lib/hijack.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,18 @@ function func_exit_handler()
5454
# shellcheck disable=SC2154
5555
logfile="$logfile"
5656

57-
local loggerBin wcLog; loggerBin=$(basename "$SOFLOGGER")
58-
# We need this to avoid the confusion of a "Terminated" message
57+
local loggerBin wcLog; loggerBin=$(basename "$SOFLOGGER");
58+
local cavstoolBin=cavstool.py
59+
60+
# We need this dlogi to avoid the confusion of a "Terminated" message
5961
# without context.
62+
if is_zephyr; then
63+
dlogi "pkill -TERM -f $cavstoolBin"
64+
sudo pkill -TERM -f "$cavstoolBin" || {
65+
dloge "cavstool.py was already dead"
66+
exit_status=1
67+
}
68+
fi
6069
dlogi "pkill -TERM $loggerBin"
6170
sudo pkill -TERM "$loggerBin" || {
6271
dloge "sof-logger was already dead"
@@ -76,11 +85,16 @@ function func_exit_handler()
7685
fi
7786
}
7887
sleep 1s
79-
if pgrep "$loggerBin"; then
80-
dloge "$loggerBin resisted pkill -TERM, using -KILL"
81-
sudo pkill -KILL "$loggerBin"
82-
exit_status=1
83-
fi
88+
89+
local logtool
90+
for logtool in "$cavstoolBin" "$loggerBin"
91+
do
92+
if pgrep -f "$logtool"; then
93+
dloge "$logtool resisted pkill -TERM, using -KILL"
94+
sudo pkill -KILL -f "$logtool"
95+
exit_status=1
96+
fi
97+
done
8498

8599
if test -e "$logfile"; then
86100

0 commit comments

Comments
 (0)