Adding an initial ddekit test.

Change-Id: I0522449bb7bbbb23efc132ede3a02da95efe0326
This commit is contained in:
Kees Jongenburger 2014-03-25 16:02:31 +01:00 committed by Lionel Sambuc
parent 0673998dad
commit eaa642e09d
7 changed files with 123 additions and 1 deletions

View file

@ -5791,6 +5791,10 @@
./usr/tests/minix-posix/blocktest/support.sh minix-sys ./usr/tests/minix-posix/blocktest/support.sh minix-sys
./usr/tests/minix-posix/blocktest/system.conf minix-sys ./usr/tests/minix-posix/blocktest/system.conf minix-sys
./usr/tests/minix-posix/blocktest/test.sh minix-sys ./usr/tests/minix-posix/blocktest/test.sh minix-sys
./usr/tests/minix-posix/ddekit minix-sys
./usr/tests/minix-posix/ddekit/ddekittest minix-sys
./usr/tests/minix-posix/ddekit/ddekittest_driver minix-sys
./usr/tests/minix-posix/ddekit/system.conf minix-sys
./usr/tests/minix-posix/mod minix-sys pic ./usr/tests/minix-posix/mod minix-sys pic
./usr/tests/minix-posix/run minix-sys ./usr/tests/minix-posix/run minix-sys
./usr/tests/minix-posix/t10a minix-sys ./usr/tests/minix-posix/t10a minix-sys

View file

@ -175,6 +175,7 @@
/set type=dir uid=2 gid=0 mode=755 /set type=dir uid=2 gid=0 mode=755
./usr/tests/minix-posix ./usr/tests/minix-posix
./usr/tests/minix-posix/blocktest ./usr/tests/minix-posix/blocktest
./usr/tests/minix-posix/ddekit
# this one is for term(1) # this one is for term(1)
/set type=dir uid=0 gid=5 mode=775 /set type=dir uid=0 gid=5 mode=775

View file

@ -16,7 +16,8 @@ LDADD+= -lm -lcompat_minix
.include <bsd.own.mk> .include <bsd.own.mk>
SUBDIR= blocktest SUBDIR+= blocktest
SUBDIR+= ddekit
# Some have special flags compiling # Some have special flags compiling
.if ${MACHINE_ARCH} == "i386" .if ${MACHINE_ARCH} == "i386"

17
test/ddekit/Makefile Normal file
View file

@ -0,0 +1,17 @@
# Makefile for the DDE kit Test driver (ddekitest)
PROG= ddekittest_driver
SRCS= ddekittest_driver.c
FILES= system.conf
SCRIPTS= ddekittest.sh
#uncomment the following for proper debugging
#CFLAGS+=-g
#LDFLAGS+= -Ttext=0x4000000
LDADD+= -lsys -lddekit -lminlib
DPADD+= ${LIBSYS} ${LIBDDEKIT} ${LIBMINLIB}
MAN=
BINDIR?= /usr/tests/minix-posix/ddekit
FILESDIR?= /usr/tests/minix-posix/ddekit
.include <minix.service.mk>

19
test/ddekit/ddekittest.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# Supporting routines for ddekit Do not run directly.
# usage: run_ddekittest
# runs the ddekit driver on the given device with the given parameters
run_ddekittest () {
if [ ! -x ddekittest_driver ]; then echo "compile ddekittest first!" >&2; exit 1; fi
service up `pwd`/ddekittest_driver -config system.conf \
-script /etc/rs.single -label ddekittest
}
#
# We do not have much here just calling the source run_ddekittest here
#
run_ddekittest
sleep 10
service down ddekittest

View file

@ -0,0 +1,75 @@
#include <ddekit/ddekit.h>
#include <ddekit/printf.h>
#include <ddekit/thread.h>
#include <ddekit/initcall.h>
#include <stdio.h>
void
long_running_thread()
{
int x=10;
do {
ddekit_printf("Long Running\n");
ddekit_thread_msleep(2000);
x--;
} while(x >0);
}
void
short_running_thread()
{
int x=15;
do {
ddekit_printf("Short Running\n");
ddekit_thread_msleep(500);
x--;
} while(x >0);
}
void ddekit_minix_wait_exit(void); /* import from dde-minix */
#if 0
#include <ucontext.h>
ucontext_t ctx;
#endif
int
main(void)
{
#if 0
getcontext(&ctx);
if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
printf("FLAG_NONE\n");
}
memset(&ctx,0,sizeof(ucontext_t));
ctx.uc_flags = _UC_IGNSIGM | _UC_IGNFPU;
getcontext(&ctx);
if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
printf("_UC_IGNSIGM | _UC_IGNFPU FAIL\n");
}
memset(&ctx,0,sizeof(ucontext_t));
ctx.uc_flags = _UC_IGNSIGM ;
getcontext(&ctx);
if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
printf("_UC_IGNSIGM FAIL\n");
}
memset(&ctx,0,sizeof(ucontext_t));
ctx.uc_flags = _UC_IGNFPU ;
getcontext(&ctx);
if (ctx.uc_mcontext.mc_magic != 0xc0ffee) {
printf("_UC_IGNFPU FAIL\n");
}
#endif
ddekit_init();
ddekit_thread_create(long_running_thread, NULL, "Long_thread");
ddekit_thread_create(short_running_thread, NULL, "Short_thread");
ddekit_minix_wait_exit();
return 0;
}

5
test/ddekit/system.conf Normal file
View file

@ -0,0 +1,5 @@
service ddekittest_driver {
uid 0;
system ALL;
ipc ALL;
};