]> Zhao Yanbai Git Server - minix.git/commitdiff
Adding an initial ddekit test.
authorKees Jongenburger <kees.jongenburger@gmail.com>
Tue, 25 Mar 2014 15:02:31 +0000 (16:02 +0100)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:22 +0000 (17:05 +0200)
Change-Id: I0522449bb7bbbb23efc132ede3a02da95efe0326

distrib/sets/lists/minix/mi
etc/mtree/NetBSD.dist.base
test/Makefile
test/ddekit/Makefile [new file with mode: 0644]
test/ddekit/ddekittest.sh [new file with mode: 0755]
test/ddekit/ddekittest_driver.c [new file with mode: 0644]
test/ddekit/system.conf [new file with mode: 0644]

index be1dd87a51becb58e2cd1dd41f1dcc9b4c952f3d..1faf7d09371ae4a061c9559a234f43e07ac66557 100644 (file)
 ./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
index 2ad59c36f53b3bf467280d908bae43c30c32650f..209c71c038b7f0026e0755384d1c0654e4747d86 100644 (file)
 /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
index 3079411272fccda7eb30c47acd703530c3d552ee..80e59d494d6e209a5f08060112d65a838619adc3 100644 (file)
@@ -16,7 +16,8 @@ LDADD+=               -lm -lcompat_minix
 
 .include <bsd.own.mk>
 
-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 (file)
index 0000000..c3ccb30
--- /dev/null
@@ -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>
diff --git a/test/ddekit/ddekittest.sh b/test/ddekit/ddekittest.sh
new file mode 100755 (executable)
index 0000000..9331282
--- /dev/null
@@ -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 (file)
index 0000000..e211d99
--- /dev/null
@@ -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;
+}
diff --git a/test/ddekit/system.conf b/test/ddekit/system.conf
new file mode 100644 (file)
index 0000000..55292cf
--- /dev/null
@@ -0,0 +1,5 @@
+service ddekittest_driver {
+       uid 0;
+       system  ALL;
+       ipc     ALL;
+};