minix/tests/rump/rumpkern/h_server/h_simpleserver.c
Lionel Sambuc 11be35a165 Importing NetBSD "Kyua" test framework
To do so, a few dependencies have been imported:

 * external/bsd/lutok
 * external/mit/lua
 * external/public-domain/sqlite
 * external/public-domain/xz

The Kyua framework is the new generation of ATF (Automated Test
Framework), it is composed of:

 * external/bsd/atf
 * external/bsd/kyua-atf-compat
 * external/bsd/kyua-cli
 * external/bsd/kyua-tester
 * tests

Kyua/ATF being written in C++, it depends on libstdc++ which is
provided by GCC. As this is not part of the sources, Kyua is only
compiled when the native GCC utils are installed.

To install Kyua do the following:

 * In a cross-build enviromnent, add the following to the build.sh
   commandline: -V MKBINUTILS=yes -V MKGCCCMDS=yes

WARNING:
  At this point the import is still experimental, and not supported
  on native builds (a.k.a make build).

Change-Id: I26aee23c5bbd2d64adcb7c1beb98fe0d479d7ada
2013-07-23 20:43:41 +02:00

63 lines
1 KiB
C

/* $NetBSD: h_simpleserver.c,v 1.3 2011/01/14 13:23:15 pooka Exp $ */
#include <sys/types.h>
#include <rump/rump.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../../kernspace/kernspace.h"
#define NOFAIL(e) do { int rv = e; if (rv) err(1, #e); } while (/*CONSTCOND*/0)
struct {
const char *str;
void (*dofun)(char *);
} actions[] = {
{ "sendsig", rumptest_sendsig },
};
int
main(int argc, char *argv[])
{
unsigned i;
bool match;
if (argc < 2)
exit(1);
NOFAIL(rump_daemonize_begin());
NOFAIL(rump_init());
NOFAIL(rump_init_server(argv[1]));
NOFAIL(rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS));
if (argc > 2) {
char *arg = NULL;
if (argc == 4)
arg = argv[3];
for (i = 0; i < __arraycount(actions); i++) {
if (strcmp(actions[i].str, argv[2]) == 0) {
rump_schedule();
actions[i].dofun(arg);
rump_unschedule();
match = true;
}
}
if (!match) {
exit(1);
}
pause();
} else {
for (;;)
pause();
}
return 0;
}