Enable tests for linuxppc via qemu-ppc.

This commit is contained in:
David Given 2016-11-26 11:56:17 +01:00
parent 90e3d45c69
commit cf33bd6cc4
6 changed files with 36 additions and 12 deletions

View file

@ -14,6 +14,7 @@ vars.plats = {
"rpi",
}
vars.plats_with_tests = {
"linuxppc",
"qemuppc",
"pc86",
}

View file

@ -26,7 +26,6 @@ void* sbrk(int increment)
{
char* old;
char* new;
char* actual;
if (!current)
current = (char*) _syscall(__NR_brk, 0, 0, 0);
@ -35,15 +34,21 @@ void* sbrk(int increment)
return current;
old = current;
new = old + increment;
actual = (char*) _syscall(__NR_brk, (quad) new, 0, 0);
if (actual < new)
{
errno = ENOMEM;
return OUT_OF_MEMORY;
}
if ((increment > 0) && (new <= old))
goto out_of_memory;
else if ((increment < 0) && (new >= old))
goto out_of_memory;
if (brk(new) < 0)
goto out_of_memory;
current = actual;
return old;
out_of_memory:
errno = ENOMEM;
return OUT_OF_MEMORY;
}

View file

@ -0,0 +1,7 @@
include("tests/plat/build.lua")
plat_testsuite {
name = "tests",
plat = "linuxppc",
method = "qemu-ppc"
}

View file

@ -10,10 +10,6 @@ int main(int argc, const char* argv[])
char* o;
char* p;
errno = 0;
ASSERT(-1 == brk((void*)-1));
ASSERT(ENOMEM == errno);
p = sbrk(0);
ASSERT(p == sbrk(0));
ASSERT(p == sbrk(8));

View file

@ -6,6 +6,7 @@ void finished(void)
{
static const char s[] = "@@FINISHED\n";
write(1, s, sizeof(s));
_exit(0);
}
void writehex(uint32_t code)

View file

@ -31,6 +31,20 @@ case $method in
| ( read dummy && kill $(cat $pidfile) )
;;
qemu-*)
if ! hash $method 2>/dev/null; then
echo "Warning: $method not installed, skipping test"
exit 0
fi
$method $img > $result
;;
*)
echo "Error: $method not known by testdriver"
exit 1
;;
esac
( grep -q @@FAIL $result || ! grep -q @@FINISHED $result ) && cat $result && exit 1