From: Kees Jongenburger Date: Tue, 25 Mar 2014 15:02:31 +0000 (+0100) Subject: Adding an initial ddekit test. X-Git-Tag: v3.3.0~369 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.conf.5.html?a=commitdiff_plain;h=eaa642e09daa3812de70c986653383338def4b76;p=minix.git Adding an initial ddekit test. Change-Id: I0522449bb7bbbb23efc132ede3a02da95efe0326 --- diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index be1dd87a5..1faf7d093 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -5791,6 +5791,10 @@ ./usr/tests/minix-posix/blocktest/support.sh minix-sys ./usr/tests/minix-posix/blocktest/system.conf 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/run minix-sys ./usr/tests/minix-posix/t10a minix-sys diff --git a/etc/mtree/NetBSD.dist.base b/etc/mtree/NetBSD.dist.base index 2ad59c36f..209c71c03 100644 --- a/etc/mtree/NetBSD.dist.base +++ b/etc/mtree/NetBSD.dist.base @@ -175,6 +175,7 @@ /set type=dir uid=2 gid=0 mode=755 ./usr/tests/minix-posix ./usr/tests/minix-posix/blocktest +./usr/tests/minix-posix/ddekit # this one is for term(1) /set type=dir uid=0 gid=5 mode=775 diff --git a/test/Makefile b/test/Makefile index 307941127..80e59d494 100644 --- a/test/Makefile +++ b/test/Makefile @@ -16,7 +16,8 @@ LDADD+= -lm -lcompat_minix .include -SUBDIR= blocktest +SUBDIR+= blocktest +SUBDIR+= ddekit # Some have special flags compiling .if ${MACHINE_ARCH} == "i386" diff --git a/test/ddekit/Makefile b/test/ddekit/Makefile new file mode 100644 index 000000000..c3ccb30ea --- /dev/null +++ b/test/ddekit/Makefile @@ -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 diff --git a/test/ddekit/ddekittest.sh b/test/ddekit/ddekittest.sh new file mode 100755 index 000000000..9331282ea --- /dev/null +++ b/test/ddekit/ddekittest.sh @@ -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 diff --git a/test/ddekit/ddekittest_driver.c b/test/ddekit/ddekittest_driver.c new file mode 100644 index 000000000..e211d99df --- /dev/null +++ b/test/ddekit/ddekittest_driver.c @@ -0,0 +1,75 @@ +#include +#include +#include +#include + +#include + +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_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; +} diff --git a/test/ddekit/system.conf b/test/ddekit/system.conf new file mode 100644 index 000000000..55292cfa7 --- /dev/null +++ b/test/ddekit/system.conf @@ -0,0 +1,5 @@ +service ddekittest_driver { + uid 0; + system ALL; + ipc ALL; +};