157718be8SEnji Cooper# $NetBSD: t_basic.sh,v 1.6 2012/10/15 17:49:58 njoly Exp $ 257718be8SEnji Cooper# 357718be8SEnji Cooper# Copyright (c) 2011 The NetBSD Foundation, Inc. 457718be8SEnji Cooper# All rights reserved. 557718be8SEnji Cooper# 657718be8SEnji Cooper# This code is derived from software contributed to The NetBSD Foundation 757718be8SEnji Cooper# by Jukka Ruohonen. 857718be8SEnji Cooper# 957718be8SEnji Cooper# Redistribution and use in source and binary forms, with or without 1057718be8SEnji Cooper# modification, are permitted provided that the following conditions 1157718be8SEnji Cooper# are met: 1257718be8SEnji Cooper# 1. Redistributions of source code must retain the above copyright 1357718be8SEnji Cooper# notice, this list of conditions and the following disclaimer. 1457718be8SEnji Cooper# 2. Redistributions in binary form must reproduce the above copyright 1557718be8SEnji Cooper# notice, this list of conditions and the following disclaimer in the 1657718be8SEnji Cooper# documentation and/or other materials provided with the distribution. 1757718be8SEnji Cooper# 1857718be8SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1957718be8SEnji Cooper# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2057718be8SEnji Cooper# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2157718be8SEnji Cooper# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2257718be8SEnji Cooper# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2357718be8SEnji Cooper# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2457718be8SEnji Cooper# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2557718be8SEnji Cooper# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2657718be8SEnji Cooper# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2757718be8SEnji Cooper# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2857718be8SEnji Cooper# POSSIBILITY OF SUCH DAMAGE. 2957718be8SEnji Cooper# 3057718be8SEnji Cooper 3157718be8SEnji Cooperatf_test_case basic 3257718be8SEnji Cooperbasic_head() { 3357718be8SEnji Cooper atf_set "descr" "A basic test of unifdef(1) (PR bin/42628)" 3457718be8SEnji Cooper atf_set "require.progs" "unifdef" 3557718be8SEnji Cooper} 3657718be8SEnji Cooper 3757718be8SEnji Cooperbasic_body() { 3857718be8SEnji Cooper 3957718be8SEnji Cooper atf_check -s ignore -o file:$(atf_get_srcdir)/d_basic.out \ 4057718be8SEnji Cooper -x "unifdef -U__FreeBSD__ $(atf_get_srcdir)/d_basic.in" 4157718be8SEnji Cooper} 4257718be8SEnji Cooper 4357718be8SEnji Cooperatf_test_case lastline 4457718be8SEnji Cooperlastline_head() { 4557718be8SEnji Cooper atf_set "descr" "Checks with directive on last line (PR bin/47068)" 4657718be8SEnji Cooper} 4757718be8SEnji Cooper 4857718be8SEnji Cooperlastline_body() { 4957718be8SEnji Cooper 5057718be8SEnji Cooper # With newline after cpp directive 5157718be8SEnji Cooper printf '#ifdef foo\n#endif\n' >input 5257718be8SEnji Cooper atf_check -o file:input unifdef -Ubar input 5357718be8SEnji Cooper 54*470182bbSConrad Meyer # Begin FreeBSD 55*470182bbSConrad Meyer atf_skip "our version doesn't have this behavior" 56*470182bbSConrad Meyer # Endif 57*470182bbSConrad Meyer 5857718be8SEnji Cooper # Without newline after cpp directive 5957718be8SEnji Cooper printf '#ifdef foo\n#endif' >input 6057718be8SEnji Cooper atf_check -o file:input unifdef -Ubar input 6157718be8SEnji Cooper} 6257718be8SEnji Cooper 6357718be8SEnji Cooperatf_init_test_cases() { 6457718be8SEnji Cooper atf_add_test_case basic 6557718be8SEnji Cooper atf_add_test_case lastline 6657718be8SEnji Cooper} 67