xref: /minix3/tests/rump/rumpkern/t_sp.sh (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc#	$NetBSD: t_sp.sh,v 1.12 2014/08/30 12:14:17 gson Exp $
211be35a1SLionel Sambuc#
311be35a1SLionel Sambuc# Copyright (c) 2010 The NetBSD Foundation, Inc.
411be35a1SLionel Sambuc# All rights reserved.
511be35a1SLionel Sambuc#
611be35a1SLionel Sambuc# Redistribution and use in source and binary forms, with or without
711be35a1SLionel Sambuc# modification, are permitted provided that the following conditions
811be35a1SLionel Sambuc# are met:
911be35a1SLionel Sambuc# 1. Redistributions of source code must retain the above copyright
1011be35a1SLionel Sambuc#    notice, this list of conditions and the following disclaimer.
1111be35a1SLionel Sambuc# 2. Redistributions in binary form must reproduce the above copyright
1211be35a1SLionel Sambuc#    notice, this list of conditions and the following disclaimer in the
1311be35a1SLionel Sambuc#    documentation and/or other materials provided with the distribution.
1411be35a1SLionel Sambuc#
1511be35a1SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1611be35a1SLionel Sambuc# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1711be35a1SLionel Sambuc# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1811be35a1SLionel Sambuc# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1911be35a1SLionel Sambuc# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2011be35a1SLionel Sambuc# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2111be35a1SLionel Sambuc# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2211be35a1SLionel Sambuc# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2311be35a1SLionel Sambuc# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2411be35a1SLionel Sambuc# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2511be35a1SLionel Sambuc# POSSIBILITY OF SUCH DAMAGE.
2611be35a1SLionel Sambuc#
2711be35a1SLionel Sambuc
2811be35a1SLionel Sambuctest_case()
2911be35a1SLionel Sambuc{
3011be35a1SLionel Sambuc	local name="${1}"; shift
3111be35a1SLionel Sambuc	local check_function="${1}"; shift
3211be35a1SLionel Sambuc
3311be35a1SLionel Sambuc	atf_test_case "${name}" cleanup
3411be35a1SLionel Sambuc	eval "${name}_head() {  }"
3511be35a1SLionel Sambuc	eval "${name}_body() { \
3611be35a1SLionel Sambuc		${check_function} " "${@}" "; \
3711be35a1SLionel Sambuc	}"
3811be35a1SLionel Sambuc        eval "${name}_cleanup() { \
3911be35a1SLionel Sambuc		RUMP_SERVER=unix://commsock rump.halt
4011be35a1SLionel Sambuc        }"
4111be35a1SLionel Sambuc}
4211be35a1SLionel Sambuc
4311be35a1SLionel Sambuctest_case basic basic
4411be35a1SLionel Sambuctest_case stress_short stress 1
4511be35a1SLionel Sambuctest_case stress_long stress 2
4611be35a1SLionel Sambuctest_case stress_killer stress 5 kill
4711be35a1SLionel Sambuctest_case fork_simple fork simple
4811be35a1SLionel Sambuctest_case fork_pipecomm fork pipecomm
4911be35a1SLionel Sambuctest_case fork_fakeauth fork fakeauth
5011be35a1SLionel Sambuctest_case sigsafe sigsafe sigsafe
5111be35a1SLionel Sambuctest_case signal signal
5211be35a1SLionel Sambuctest_case reconnect reconnect
5311be35a1SLionel Sambuc
5411be35a1SLionel Sambucbasic()
5511be35a1SLionel Sambuc{
5611be35a1SLionel Sambuc	export RUMP_SERVER=unix://commsock
5711be35a1SLionel Sambuc	atf_check -s exit:0 rump_server ${RUMP_SERVER}
5811be35a1SLionel Sambuc	atf_check -s exit:0 $(atf_get_srcdir)/h_client/h_simplecli
5911be35a1SLionel Sambuc}
6011be35a1SLionel Sambuc
61*0a6a1f1dSLionel Sambucstress_short_head()
62*0a6a1f1dSLionel Sambuc{
63*0a6a1f1dSLionel Sambuc	atf_set "require.memory" "64M"
64*0a6a1f1dSLionel Sambuc}
65*0a6a1f1dSLionel Sambuc
66*0a6a1f1dSLionel Sambucstress_long_head()
67*0a6a1f1dSLionel Sambuc{
68*0a6a1f1dSLionel Sambuc	atf_set "require.memory" "64M"
69*0a6a1f1dSLionel Sambuc}
70*0a6a1f1dSLionel Sambuc
7111be35a1SLionel Sambucstress()
7211be35a1SLionel Sambuc{
7311be35a1SLionel Sambuc
7411be35a1SLionel Sambuc	export RUMP_SERVER=unix://commsock
7511be35a1SLionel Sambuc	atf_check -s exit:0 rump_server \
7611be35a1SLionel Sambuc	    -lrumpvfs -lrumpnet -lrumpnet_net -lrumpnet_netinet ${RUMP_SERVER}
7711be35a1SLionel Sambuc	atf_check -s exit:0 -e ignore $(atf_get_srcdir)/h_client/h_stresscli $@
7811be35a1SLionel Sambuc}
7911be35a1SLionel Sambuc
8011be35a1SLionel Sambucfork()
8111be35a1SLionel Sambuc{
8211be35a1SLionel Sambuc
8311be35a1SLionel Sambuc	export RUMP_SERVER=unix://commsock
8411be35a1SLionel Sambuc	atf_check -s exit:0 rump_server -lrumpvfs ${RUMP_SERVER}
8511be35a1SLionel Sambuc	atf_check -s exit:0 $(atf_get_srcdir)/h_client/h_forkcli ${1}
8611be35a1SLionel Sambuc}
8711be35a1SLionel Sambuc
8811be35a1SLionel Sambucsigsafe()
8911be35a1SLionel Sambuc{
9011be35a1SLionel Sambuc
9111be35a1SLionel Sambuc	export RUMP_SERVER=unix://commsock
9211be35a1SLionel Sambuc	atf_check -s exit:0 rump_server ${RUMP_SERVER}
9311be35a1SLionel Sambuc	atf_check -s exit:0 $(atf_get_srcdir)/h_client/h_sigcli
9411be35a1SLionel Sambuc
9511be35a1SLionel Sambuc}
9611be35a1SLionel Sambuc
9711be35a1SLionel Sambucsignal()
9811be35a1SLionel Sambuc{
9911be35a1SLionel Sambuc
10011be35a1SLionel Sambuc	export RUMP_SERVER=unix://commsock
10111be35a1SLionel Sambuc	atf_check -s exit:0 $(atf_get_srcdir)/h_server/h_simpleserver \
10211be35a1SLionel Sambuc	    ${RUMP_SERVER} sendsig 27
10311be35a1SLionel Sambuc	atf_check -s signal:27 $(atf_get_srcdir)/h_client/h_simplecli block
10411be35a1SLionel Sambuc}
10511be35a1SLionel Sambuc
10611be35a1SLionel Sambucreconnect()
10711be35a1SLionel Sambuc{
10811be35a1SLionel Sambuc
10911be35a1SLionel Sambuc
11011be35a1SLionel Sambuc	export RUMP_SERVER=unix://commsock
11111be35a1SLionel Sambuc	atf_check -s exit:0 rump_server ${RUMP_SERVER}
11211be35a1SLionel Sambuc	atf_check -s exit:0 -e ignore $(atf_get_srcdir)/h_client/h_reconcli 2
11311be35a1SLionel Sambuc}
11411be35a1SLionel Sambuc
11511be35a1SLionel Sambucatf_init_test_cases()
11611be35a1SLionel Sambuc{
11711be35a1SLionel Sambuc
11811be35a1SLionel Sambuc	atf_add_test_case basic
11911be35a1SLionel Sambuc	atf_add_test_case stress_short
12011be35a1SLionel Sambuc	atf_add_test_case stress_long
12111be35a1SLionel Sambuc	atf_add_test_case stress_killer
12211be35a1SLionel Sambuc	atf_add_test_case fork_simple
12311be35a1SLionel Sambuc	atf_add_test_case fork_pipecomm
12411be35a1SLionel Sambuc	atf_add_test_case fork_fakeauth
12511be35a1SLionel Sambuc	atf_add_test_case sigsafe
12611be35a1SLionel Sambuc	atf_add_test_case signal
12711be35a1SLionel Sambuc	atf_add_test_case reconnect
12811be35a1SLionel Sambuc}
129