xref: /netbsd-src/tests/kernel/t_procpath.sh (revision f765c471470a2c1002a030dce104ab93f03ef0ff)
1*f765c471Schristos# $NetBSD: t_procpath.sh,v 1.1 2017/12/10 15:37:54 christos Exp $
2*f765c471Schristos#
3*f765c471Schristos# Copyright (c) 2017 The NetBSD Foundation, Inc.
4*f765c471Schristos# All rights reserved.
5*f765c471Schristos#
6*f765c471Schristos# This code is derived from software contributed to The NetBSD Foundation
7*f765c471Schristos# by Christos Zoulas.
8*f765c471Schristos#
9*f765c471Schristos# Redistribution and use in source and binary forms, with or without
10*f765c471Schristos# modification, are permitted provided that the following conditions
11*f765c471Schristos# are met:
12*f765c471Schristos# 1. Redistributions of source code must retain the above copyright
13*f765c471Schristos#    notice, this list of conditions and the following disclaimer.
14*f765c471Schristos# 2. Redistributions in binary form must reproduce the above copyright
15*f765c471Schristos#    notice, this list of conditions and the following disclaimer in the
16*f765c471Schristos#    documentation and/or other materials provided with the distribution.
17*f765c471Schristos#
18*f765c471Schristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*f765c471Schristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*f765c471Schristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*f765c471Schristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*f765c471Schristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*f765c471Schristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*f765c471Schristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*f765c471Schristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*f765c471Schristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*f765c471Schristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*f765c471Schristos# POSSIBILITY OF SUCH DAMAGE.
29*f765c471Schristos#
30*f765c471Schristos
31*f765c471SchristosHELPER=$(atf_get_srcdir)/h_getprocpath
32*f765c471SchristosINTERP=$(atf_get_srcdir)/h_interpreter
33*f765c471Schristos
34*f765c471Schristosatf_test_case absolute_proc
35*f765c471Schristosabsolute_proc_head()
36*f765c471Schristos{
37*f765c471Schristos	atf_set "descr" "Test absolute process argv0"
38*f765c471Schristos}
39*f765c471Schristosabsolute_proc_body()
40*f765c471Schristos{
41*f765c471Schristos	atf_check -s exit:0 -o "inline:${HELPER}\n" -e "inline:" \
42*f765c471Schristos		${HELPER} -1
43*f765c471Schristos}
44*f765c471Schristos
45*f765c471Schristosatf_test_case interpeter_proc
46*f765c471Schristosinterpreter_proc_head()
47*f765c471Schristos{
48*f765c471Schristos	atf_set "descr" "Test interpreter proc contains interpreter"
49*f765c471Schristos}
50*f765c471Schristosinterpreter_proc_body()
51*f765c471Schristos{
52*f765c471Schristos	atf_check -s exit:0 -o "inline:/bin/sh\n" -e "inline:" \
53*f765c471Schristos		${INTERP} interpreter ${HELPER}
54*f765c471Schristos}
55*f765c471Schristos
56*f765c471Schristosatf_test_case relative_proc
57*f765c471Schristosrelative_proc_head()
58*f765c471Schristos{
59*f765c471Schristos	atf_set "descr" "Test that masking the trapped signal get reset"
60*f765c471Schristos}
61*f765c471Schristosrelative_proc_body()
62*f765c471Schristos{
63*f765c471Schristos	atf_check -s exit:0 -o "inline:" -e "inline:" \
64*f765c471Schristos		${INTERP} dot ${HELPER}
65*f765c471Schristos}
66*f765c471Schristos
67*f765c471Schristosatf_init_test_cases()
68*f765c471Schristos{
69*f765c471Schristos	atf_add_test_case absolute_proc
70*f765c471Schristos	atf_add_test_case interpreter_proc
71*f765c471Schristos	atf_add_test_case relative_proc
72*f765c471Schristos}
73