Skip to content
Dmitry Zavalishin edited this page Jul 25, 2017 · 4 revisions
Clone this wiki locally

Table of Contents

Test instruments and environments


VM test environment

It is possible to run/debug Phantom VM in user mode (pvm_test), see PhantomTestEnvironment.

VM/compiler unit tests

There's a special class (plib/sys/src/ 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 class operations... new passed
Finished compiler regression tests

See also Running

Phantom language compiler regress tests

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.

Java compiler unit tests

Currently are in tools/plc/src/test/toPhantom, but shall come to plib/java/src/test/toPhantom eventually. Shall be run as above.

Kernel unit tests

There are two ways to run kernel code unit tests.

Kernel mode

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.

Hosted mode

Some of unit tests can be compiled and run as an user mode application. See /test/unut directory and makefile in /test.

External tests

Directory test/external contains tool to be run from outside of kernel and communicate with kernel with TCP/UDP.

Phantom Debugger

(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.