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
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 <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)
{
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();
}

View file

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

View file

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

View file

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