toaruos/userspace/core-tests.c
Kevin Lange bba242dd62 Add a testing framework.
This is an automated system by which we boot qemu headless and use the
serial line to capture output from a testing application that is started
on bootup, running with the VGA terminal shell. This might be expanded
to boot to the graphical display within VNC and perform more advanced
tests with the Python shim using a VNC module for Python; we'll see.
2012-09-02 02:24:25 -07:00

31 lines
757 B
C

#include <stdio.h>
#include <stdarg.h>
#include <syscall.h>
#define INFO(...) notice("INFO", __VA_ARGS__)
#define WARN(...) notice("WARN", __VA_ARGS__)
#define DONE(...) notice("DONE", __VA_ARGS__)
#define PASS(...) notice("PASS", __VA_ARGS__)
#define FAIL(...) notice("FAIL", __VA_ARGS__)
#define FATAL(...) notice("FATAL", __VA_ARGS__)
void notice(char * type, char * fmt, ...) {
va_list argp;
va_start(argp, fmt);
/* core-tests header */
syscall_print("core-tests : ");
syscall_print(type);
syscall_print(" : ");
/* end core-tests header */
char buffer[1024];
vsnprintf(buffer, 1024, fmt, argp);
syscall_print(buffer);
syscall_print("\n");
}
int main(int argc, char * argv[]) {
INFO("Hello world!");
DONE("Finished tests!");
}