xref: /minix3/tests/lib/librumphijack/t_asyncio.sh (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc#       $NetBSD: t_asyncio.sh,v 1.4 2014/08/27 13:32:16 gson 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 Sambucrumpsrv='rump_server'
2911be35a1SLionel Sambucexport RUMP_SERVER=unix://csock
3011be35a1SLionel Sambuc
3111be35a1SLionel Sambucatf_test_case select_timeout cleanup
3211be35a1SLionel Sambucselect_timeout_head()
3311be35a1SLionel Sambuc{
3411be35a1SLionel Sambuc        atf_set "descr" "select() with timeout returns no fds set"
3511be35a1SLionel Sambuc}
3611be35a1SLionel Sambuc
3711be35a1SLionel Sambucselect_timeout_body()
3811be35a1SLionel Sambuc{
3911be35a1SLionel Sambuc
4011be35a1SLionel Sambuc	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
4111be35a1SLionel Sambuc	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
4211be35a1SLionel Sambuc	    $(atf_get_srcdir)/h_client select_timeout
4311be35a1SLionel Sambuc}
4411be35a1SLionel Sambuc
4511be35a1SLionel Sambucselect_timeout_cleanup()
4611be35a1SLionel Sambuc{
4711be35a1SLionel Sambuc	rump.halt
4811be35a1SLionel Sambuc}
4911be35a1SLionel Sambuc
5011be35a1SLionel Sambucatf_test_case select_allunset cleanup
5111be35a1SLionel Sambucselect_allunset_head()
5211be35a1SLionel Sambuc{
5311be35a1SLionel Sambuc        atf_set "descr" "select() with no set fds in fd_set should not crash"
5411be35a1SLionel Sambuc}
5511be35a1SLionel Sambuc
5611be35a1SLionel Sambucselect_allunset_body()
5711be35a1SLionel Sambuc{
5811be35a1SLionel Sambuc
5911be35a1SLionel Sambuc	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
6011be35a1SLionel Sambuc	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
6111be35a1SLionel Sambuc	    $(atf_get_srcdir)/h_client select_allunset
6211be35a1SLionel Sambuc}
6311be35a1SLionel Sambuc
6411be35a1SLionel Sambucselect_allunset_cleanup()
6511be35a1SLionel Sambuc{
6611be35a1SLionel Sambuc	rump.halt
6711be35a1SLionel Sambuc}
6811be35a1SLionel Sambuc
6911be35a1SLionel Sambucatf_test_case invafd cleanup
7011be35a1SLionel Sambucinvafd_head()
7111be35a1SLionel Sambuc{
7211be35a1SLionel Sambuc        atf_set "descr" "poll on invalid rump fd"
73*0a6a1f1dSLionel Sambuc	atf_set "timeout" "10"
7411be35a1SLionel Sambuc}
7511be35a1SLionel Sambuc
7611be35a1SLionel Sambucinvafd_body()
7711be35a1SLionel Sambuc{
7811be35a1SLionel Sambuc
7911be35a1SLionel Sambuc	atf_check -s exit:0 rump_server -lrumpvfs ${RUMP_SERVER}
8011be35a1SLionel Sambuc	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
8111be35a1SLionel Sambuc	    $(atf_get_srcdir)/h_client invafd
8211be35a1SLionel Sambuc}
8311be35a1SLionel Sambuc
8411be35a1SLionel Sambucinvafd_cleanup()
8511be35a1SLionel Sambuc{
8611be35a1SLionel Sambuc	rump.halt
8711be35a1SLionel Sambuc}
8811be35a1SLionel Sambuc
8911be35a1SLionel Sambucatf_init_test_cases()
9011be35a1SLionel Sambuc{
9111be35a1SLionel Sambuc	atf_add_test_case select_timeout
9211be35a1SLionel Sambuc	atf_add_test_case select_allunset
9311be35a1SLionel Sambuc	atf_add_test_case invafd
9411be35a1SLionel Sambuc}
95