From 087ace44595e7d6ed823fb4eddfe7a70a87eb9f5 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Fri, 31 Aug 2012 18:02:22 +0000 Subject: [PATCH] tests: fix DS tests --- test/ds/Makefile | 24 ++++++++++------------ test/ds/Makefile.inc | 5 +++++ test/ds/down | 4 ---- test/ds/dstest.c | 47 ++++++++++++++++++++++++-------------------- test/ds/inc.h | 1 - test/ds/run | 5 +++-- test/ds/subs.c | 2 +- 7 files changed, 45 insertions(+), 43 deletions(-) create mode 100644 test/ds/Makefile.inc delete mode 100644 test/ds/down 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,8 +201,31 @@ void test_map(void) printf("DSTEST: MAP test successful!\n"); } -/* SEF functions and variables. */ -static void sef_local_startup(void); +/*===========================================================================* + * sef_cb_init_fresh * + *===========================================================================*/ +static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) +{ + /* Run all the tests. */ + test_u32(); + test_str(); + test_mem(); + test_map(); + test_label(); + + return OK; +} + +/*===========================================================================* + * sef_local_startup * + *===========================================================================*/ +static void sef_local_startup(void) +{ + /* Let SEF perform startup. */ + sef_setcb_init_fresh(sef_cb_init_fresh); + + sef_startup(); +} /*===========================================================================* * main * @@ -212,23 +235,5 @@ int main(void) /* SEF local startup. */ sef_local_startup(); - /* Run all the tests. */ - test_u32(); - test_str(); - test_mem(); - test_map(); - test_label(); - return 0; } - - -/*===========================================================================* - * sef_local_startup * - *===========================================================================*/ -static void sef_local_startup() -{ - /* Let SEF perform startup. */ - sef_startup(); -} - 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;