xref: /netbsd/tests/usr.bin/tmux/t_tmux.sh (revision b2d078dc)
1*b2d078dcSjruoho# $NetBSD: t_tmux.sh,v 1.2 2012/05/19 07:30:37 jruoho Exp $
2af98463dSjruoho#
3af98463dSjruoho# Copyright (c) 2012 The NetBSD Foundation, Inc.
4af98463dSjruoho# All rights reserved.
5af98463dSjruoho#
6af98463dSjruoho# This code is derived from software contributed to The NetBSD Foundation
7af98463dSjruoho# by Jukka Ruohonen.
8af98463dSjruoho#
9af98463dSjruoho# Redistribution and use in source and binary forms, with or without
10af98463dSjruoho# modification, are permitted provided that the following conditions
11af98463dSjruoho# are met:
12af98463dSjruoho# 1. Redistributions of source code must retain the above copyright
13af98463dSjruoho#    notice, this list of conditions and the following disclaimer.
14af98463dSjruoho# 2. Redistributions in binary form must reproduce the above copyright
15af98463dSjruoho#    notice, this list of conditions and the following disclaimer in the
16af98463dSjruoho#    documentation and/or other materials provided with the distribution.
17af98463dSjruoho#
18af98463dSjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19af98463dSjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20af98463dSjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21af98463dSjruoho# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22af98463dSjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23af98463dSjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24af98463dSjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25af98463dSjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26af98463dSjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27af98463dSjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28af98463dSjruoho# POSSIBILITY OF SUCH DAMAGE.
29af98463dSjruoho#
30af98463dSjruoho
31af98463dSjruohostdincrash() {
32af98463dSjruoho	atf_check -s ignore -o ignore -e ignore -x \
33*b2d078dcSjruoho	"\"tmux list-sessions 0<&-\" & sleep 2; kill $! >/dev/null 2>&1"
34af98463dSjruoho}
35af98463dSjruoho
36af98463dSjruohoatf_test_case stdin
37af98463dSjruohostdin_head() {
38af98463dSjruoho	atf_set "descr" "Test that tmux(1) does not crash the system " \
39af98463dSjruoho			"when stdin(4) is closed (PR kern/46463)"
40af98463dSjruoho}
41af98463dSjruoho
42af98463dSjruohostdin_body() {
43af98463dSjruoho	stdincrash
44af98463dSjruoho}
45af98463dSjruoho
46af98463dSjruohoatf_init_test_cases()
47af98463dSjruoho{
48af98463dSjruoho	atf_add_test_case stdin
49af98463dSjruoho}
50