2024-09-25 22:20:36 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-09-26 16:11:10 +01:00
|
|
|
set +x
|
|
|
|
|
2024-09-25 22:20:36 +01:00
|
|
|
STRESS_CMD="$1"
|
|
|
|
SCHED_CMD="$2"
|
|
|
|
TIMEOUT_SEC="$3"
|
|
|
|
BPFTRACE_SCRIPTS="$4"
|
2024-09-26 16:11:10 +01:00
|
|
|
KERNEL_HEADERS="$5"
|
|
|
|
|
|
|
|
echo $PWD
|
2024-09-25 22:20:36 +01:00
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
|
|
|
|
|
|
for a in $(echo "$BPFTRACE_SCRIPTS" | tr ',' ' '); do
|
2024-09-26 16:11:10 +01:00
|
|
|
BPFTRACE_KERNEL_SOURCE=${KERNEL_HEADERS} bpftrace -o "$a.ci.log" $SCRIPT_DIR/$a &
|
2024-09-25 22:20:36 +01:00
|
|
|
done
|
|
|
|
|
2024-09-26 16:11:10 +01:00
|
|
|
$STRESS_CMD > stress_cmd.ci.log 2>&1 &
|
2024-09-25 22:20:36 +01:00
|
|
|
|
|
|
|
STRESS_PID=$!
|
|
|
|
|
2024-09-26 16:11:10 +01:00
|
|
|
timeout --foreground --preserve-status $TIMEOUT_SEC $SCHED_CMD > sched_output.ci.log 2>&1 &
|
2024-09-25 22:20:36 +01:00
|
|
|
|
|
|
|
STATUS_PID=$!
|
|
|
|
|
2024-09-26 16:11:10 +01:00
|
|
|
# wait for scheduler to exit
|
|
|
|
tail --pid=$STATUS_PID -f sched_output.ci.log
|
|
|
|
|
|
|
|
# wait for stress to exit, ignore err
|
|
|
|
wait $STRESS_PID || true
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
killall -w 10s $(jobs -p)
|
2024-09-25 22:20:36 +01:00
|
|
|
|
|
|
|
for a in $(echo "$BPFTRACE_SCRIPTS" | tr ',' ' '); do
|
|
|
|
echo "$a OUTPUT"
|
2024-09-26 16:11:10 +01:00
|
|
|
cat "$a.ci.log"
|
2024-09-25 22:20:36 +01:00
|
|
|
echo "$a OUTPUT DONE"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "STRESS OUTPUT"
|
2024-09-26 16:11:10 +01:00
|
|
|
cat stress_cmd.ci.log
|
2024-09-25 22:20:36 +01:00
|
|
|
echo "STRESS OUTPUT DONE"
|
|
|
|
|
|
|
|
# if anything isn't right, exit non 0 so we know.
|
|
|
|
wait $STRESS_PID
|
2024-09-26 16:11:10 +01:00
|
|
|
wait $STATUS_PID
|