tests: fix DS tests

This commit is contained in:
David van Moolenbroek 2012-08-31 18:02:22 +00:00
parent 2a0e9af32f
commit 087ace4459
7 changed files with 45 additions and 43 deletions

View file

@ -1,18 +1,14 @@
all: dstest subs # Makefile for DS tests
chmod +x down run PROG= dstest subs
SRCS.dstest= dstest.c
SRCS.subs= subs.c
dstest: dstest.c inc.h DPADD+= ${LIBSYS}
cc -o $@ $< -lsys LDADD+= -lsys
subs: subs.c inc.h MAN=
cc -o $@ $< -lsys
run: all BINDIR?= /usr/sbin
sh run
kill:
sh down
clean:
rm -f dstest subs
.include "Makefile.inc"
.include <minix.service.mk>

5
test/ds/Makefile.inc Normal file
View file

@ -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

View file

@ -1,4 +0,0 @@
#!/bin/sh
service down dstest
service down subs

View file

@ -12,7 +12,7 @@ char *key_label = "test_label";
void test_u32(void) void test_u32(void)
{ {
int r; int r;
unsigned long value; u32_t value;
/* Publish and retrieve. */ /* Publish and retrieve. */
r = ds_publish_u32(key_u32, 1234, 0); r = ds_publish_u32(key_u32, 1234, 0);
@ -201,8 +201,31 @@ void test_map(void)
printf("DSTEST: MAP test successful!\n"); 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 * * main *
@ -212,23 +235,5 @@ int main(void)
/* SEF local startup. */ /* SEF local startup. */
sef_local_startup(); sef_local_startup();
/* Run all the tests. */
test_u32();
test_str();
test_mem();
test_map();
test_label();
return 0; return 0;
} }
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
static void sef_local_startup()
{
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -1,4 +1,3 @@
#define _MINIX
#define _SYSTEM #define _SYSTEM
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>

View file

@ -2,5 +2,6 @@
PWD=`pwd` PWD=`pwd`
service up ${PWD}/subs -config ${PWD}/system.conf -script ${PWD}/down service up ${PWD}/subs -config system.conf -script /etc/rs.single
service up ${PWD}/dstest -config ${PWD}/system.conf -script ${PWD}/down service up ${PWD}/dstest -config system.conf -script /etc/rs.single
service down subs

View file

@ -14,7 +14,7 @@ int main(void)
message mess; message mess;
char key[DS_MAX_KEYLEN]; char key[DS_MAX_KEYLEN];
int type; int type;
unsigned long num; u32_t num;
char string[17]; char string[17];
char buf[1000]; char buf[1000];
size_t length = 1000; size_t length = 1000;