xref: /netbsd-src/tests/usr.bin/diff/t_diff.sh (revision 9ddb6ab554e70fb9bbd90c3d96b812bc57755a14)
1*9ddb6ab5Sjruoho# $NetBSD: t_diff.sh,v 1.3 2012/03/13 05:40:00 jruoho Exp $
2cb861154Sjruoho#
3cb861154Sjruoho# Copyright (c) 2011 The NetBSD Foundation, Inc.
4cb861154Sjruoho# All rights reserved.
5cb861154Sjruoho#
6cb861154Sjruoho# This code is derived from software contributed to The NetBSD Foundation
7cb861154Sjruoho# by Jukka Ruohonen.
8cb861154Sjruoho#
9cb861154Sjruoho# Redistribution and use in source and binary forms, with or without
10cb861154Sjruoho# modification, are permitted provided that the following conditions
11cb861154Sjruoho# are met:
12cb861154Sjruoho# 1. Redistributions of source code must retain the above copyright
13cb861154Sjruoho#    notice, this list of conditions and the following disclaimer.
14cb861154Sjruoho# 2. Redistributions in binary form must reproduce the above copyright
15cb861154Sjruoho#    notice, this list of conditions and the following disclaimer in the
16cb861154Sjruoho#    documentation and/or other materials provided with the distribution.
17cb861154Sjruoho#
18cb861154Sjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19cb861154Sjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20cb861154Sjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21cb861154Sjruoho# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22cb861154Sjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23cb861154Sjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24cb861154Sjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25cb861154Sjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26cb861154Sjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27cb861154Sjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28cb861154Sjruoho# POSSIBILITY OF SUCH DAMAGE.
29cb861154Sjruoho#
30cb861154Sjruoho
31cb861154Sjruohoatf_test_case mallocv
32cb861154Sjruohomallocv_head() {
33*9ddb6ab5Sjruoho	atf_set "descr" "Test diff(1) with MALLOC_OPTIONS=V (cf. PR bin/26453)"
34cb861154Sjruoho}
35cb861154Sjruoho
36cb861154Sjruohomallocv_body() {
37cb861154Sjruoho
38cb861154Sjruoho	atf_check -s ignore \
39cb861154Sjruoho		-e not-inline:"diff: memory exhausted\n" \
40cb861154Sjruoho		-x "env MALLOC_OPTIONS=V diff " \
41cb861154Sjruoho		   "$(atf_get_srcdir)/d_mallocv1.in" \
42cb861154Sjruoho		   "$(atf_get_srcdir)/d_mallocv2.in"
43cb861154Sjruoho}
44cb861154Sjruoho
45cb861154Sjruohoatf_test_case nomallocv
46cb861154Sjruohonomallocv_head() {
47cb861154Sjruoho	atf_set "descr" "Test diff(1) with no MALLOC_OPTIONS=V"
48cb861154Sjruoho}
49cb861154Sjruoho
50cb861154Sjruohonomallocv_body() {
51cb861154Sjruoho
52cb861154Sjruoho	atf_check -s exit:0 \
53cb861154Sjruoho		-e inline:"" \
54cb861154Sjruoho		-x "diff " \
55cb861154Sjruoho		   "$(atf_get_srcdir)/d_mallocv1.in" \
56cb861154Sjruoho		   "$(atf_get_srcdir)/d_mallocv2.in"
57cb861154Sjruoho}
58cb861154Sjruoho
59cb861154Sjruohoatf_test_case same
60cb861154Sjruohosame_head() {
61cb861154Sjruoho	atf_set "descr" "Test diff(1) with identical files"
62cb861154Sjruoho}
63cb861154Sjruoho
64cb861154Sjruohosame_body() {
65cb861154Sjruoho
66cb861154Sjruoho	atf_check -s exit:0 \
67cb861154Sjruoho		-e inline:"" \
68cb861154Sjruoho		-x "diff $(atf_get_srcdir)/t_diff $(atf_get_srcdir)/t_diff"
69cb861154Sjruoho}
70cb861154Sjruoho
71cb861154Sjruohoatf_init_test_cases() {
72cb861154Sjruoho	atf_add_test_case mallocv
73cb861154Sjruoho	atf_add_test_case nomallocv
74cb861154Sjruoho	atf_add_test_case same
75cb861154Sjruoho}
76