ack/tests/plat/lib/test.c
David Given 8a58614aef Rework the tests to run on pc86; lots of test fixes for the brk() test, which
was nearly useless; lots of fixes to qemuppc and pc86 sbrk(), which was broken;
change the pc86 console to echo output to the serial port (needed for running
tests on qemu).
2016-11-26 11:23:25 +01:00

32 lines
515 B
C

#include "test.h"
/* No CRT in this file (this includes stdio and stdlib!). */
void finished(void)
{
static const char s[] = "@@FINISHED\n";
write(1, s, sizeof(s));
}
void writehex(uint32_t code)
{
char buf[8];
char* p = &buf[sizeof(buf)];
do
{
*--p = "0123456789abcdef"[code & 0xf];
code >>= 4;
}
while (code > 0);
write(1, p, buf + sizeof(buf) - p);
}
void fail(uint32_t code)
{
write(1, "@@FAIL 0x", 10);
writehex(code);
write(1, "\n", 1);
}