Ensure that nOS-V aborts on ring overflow

This commit is contained in:
Rodrigo Arias 2024-07-31 14:38:54 +02:00 committed by Rodrigo Arias Mallo
parent 99dc3904af
commit a47082730a

View File

@ -28,7 +28,14 @@ ovni.level = 3
ovni.kernel_ringsize = ${ringsize} ovni.kernel_ringsize = ${ringsize}
EOF EOF
$target $ncs $nflush 2>&1 | tee err.log # Should fail in runtime
set +e
$target $ncs $nflush 2> err.log
rc=$?
set -e
# Dump log
cat err.log
# Ensure no nOS-V warnings at runtime # Ensure no nOS-V warnings at runtime
if grep -c "cannot enable kernel events" err.log; then if grep -c "cannot enable kernel events" err.log; then
@ -36,12 +43,13 @@ if grep -c "cannot enable kernel events" err.log; then
exit 1 exit 1
fi fi
# We need to sort the trace as it has unsorted regions # Ensure it detects the error
ovnisort ovni if ! grep -c "Kernel events lost" err.log; then
echo "cannot find 'Kernel events lost' error message" >&2
exit 1
fi
# Ensure we have at least the number of context switches we caused, and ensure if [ "$rc" == "0" ]; then
# the number of "in" and "out" events match. echo "program didn't failed" >&2
ovnitop ovni | awk '{n[$1] = $2} END { if (n["KCO"] != n["KCI"] || n["KCO"] < '$ncs') exit 1 }' exit 1
fi
# Run the emulator
ovniemu -l ovni