t_asyncio.sh revision 272343
155682Smarkm#       $NetBSD: t_asyncio.sh,v 1.4 2014/08/27 13:32:16 gson Exp $
2233294Sstas#
355682Smarkm# Copyright (c) 2011 The NetBSD Foundation, Inc.
455682Smarkm# All rights reserved.
5233294Sstas#
655682Smarkm# Redistribution and use in source and binary forms, with or without
755682Smarkm# modification, are permitted provided that the following conditions
855682Smarkm# are met:
9233294Sstas# 1. Redistributions of source code must retain the above copyright
1055682Smarkm#    notice, this list of conditions and the following disclaimer.
1155682Smarkm# 2. Redistributions in binary form must reproduce the above copyright
12233294Sstas#    notice, this list of conditions and the following disclaimer in the
1355682Smarkm#    documentation and/or other materials provided with the distribution.
1455682Smarkm#
1555682Smarkm# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16233294Sstas# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1755682Smarkm# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1855682Smarkm# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1955682Smarkm# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20233294Sstas# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2155682Smarkm# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2255682Smarkm# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2355682Smarkm# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2455682Smarkm# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2555682Smarkm# POSSIBILITY OF SUCH DAMAGE.
2655682Smarkm#
2755682Smarkm
2855682Smarkmrumpsrv='rump_server'
2955682Smarkmexport RUMP_SERVER=unix://csock
3055682Smarkm
3155682Smarkmatf_test_case select_timeout cleanup
3255682Smarkmselect_timeout_head()
3355682Smarkm{
3455682Smarkm        atf_set "descr" "select() with timeout returns no fds set"
3555682Smarkm}
3655682Smarkm
3755682Smarkmselect_timeout_body()
3855682Smarkm{
3955682Smarkm
4055682Smarkm	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
41233294Sstas	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
4255682Smarkm	    $(atf_get_srcdir)/h_client select_timeout
4355682Smarkm}
4455682Smarkm
4555682Smarkmselect_timeout_cleanup()
4655682Smarkm{
4755682Smarkm	rump.halt
4855682Smarkm}
4955682Smarkm
5055682Smarkmatf_test_case select_allunset cleanup
5155682Smarkmselect_allunset_head()
5255682Smarkm{
5355682Smarkm        atf_set "descr" "select() with no set fds in fd_set should not crash"
5455682Smarkm}
5555682Smarkm
5655682Smarkmselect_allunset_body()
5755682Smarkm{
5855682Smarkm
5955682Smarkm	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
6055682Smarkm	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
6155682Smarkm	    $(atf_get_srcdir)/h_client select_allunset
62}
63
64select_allunset_cleanup()
65{
66	rump.halt
67}
68
69atf_test_case invafd cleanup
70invafd_head()
71{
72        atf_set "descr" "poll on invalid rump fd"
73	atf_set "timeout" "10"
74}
75
76invafd_body()
77{
78
79	atf_check -s exit:0 rump_server -lrumpvfs ${RUMP_SERVER}
80	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
81	    $(atf_get_srcdir)/h_client invafd
82}
83
84invafd_cleanup()
85{
86	rump.halt
87}
88
89atf_init_test_cases()
90{
91	atf_add_test_case select_timeout
92	atf_add_test_case select_allunset
93	atf_add_test_case invafd
94}
95