Commit 433f1a84 authored by Philippe Gerum's avatar Philippe Gerum

testsuite/smokey: add fork-exec test

parent 49b42694
......@@ -14254,7 +14254,7 @@ fi
ac_config_files="$ac_config_files Makefile config/Makefile scripts/Makefile scripts/xeno-config:scripts/xeno-config-$rtcore_type.in scripts/xeno lib/Makefile lib/boilerplate/Makefile lib/cobalt/Makefile lib/cobalt/arch/Makefile lib/cobalt/arch/arm/Makefile lib/cobalt/arch/arm/include/Makefile lib/cobalt/arch/arm/include/asm/Makefile lib/cobalt/arch/arm/include/asm/xenomai/Makefile lib/cobalt/arch/powerpc/Makefile lib/cobalt/arch/powerpc/include/Makefile lib/cobalt/arch/powerpc/include/asm/Makefile lib/cobalt/arch/powerpc/include/asm/xenomai/Makefile lib/cobalt/arch/blackfin/Makefile lib/cobalt/arch/blackfin/include/Makefile lib/cobalt/arch/blackfin/include/asm/Makefile lib/cobalt/arch/blackfin/include/asm/xenomai/Makefile lib/cobalt/arch/x86/Makefile lib/cobalt/arch/x86/include/Makefile lib/cobalt/arch/x86/include/asm/Makefile lib/cobalt/arch/x86/include/asm/xenomai/Makefile lib/cobalt/arch/nios2/Makefile lib/cobalt/arch/nios2/include/Makefile lib/cobalt/arch/nios2/include/asm/Makefile lib/cobalt/arch/nios2/include/asm/xenomai/Makefile lib/cobalt/arch/sh/Makefile lib/cobalt/arch/sh/include/Makefile lib/cobalt/arch/sh/include/asm/Makefile lib/cobalt/arch/sh/include/asm/xenomai/Makefile lib/copperplate/Makefile lib/copperplate/regd/Makefile lib/alchemy/Makefile lib/vxworks/Makefile lib/psos/Makefile lib/analogy/Makefile lib/smokey/Makefile lib/trank/Makefile testsuite/Makefile testsuite/latency/Makefile testsuite/switchtest/Makefile testsuite/smokey/Makefile testsuite/smokey/arith/Makefile testsuite/smokey/sched-quota/Makefile testsuite/smokey/sched-tp/Makefile testsuite/smokey/rtdm/Makefile testsuite/smokey/vdso-access/Makefile testsuite/smokey/cond-torture/Makefile testsuite/smokey/mutex-torture/Makefile testsuite/smokey/xddp/Makefile testsuite/smokey/iddp/Makefile testsuite/smokey/bufp/Makefile testsuite/clocktest/Makefile testsuite/xeno-test/Makefile testsuite/regression/Makefile testsuite/regression/posix/Makefile utils/Makefile utils/can/Makefile utils/analogy/Makefile utils/ps/Makefile utils/slackspot/Makefile utils/autotune/Makefile demo/Makefile demo/posix/Makefile demo/posix/cobalt/Makefile demo/alchemy/Makefile demo/alchemy/cobalt/Makefile include/Makefile include/nocore/Makefile include/cobalt/uapi/Makefile include/cobalt/uapi/asm-generic/Makefile include/cobalt/uapi/kernel/Makefile include/cobalt/Makefile include/cobalt/sys/Makefile include/cobalt/kernel/Makefile include/cobalt/kernel/rtdm/Makefile include/cobalt/kernel/rtdm/analogy/Makefile include/cobalt/boilerplate/Makefile include/rtdm/Makefile include/rtdm/uapi/Makefile include/mercury/Makefile include/mercury/boilerplate/Makefile include/boilerplate/Makefile include/copperplate/Makefile include/alchemy/Makefile include/vxworks/Makefile include/psos/Makefile include/smokey/Makefile include/trank/Makefile include/trank/posix/Makefile include/trank/native/Makefile include/trank/rtdm/Makefile doc/Makefile doc/doxygen/Makefile doc/doxygen/xeno3prm-common.conf doc/doxygen/xeno3prm-html.conf doc/doxygen/xeno3prm-latex.conf doc/gitdoc/Makefile doc/asciidoc/Makefile"
ac_config_files="$ac_config_files Makefile config/Makefile scripts/Makefile scripts/xeno-config:scripts/xeno-config-$rtcore_type.in scripts/xeno lib/Makefile lib/boilerplate/Makefile lib/cobalt/Makefile lib/cobalt/arch/Makefile lib/cobalt/arch/arm/Makefile lib/cobalt/arch/arm/include/Makefile lib/cobalt/arch/arm/include/asm/Makefile lib/cobalt/arch/arm/include/asm/xenomai/Makefile lib/cobalt/arch/powerpc/Makefile lib/cobalt/arch/powerpc/include/Makefile lib/cobalt/arch/powerpc/include/asm/Makefile lib/cobalt/arch/powerpc/include/asm/xenomai/Makefile lib/cobalt/arch/blackfin/Makefile lib/cobalt/arch/blackfin/include/Makefile lib/cobalt/arch/blackfin/include/asm/Makefile lib/cobalt/arch/blackfin/include/asm/xenomai/Makefile lib/cobalt/arch/x86/Makefile lib/cobalt/arch/x86/include/Makefile lib/cobalt/arch/x86/include/asm/Makefile lib/cobalt/arch/x86/include/asm/xenomai/Makefile lib/cobalt/arch/nios2/Makefile lib/cobalt/arch/nios2/include/Makefile lib/cobalt/arch/nios2/include/asm/Makefile lib/cobalt/arch/nios2/include/asm/xenomai/Makefile lib/cobalt/arch/sh/Makefile lib/cobalt/arch/sh/include/Makefile lib/cobalt/arch/sh/include/asm/Makefile lib/cobalt/arch/sh/include/asm/xenomai/Makefile lib/copperplate/Makefile lib/copperplate/regd/Makefile lib/alchemy/Makefile lib/vxworks/Makefile lib/psos/Makefile lib/analogy/Makefile lib/smokey/Makefile lib/trank/Makefile testsuite/Makefile testsuite/latency/Makefile testsuite/switchtest/Makefile testsuite/smokey/Makefile testsuite/smokey/arith/Makefile testsuite/smokey/sched-quota/Makefile testsuite/smokey/sched-tp/Makefile testsuite/smokey/rtdm/Makefile testsuite/smokey/vdso-access/Makefile testsuite/smokey/cond-torture/Makefile testsuite/smokey/mutex-torture/Makefile testsuite/smokey/xddp/Makefile testsuite/smokey/iddp/Makefile testsuite/smokey/bufp/Makefile testsuite/smokey/fork-exec/Makefile testsuite/clocktest/Makefile testsuite/xeno-test/Makefile testsuite/regression/Makefile testsuite/regression/posix/Makefile utils/Makefile utils/can/Makefile utils/analogy/Makefile utils/ps/Makefile utils/slackspot/Makefile utils/autotune/Makefile demo/Makefile demo/posix/Makefile demo/posix/cobalt/Makefile demo/alchemy/Makefile demo/alchemy/cobalt/Makefile include/Makefile include/nocore/Makefile include/cobalt/uapi/Makefile include/cobalt/uapi/asm-generic/Makefile include/cobalt/uapi/kernel/Makefile include/cobalt/Makefile include/cobalt/sys/Makefile include/cobalt/kernel/Makefile include/cobalt/kernel/rtdm/Makefile include/cobalt/kernel/rtdm/analogy/Makefile include/cobalt/boilerplate/Makefile include/rtdm/Makefile include/rtdm/uapi/Makefile include/mercury/Makefile include/mercury/boilerplate/Makefile include/boilerplate/Makefile include/copperplate/Makefile include/alchemy/Makefile include/vxworks/Makefile include/psos/Makefile include/smokey/Makefile include/trank/Makefile include/trank/posix/Makefile include/trank/native/Makefile include/trank/rtdm/Makefile doc/Makefile doc/doxygen/Makefile doc/doxygen/xeno3prm-common.conf doc/doxygen/xeno3prm-html.conf doc/doxygen/xeno3prm-latex.conf doc/gitdoc/Makefile doc/asciidoc/Makefile"
cat >confcache <<\_ACEOF
......@@ -15373,6 +15373,7 @@ do
"testsuite/smokey/xddp/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/smokey/xddp/Makefile" ;;
"testsuite/smokey/iddp/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/smokey/iddp/Makefile" ;;
"testsuite/smokey/bufp/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/smokey/bufp/Makefile" ;;
"testsuite/smokey/fork-exec/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/smokey/fork-exec/Makefile" ;;
"testsuite/clocktest/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/clocktest/Makefile" ;;
"testsuite/xeno-test/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/xeno-test/Makefile" ;;
"testsuite/regression/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/regression/Makefile" ;;
......
......@@ -881,6 +881,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/xddp/Makefile \
testsuite/smokey/iddp/Makefile \
testsuite/smokey/bufp/Makefile \
testsuite/smokey/fork-exec/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
testsuite/regression/Makefile \
......
......@@ -19,7 +19,8 @@ SUBDIRS = \
sched-quota \
sched-tp \
vdso-access \
xddp
xddp \
fork-exec
else
SUBDIRS =
wrappers =
......
......@@ -394,7 +394,8 @@ core_libs = $(am__append_1)
@XENO_COBALT_TRUE@ sched-quota \
@XENO_COBALT_TRUE@ sched-tp \
@XENO_COBALT_TRUE@ vdso-access \
@XENO_COBALT_TRUE@ xddp
@XENO_COBALT_TRUE@ xddp \
@XENO_COBALT_TRUE@ fork-exec
plugin_list = $(foreach plugin,$(SUBDIRS),$(plugin)/lib$(plugin).a)
# wrap-link.sh is confused by -whole-archive, so work around
......
noinst_LIBRARIES = libfork-exec.a
libfork_exec_a_SOURCES = fork-exec.c
CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
libfork_exec_a_CPPFLAGS = \
@XENO_USER_CFLAGS@ \
-I$(top_srcdir)/include
This diff is collapsed.
/*
* fork->exec test.
*
* Copyright (C) Philippe Gerum <rpm@xenomai.org>
*
* Released under the terms of GPLv2.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <error.h>
#include <xeno_config.h>
#include <smokey/smokey.h>
smokey_test_plugin(fork_exec,
SMOKEY_NOARGS,
"Check fork->exec sequence."
);
/*
* The purpose of this test is to check whether Cobalt detects and
* handles a fork->exec sequence properly for Xenomai-enabled threads,
* with respect to managing their respective shadow contexts. Cobalt
* should drop the child's shadow upon detecting exec(), then create
* another one for the emerging process's main() thread as usual.
*
* We don't have to do much beyond firing such sequence fo testing: if
* Cobalt messes up, the kernel will certainly crash.
*/
static int run_fork_exec(struct smokey_test *t, int argc, char *const argv[])
{
struct timespec req;
switch (fork()) {
case -1:
error(1, errno, "fork");
case 0:
/*
* Re-exec ourselves without running any test, this is
* enough for creating a shadow context.
*/
execl(CONFIG_XENO_PREFIX "/bin/smokey", "smokey", NULL);
_exit(99);
default:
req.tv_sec = 0;
req.tv_nsec = 20000000;
clock_nanosleep(CLOCK_MONOTONIC, 0, &req, NULL);
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment