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