scx/scripts/bpftrace_stress_wrapper.sh
likewhatevs bf68679d35
Setup "debugging" and misc cleanup (#695)
* Fix a couple of misc errors in build scripts.
* Tweak scripts/kconfigs to make bpftrace work.
* Update how CI caching works to make builds faster (6 minute turnaround
  time)
* Update CI config to generate per-scheduler debug archives w/ guest
  dmesg/scheduler stdout, guest stdout, bpftrace script output,
  veristat output.

* Update build scripts to accept the following:
** VNG RW -- write to host filesystem (better caching, logging).
* For stress tests in particular (via ini config):
** QEMU Opts -- to facilitate reproducing bugs (i.e. high core count).
** bpftrace scripts -- specify bpftrace scripts to run during stress
tests.
2024-09-26 11:11:10 -04:00

49 lines
965 B
Bash
Executable File

#!/bin/bash
set +x
STRESS_CMD="$1"
SCHED_CMD="$2"
TIMEOUT_SEC="$3"
BPFTRACE_SCRIPTS="$4"
KERNEL_HEADERS="$5"
echo $PWD
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
for a in $(echo "$BPFTRACE_SCRIPTS" | tr ',' ' '); do
BPFTRACE_KERNEL_SOURCE=${KERNEL_HEADERS} bpftrace -o "$a.ci.log" $SCRIPT_DIR/$a &
done
$STRESS_CMD > stress_cmd.ci.log 2>&1 &
STRESS_PID=$!
timeout --foreground --preserve-status $TIMEOUT_SEC $SCHED_CMD > sched_output.ci.log 2>&1 &
STATUS_PID=$!
# 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)
for a in $(echo "$BPFTRACE_SCRIPTS" | tr ',' ' '); do
echo "$a OUTPUT"
cat "$a.ci.log"
echo "$a OUTPUT DONE"
done
echo "STRESS OUTPUT"
cat stress_cmd.ci.log
echo "STRESS OUTPUT DONE"
# if anything isn't right, exit non 0 so we know.
wait $STRESS_PID
wait $STATUS_PID