Table of Contents
It is possible to run/debug Phantom VM in user mode (pvm_test), see PhantomTestEnvironment.
There's a special class ru.dz.phantom.system.regression_tests.ph (plib/sys/src/ru.dz) which contains tests for both compiler (.ph frontend and codegen) and virtual machine. These tests are automatically run on every clean start of kernel.
Result can be seen in kernel log (run/serial0.log, QEMU serial port log file)
Phantom language regression tests are running Checking flow control operators... passed Checking int math... passed Checking arrays... Beeping: beep two! beep one! beep zero! passed Checking .internal.directory class operations... new passed Finished compiler regression tests
See also Running
test/plc directory contains regress tests for plc compiler. There are correct copies of compiler listing files. Tests run compiler on .ph source files and compare listing outputs with stored ones.
Currently are in tools/plc/src/test/toPhantom, but shall come to plib/java/src/test/toPhantom eventually. Shall be run as above.
There are two ways to run kernel code unit tests.
There is an unit-test environment right in kernel, it will be run if kernel is started with -test all command line parameter, as in kernel=(hd0,0)/boot/phantom -d=20 -- -test all grub boot command.
Some of unit tests can be compiled and run as an user mode application. See /test/unut directory and makefile in /test.
Directory test/external contains tool to be run from outside of kernel and communicate with kernel with TCP/UDP.
(Unfinished) debugger lives in tools/pdb. Again, connects to Phantom VM test env (see pvm_test above). It must connect to real kernel also, TBD.