3 | | Part of HelenOS [wiki:CI continuous testing] are also tests that are executed inside HelenOS. That is, we launch a VM (QEMU or MSIM at the moment) and check that command executed inside HelenOS gives the expected output. This page contains a brief overview of how to write such tests and how to run them. |
| 3 | Part of HelenOS [wiki:CI continuous testing] are also tests that are executed inside HelenOS. That is, we launch a VM (QEMU or MSIM at the moment) and check that command executed inside HelenOS gives the expected output. This page contains a brief overview of how to write such testing scenarios and how to run them. |
| 4 | |
| 5 | |
| 6 | == Prerequisites |
| 7 | |
| 8 | For this to work, you need to have Python 3, QEMU, ImageMagick (i.e. `convert` command) and SED. For testing on mips32, you will also need MSIM, Xvfb (or Xephyr), xterm and xdotool. |
| 15 | For this image, we choose to run a scenario where we compile and run a Hello, World! program written in C. Scenarios are located under `scenarios` folder in CI repository, their format will be described later on. |
| 16 | |
| 17 | To actually run the scenario, we launch the `test-in-vm.py` script and specify path to the boot image, architecture and path to the scenario. Advanced options will be described later. |
| 18 | |
| 19 | {{{ |
| 20 | ./test-in-vm.py \ |
| 21 | --arch amd64 \ |
| 22 | --image helenos-amd64-with-binutils-pcc.iso \ |
| 23 | --scenario scenarios/coast/pcc/hello.yml |
| 24 | }}} |
| 25 | |
| 26 | When you run this script, you will see that it starts QEMU with HelenOS and waits until the terminal appears. Then it automatically types commands that compiles `hello.c` and launches the compiled `a.out` binary. QEMU is then terminated and if all went okay, we will see a message about successful pass of the scenario (or error message explaining the reason for failure). |
| 27 | |