1*2a70c174Sjruoho# $NetBSD: t_nointerpreter.sh,v 1.1 2020/06/25 16:16:48 jruoho Exp $ 2*2a70c174Sjruoho# 3*2a70c174Sjruoho# Copyright (c) 2020 The NetBSD Foundation, Inc. 4*2a70c174Sjruoho# All rights reserved. 5*2a70c174Sjruoho# 6*2a70c174Sjruoho# This code is derived from software contributed to The NetBSD Foundation 7*2a70c174Sjruoho# by Jukka Ruohonen. 8*2a70c174Sjruoho# 9*2a70c174Sjruoho# Redistribution and use in source and binary forms, with or without 10*2a70c174Sjruoho# modification, are permitted provided that the following conditions 11*2a70c174Sjruoho# are met: 12*2a70c174Sjruoho# 1. Redistributions of source code must retain the above copyright 13*2a70c174Sjruoho# notice, this list of conditions and the following disclaimer. 14*2a70c174Sjruoho# 2. Redistributions in binary form must reproduce the above copyright 15*2a70c174Sjruoho# notice, this list of conditions and the following disclaimer in the 16*2a70c174Sjruoho# documentation and/or other materials provided with the distribution. 17*2a70c174Sjruoho# 18*2a70c174Sjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19*2a70c174Sjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20*2a70c174Sjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21*2a70c174Sjruoho# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22*2a70c174Sjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*2a70c174Sjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*2a70c174Sjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*2a70c174Sjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*2a70c174Sjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*2a70c174Sjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*2a70c174Sjruoho# POSSIBILITY OF SUCH DAMAGE. 29*2a70c174Sjruoho# 30*2a70c174Sjruohotmp="/tmp/nointerpreter" 31*2a70c174Sjruoho 32*2a70c174Sjruohoatf_test_case nointerpreter cleanup 33*2a70c174Sjruohonointerpreter_head() { 34*2a70c174Sjruoho atf_set "descr" "Check that executing shell scripts without a " \ 35*2a70c174Sjruoho "specified interpreter does not spam (PR kern/52744)" 36*2a70c174Sjruoho} 37*2a70c174Sjruoho 38*2a70c174Sjruohonointerpreter_body() { 39*2a70c174Sjruoho 40*2a70c174Sjruoho echo "echo hello world" > $tmp 41*2a70c174Sjruoho chmod u+x $tmp 42*2a70c174Sjruoho . $tmp 43*2a70c174Sjruoho spam=$(dmesg | grep "check exec failed") 44*2a70c174Sjruoho 45*2a70c174Sjruoho if [ ! -z $spam ]; then 46*2a70c174Sjruoho atf_fail "Kernel spams harmless diagnostics" 47*2a70c174Sjruoho fi 48*2a70c174Sjruoho} 49*2a70c174Sjruoho 50*2a70c174Sjruohonointerpreter_cleanup() { 51*2a70c174Sjruoho 52*2a70c174Sjruoho if [ -f $tmp ]; then 53*2a70c174Sjruoho rm $tmp 54*2a70c174Sjruoho fi 55*2a70c174Sjruoho} 56*2a70c174Sjruoho 57*2a70c174Sjruohoatf_init_test_cases() { 58*2a70c174Sjruoho atf_add_test_case nointerpreter 59*2a70c174Sjruoho} 60