38.16.1.5. Magic failure string

We do not know of any way to set the emulator exit status in QEMU arm full system.

For other arch / emulator combinations, we know how to do it:

Since we can’t do it for QEMU arm, the only reliable solution is to just parse the guest serial output for a magic failure string to check if tests failed.

Our run scripts parse the serial output looking for a line line containing only exactly the magic regular expression:

lkmc_exit_status_(\d+)

and then exit with the given regular expression, e.g.:

./run --arch aarch64 baremetal/return2.c
echo $?

should output:

2

This magic output string is notably generated by:

Beware that on Linux kernel simulations, you cannot even echo that string from userland, since userland stdout shows up on the serial.