From: David van Moolenbroek Date: Fri, 31 Aug 2012 18:02:22 +0000 (+0000) Subject: tests: fix DS tests X-Git-Tag: v3.2.1~348 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/ddns-confgen.html?a=commitdiff_plain;h=087ace44595e7d6ed823fb4eddfe7a70a87eb9f5;p=minix.git tests: fix DS tests --- diff --git a/test/ds/Makefile b/test/ds/Makefile index 63bf396ac..2ecd7e3c0 100644 --- a/test/ds/Makefile +++ b/test/ds/Makefile @@ -1,18 +1,14 @@ -all: dstest subs - chmod +x down run +# Makefile for DS tests +PROG= dstest subs +SRCS.dstest= dstest.c +SRCS.subs= subs.c -dstest: dstest.c inc.h - cc -o $@ $< -lsys +DPADD+= ${LIBSYS} +LDADD+= -lsys -subs: subs.c inc.h - cc -o $@ $< -lsys +MAN= -run: all - sh run - -kill: - sh down - -clean: - rm -f dstest subs +BINDIR?= /usr/sbin +.include "Makefile.inc" +.include diff --git a/test/ds/Makefile.inc b/test/ds/Makefile.inc new file mode 100644 index 000000000..f166ffed1 --- /dev/null +++ b/test/ds/Makefile.inc @@ -0,0 +1,5 @@ +# Copied from drivers/Makefile.inc +CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE +LDADD+= -lminlib -lcompat_minix +DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX} +BINDIR?=/usr/sbin diff --git a/test/ds/down b/test/ds/down deleted file mode 100644 index ad9cd5bd7..000000000 --- a/test/ds/down +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -service down dstest -service down subs diff --git a/test/ds/dstest.c b/test/ds/dstest.c index 044123468..f903b34a1 100644 --- a/test/ds/dstest.c +++ b/test/ds/dstest.c @@ -12,7 +12,7 @@ char *key_label = "test_label"; void test_u32(void) { int r; - unsigned long value; + u32_t value; /* Publish and retrieve. */ r = ds_publish_u32(key_u32, 1234, 0); @@ -201,17 +201,11 @@ void test_map(void) printf("DSTEST: MAP test successful!\n"); } -/* SEF functions and variables. */ -static void sef_local_startup(void); - /*===========================================================================* - * main * + * sef_cb_init_fresh * *===========================================================================*/ -int main(void) +static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { - /* SEF local startup. */ - sef_local_startup(); - /* Run all the tests. */ test_u32(); test_str(); @@ -219,16 +213,27 @@ int main(void) test_map(); test_label(); - return 0; + return OK; } - /*===========================================================================* * sef_local_startup * *===========================================================================*/ -static void sef_local_startup() +static void sef_local_startup(void) { - /* Let SEF perform startup. */ - sef_startup(); + /* Let SEF perform startup. */ + sef_setcb_init_fresh(sef_cb_init_fresh); + + sef_startup(); } +/*===========================================================================* + * main * + *===========================================================================*/ +int main(void) +{ + /* SEF local startup. */ + sef_local_startup(); + + return 0; +} diff --git a/test/ds/inc.h b/test/ds/inc.h index 2f7907d55..e2ce3b909 100644 --- a/test/ds/inc.h +++ b/test/ds/inc.h @@ -1,4 +1,3 @@ -#define _MINIX #define _SYSTEM #include #include diff --git a/test/ds/run b/test/ds/run index 46ab1133f..bdb0b309c 100644 --- a/test/ds/run +++ b/test/ds/run @@ -2,5 +2,6 @@ PWD=`pwd` -service up ${PWD}/subs -config ${PWD}/system.conf -script ${PWD}/down -service up ${PWD}/dstest -config ${PWD}/system.conf -script ${PWD}/down +service up ${PWD}/subs -config system.conf -script /etc/rs.single +service up ${PWD}/dstest -config system.conf -script /etc/rs.single +service down subs diff --git a/test/ds/subs.c b/test/ds/subs.c index 7013016a3..ee774e312 100644 --- a/test/ds/subs.c +++ b/test/ds/subs.c @@ -14,7 +14,7 @@ int main(void) message mess; char key[DS_MAX_KEYLEN]; int type; - unsigned long num; + u32_t num; char string[17]; char buf[1000]; size_t length = 1000;