xref: /minix3/tests/rump/rumpnet/t_shmif.sh (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc#	$NetBSD: t_shmif.sh,v 1.2 2013/09/09 19:27:49 pooka Exp $
211be35a1SLionel Sambuc#
311be35a1SLionel Sambuc# Copyright (c) 2011 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 Sambucatf_test_case crossping cleanup
2911be35a1SLionel Sambuc
30*84d9c625SLionel SambucNKERN=8
31*84d9c625SLionel Sambuc
3211be35a1SLionel Sambuccrossping_head()
3311be35a1SLionel Sambuc{
34*84d9c625SLionel Sambuc	atf_set "descr" "run $NKERN rump kernels on one shmif bus and crossping"
3511be35a1SLionel Sambuc}
3611be35a1SLionel Sambuc
3711be35a1SLionel Sambucstartserver()
3811be35a1SLionel Sambuc{
3911be35a1SLionel Sambuc
4011be35a1SLionel Sambuc	export RUMP_SERVER=unix://sock${1}
4111be35a1SLionel Sambuc	atf_check -s exit:0 rump_server -lrumpnet -lrumpnet_net \
4211be35a1SLionel Sambuc	    -lrumpnet_netinet -lrumpnet_shmif ${RUMP_SERVER}
4311be35a1SLionel Sambuc	atf_check -s exit:0 rump.ifconfig shmif0 create
4411be35a1SLionel Sambuc	atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
4511be35a1SLionel Sambuc	atf_check -s exit:0 rump.ifconfig shmif0 inet 1.1.1.${1}
4611be35a1SLionel Sambuc}
4711be35a1SLionel Sambuc
4811be35a1SLionel Sambucpingothers()
4911be35a1SLionel Sambuc{
5011be35a1SLionel Sambuc
5111be35a1SLionel Sambuc}
5211be35a1SLionel Sambuc
5311be35a1SLionel Sambuccrossping_body()
5411be35a1SLionel Sambuc{
5511be35a1SLionel Sambuc
56*84d9c625SLionel Sambuc	for x in `jot ${NKERN}` ; do startserver $x ; done
57*84d9c625SLionel Sambuc	for x in `jot ${NKERN}`
5811be35a1SLionel Sambuc	do
5911be35a1SLionel Sambuc		export RUMP_SERVER=unix://sock${x}
60*84d9c625SLionel Sambuc		for y in `jot ${NKERN}`
6111be35a1SLionel Sambuc		do
6211be35a1SLionel Sambuc			[ ${y} -eq ${x} ] && continue
6311be35a1SLionel Sambuc			atf_check -s exit:0 -o ignore -e ignore \
6411be35a1SLionel Sambuc			    rump.ping -c 1 1.1.1.${y}
6511be35a1SLionel Sambuc		done
6611be35a1SLionel Sambuc	done
6711be35a1SLionel Sambuc}
6811be35a1SLionel Sambuc
6911be35a1SLionel Sambuccrossping_cleanup()
7011be35a1SLionel Sambuc{
7111be35a1SLionel Sambuc
72*84d9c625SLionel Sambuc	for x in `jot ${NKERN}` ; do RUMP_SERVER=unix://sock${x} rump.halt ;done
7311be35a1SLionel Sambuc	:
7411be35a1SLionel Sambuc}
7511be35a1SLionel Sambuc
7611be35a1SLionel Sambucatf_init_test_cases()
7711be35a1SLionel Sambuc{
7811be35a1SLionel Sambuc
7911be35a1SLionel Sambuc	atf_add_test_case crossping
8011be35a1SLionel Sambuc}
81