test/scheduling/run 1.3 KiB raw
1
#!/bin/sh
2
# Execute root handoff and successive user-space yields with the production packages.
3
set -eu
4
emulator=${RAD_EMULATOR:-emulator}
5
harts=${1:-1 2 8}
6
work=$(mktemp -d)
7
trap 'rm -rf "$work"' EXIT HUP INT TERM
8
cp kernel/kernel.rad "$work/kernel.rad"
9
printf '\nexport mod dispatchcheck;\n' >> "$work/kernel.rad"
10
mkdir "$work/kernel"
11
cp kernel/kernel/*.rad "$work/kernel/"
12
cp test/scheduling/kernel/dispatchcheck.rad "$work/kernel/"
13
sed -i '/let cause = trap::classify(frame.cause);/a\    super::dispatchcheck::observe(frame);' "$work/kernel/boot.rad"
14
sh test/acceptance/compile "$emulator" "$work"
15
cat test/scheduling/machine.ras kernel/kernel/*.ras > "$work/scheduling.ras"
16
"$emulator" -memory-size=385024 -data-size=348160 -stack-size=1024 -run bin/kernel.build.rv64 \
17
    -- "$work/std.ril" "$work/kernel.ril" "$work/scheduling.ras" "$work/scheduling.rv64" bin/root.ril bin/scheduler.ril
18
for count in $harts; do
19
    if [ "${KERNEL_REPLAY:-0}" = 1 ]; then
20
        sh test/acceptance/replay scheduling "$emulator" "$work/scheduling.rv64" "$count"
21
    else
22
    "$emulator" -machine -harts="$count" -memory-size=262144 -max-steps=2000000000 -run "$work/scheduling.rv64"
23
    fi
24
    printf 'scheduling: %s-hart root handoff, four user-space yields, and checked shutdown passed\n' "$count"
25
done