Home | History | Annotate | Line # | Download | only in librumpclient
t_exec.sh revision 1.9
      1  1.9    kre #       $NetBSD: t_exec.sh,v 1.9 2016/08/10 21:10:18 kre Exp $
      2  1.1  pooka #
      3  1.1  pooka # Copyright (c) 2011 The NetBSD Foundation, Inc.
      4  1.1  pooka # All rights reserved.
      5  1.1  pooka #
      6  1.1  pooka # Redistribution and use in source and binary forms, with or without
      7  1.1  pooka # modification, are permitted provided that the following conditions
      8  1.1  pooka # are met:
      9  1.1  pooka # 1. Redistributions of source code must retain the above copyright
     10  1.1  pooka #    notice, this list of conditions and the following disclaimer.
     11  1.1  pooka # 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  pooka #    notice, this list of conditions and the following disclaimer in the
     13  1.1  pooka #    documentation and/or other materials provided with the distribution.
     14  1.1  pooka #
     15  1.1  pooka # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16  1.1  pooka # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17  1.1  pooka # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18  1.1  pooka # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19  1.1  pooka # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20  1.1  pooka # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21  1.1  pooka # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22  1.1  pooka # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  1.1  pooka # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24  1.1  pooka # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25  1.1  pooka # POSSIBILITY OF SUCH DAMAGE.
     26  1.1  pooka #
     27  1.1  pooka 
     28  1.9    kre rumpsrv='rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev -lrumpvfs'
     29  1.1  pooka export RUMP_SERVER=unix://csock
     30  1.6  pooka export RUMPHIJACK_RETRYCONNECT='die'
     31  1.1  pooka 
     32  1.1  pooka atf_test_case noexec cleanup
     33  1.1  pooka noexec_head()
     34  1.1  pooka {
     35  1.1  pooka         atf_set "descr" "check that we see what we expect without exec"
     36  1.1  pooka }
     37  1.1  pooka 
     38  1.1  pooka noexec_body()
     39  1.1  pooka {
     40  1.1  pooka 
     41  1.1  pooka 	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
     42  1.3  pooka 	atf_check -s exit:0 env $(atf_get_srcdir)/h_exec
     43  1.7  pooka 	atf_check -s exit:0 -o save:sstat.out rump.sockstat -n
     44  1.1  pooka 	atf_check -s exit:0 -o match:'^root.*h_exec.*tcp.*\*\.1234' \
     45  1.1  pooka 	    sed -n 2p sstat.out
     46  1.1  pooka 	atf_check -s exit:0 -o match:'^root.*h_exec.*tcp.*\*\.2345' \
     47  1.1  pooka 	    sed -n 3p sstat.out
     48  1.1  pooka }
     49  1.1  pooka 
     50  1.1  pooka noexec_cleanup()
     51  1.1  pooka {
     52  1.1  pooka 	rump.halt
     53  1.1  pooka }
     54  1.1  pooka 
     55  1.1  pooka atf_test_case exec cleanup
     56  1.1  pooka exec_head()
     57  1.1  pooka {
     58  1.1  pooka         atf_set "descr" "check that client names changes after exec"
     59  1.1  pooka }
     60  1.1  pooka 
     61  1.1  pooka exec_body()
     62  1.1  pooka {
     63  1.1  pooka 
     64  1.1  pooka 	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
     65  1.4  pooka 	atf_check -s exit:0 $(atf_get_srcdir)/h_exec $(atf_get_srcdir)/h_exec
     66  1.7  pooka 	atf_check -s exit:0 -o save:sstat.out rump.sockstat -n
     67  1.1  pooka 	atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.1234' \
     68  1.1  pooka 	    sed -n 2p sstat.out
     69  1.1  pooka 	atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.2345' \
     70  1.1  pooka 	    sed -n 3p sstat.out
     71  1.1  pooka }
     72  1.1  pooka 
     73  1.1  pooka exec_cleanup()
     74  1.1  pooka {
     75  1.1  pooka 	rump.halt
     76  1.1  pooka }
     77  1.1  pooka 
     78  1.2  pooka atf_test_case cloexec cleanup
     79  1.2  pooka cloexec_head()
     80  1.2  pooka {
     81  1.2  pooka         atf_set "descr" "check that FD_CLOEXEC works"
     82  1.2  pooka }
     83  1.2  pooka 
     84  1.2  pooka cloexec_body()
     85  1.2  pooka {
     86  1.2  pooka 
     87  1.2  pooka 	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
     88  1.3  pooka 	atf_check -s exit:0  \
     89  1.4  pooka 	    $(atf_get_srcdir)/h_exec $(atf_get_srcdir)/h_exec cloexec1
     90  1.7  pooka 	atf_check -s exit:0 -o save:sstat.out rump.sockstat -n
     91  1.2  pooka 	atf_check -s exit:0 -o inline:'2\n' sed -n '$=' sstat.out
     92  1.2  pooka 	atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.2345' \
     93  1.2  pooka 	    sed -n 2p sstat.out
     94  1.2  pooka }
     95  1.2  pooka 
     96  1.2  pooka cloexec_cleanup()
     97  1.2  pooka {
     98  1.2  pooka 	rump.halt
     99  1.2  pooka }
    100  1.2  pooka 
    101  1.5  pooka atf_test_case vfork cleanup
    102  1.5  pooka vfork_head()
    103  1.5  pooka {
    104  1.5  pooka         atf_set "descr" "test rumpclient_vfork()"
    105  1.5  pooka }
    106  1.5  pooka 
    107  1.5  pooka vfork_body()
    108  1.5  pooka {
    109  1.5  pooka 
    110  1.5  pooka 	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
    111  1.5  pooka 	atf_check -s exit:0  \
    112  1.5  pooka 	    $(atf_get_srcdir)/h_exec $(atf_get_srcdir)/h_exec vfork_please
    113  1.7  pooka 	atf_check -s exit:0 -o save:sstat.out rump.sockstat -n
    114  1.5  pooka 	atf_check -s exit:0 -o inline:'5\n' sed -n '$=' sstat.out
    115  1.5  pooka 	atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.1234' \
    116  1.5  pooka 	    cat sstat.out
    117  1.5  pooka 	atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.2345' \
    118  1.5  pooka 	    cat sstat.out
    119  1.5  pooka 	atf_check -s exit:0 -o match:'^root.*fourchette.*tcp.*\*\.1234' \
    120  1.5  pooka 	    cat sstat.out
    121  1.5  pooka 	atf_check -s exit:0 -o match:'^root.*fourchette.*tcp.*\*\.2345' \
    122  1.5  pooka 	    cat sstat.out
    123  1.5  pooka }
    124  1.5  pooka 
    125  1.5  pooka vfork_cleanup()
    126  1.5  pooka {
    127  1.5  pooka 	rump.halt
    128  1.5  pooka }
    129  1.5  pooka 
    130  1.8  pooka atf_test_case threxec cleanup
    131  1.8  pooka threxec_head()
    132  1.8  pooka {
    133  1.8  pooka 	atf_set "descr" "check that threads are killed before exec continues"
    134  1.8  pooka }
    135  1.8  pooka 
    136  1.8  pooka threxec_body()
    137  1.8  pooka {
    138  1.8  pooka 	atf_check -s exit:0 rump_server ${RUMP_SERVER}
    139  1.8  pooka 	atf_check -s exit:0 $(atf_get_srcdir)/h_execthr
    140  1.8  pooka }
    141  1.8  pooka 
    142  1.8  pooka threxec_cleanup()
    143  1.8  pooka {
    144  1.8  pooka 	rump.halt
    145  1.8  pooka }
    146  1.1  pooka 
    147  1.1  pooka atf_init_test_cases()
    148  1.1  pooka {
    149  1.1  pooka 	atf_add_test_case noexec
    150  1.1  pooka 	atf_add_test_case exec
    151  1.2  pooka 	atf_add_test_case cloexec
    152  1.5  pooka 	atf_add_test_case vfork
    153  1.8  pooka 	atf_add_test_case threxec
    154  1.1  pooka }
    155