Adding threadtest to the build
This commit is contained in:
parent
02c0816e41
commit
a0a9f28e25
@ -163,6 +163,7 @@ SConscript('sys/SConscript', variant_dir='build/sys')
|
|||||||
SConscript('lib/libc/SConscript', variant_dir='build/lib/libc')
|
SConscript('lib/libc/SConscript', variant_dir='build/lib/libc')
|
||||||
SConscript('bin/shell/SConscript', variant_dir='build/bin/shell')
|
SConscript('bin/shell/SConscript', variant_dir='build/bin/shell')
|
||||||
SConscript('sbin/init/SConscript', variant_dir='build/sbin/init')
|
SConscript('sbin/init/SConscript', variant_dir='build/sbin/init')
|
||||||
|
SConscript('tests/SConscript', variant_dir='build/tests')
|
||||||
|
|
||||||
# Build Tools
|
# Build Tools
|
||||||
env["TOOLCHAINBUILD"] = "TRUE"
|
env["TOOLCHAINBUILD"] = "TRUE"
|
||||||
@ -184,6 +185,7 @@ if env["BOOTDISK"] == "1":
|
|||||||
Depends(bootdisk, "#build/bin/shell/shell")
|
Depends(bootdisk, "#build/bin/shell/shell")
|
||||||
Depends(bootdisk, "#build/sbin/init/init")
|
Depends(bootdisk, "#build/sbin/init/init")
|
||||||
Depends(bootdisk, "#build/sys/castor")
|
Depends(bootdisk, "#build/sys/castor")
|
||||||
|
Depends(bootdisk, "#build/tests/threadtest")
|
||||||
env.Alias('bootdisk', '#build/bootdisk.img')
|
env.Alias('bootdisk', '#build/bootdisk.img')
|
||||||
env.Install('$PREFIX/','#build/bootdisk.img')
|
env.Install('$PREFIX/','#build/bootdisk.img')
|
||||||
|
|
||||||
|
@ -10,5 +10,8 @@ DIR /
|
|||||||
DIR sbin
|
DIR sbin
|
||||||
FILE init build/sbin/init/init
|
FILE init build/sbin/init/init
|
||||||
END
|
END
|
||||||
|
DIR tests
|
||||||
|
FILE threadtest build/tests/threadtest
|
||||||
|
END
|
||||||
FILE LICENSE LICENSE
|
FILE LICENSE LICENSE
|
||||||
END
|
END
|
||||||
|
13
tests/SConscript
Normal file
13
tests/SConscript
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
Import('env')
|
||||||
|
|
||||||
|
test_env = env.Clone()
|
||||||
|
|
||||||
|
test_env.Append(LINKFLAGS = ['-nostdlib'])
|
||||||
|
test_env.Append(CPPFLAGS = ['-fno-builtin', '-nostdinc'])
|
||||||
|
test_env.Append(CPPPATH = ['#build/include'])
|
||||||
|
test_env.Append(LIBPATH = ['#build/lib/libc'], LIBS = ['c'])
|
||||||
|
|
||||||
|
test_env.Program("threadtest", ["threadtest.c"])
|
||||||
|
|
36
tests/threadtest.c
Normal file
36
tests/threadtest.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
// Castor Only
|
||||||
|
#include <syscall.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
threadEntry(uint64_t arg)
|
||||||
|
{
|
||||||
|
printf("Hello From Thread %d\n", arg);
|
||||||
|
OSThreadExit(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
printf("Thread Test\n");
|
||||||
|
OSThreadCreate((uintptr_t)&threadEntry, 2);
|
||||||
|
OSThreadCreate((uintptr_t)&threadEntry, 3);
|
||||||
|
OSThreadCreate((uintptr_t)&threadEntry, 4);
|
||||||
|
|
||||||
|
int result = OSThreadWait(0);
|
||||||
|
printf("Result %d\n", result);
|
||||||
|
result = OSThreadWait(0);
|
||||||
|
printf("Result %d\n", result);
|
||||||
|
result = OSThreadWait(0);
|
||||||
|
printf("Result %d\n", result);
|
||||||
|
|
||||||
|
printf("Success!\n");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user