1*57718be8SEnji Cooper# $NetBSD: t_integration.sh,v 1.4 2014/04/21 19:10:41 christos Exp $ 2*57718be8SEnji Cooper# 3*57718be8SEnji Cooper# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. 4*57718be8SEnji Cooper# All rights reserved. 5*57718be8SEnji Cooper# 6*57718be8SEnji Cooper# Redistribution and use in source and binary forms, with or without 7*57718be8SEnji Cooper# modification, are permitted provided that the following conditions 8*57718be8SEnji Cooper# are met: 9*57718be8SEnji Cooper# 1. Redistributions of source code must retain the above copyright 10*57718be8SEnji Cooper# notice, this list of conditions and the following disclaimer. 11*57718be8SEnji Cooper# 2. Redistributions in binary form must reproduce the above copyright 12*57718be8SEnji Cooper# notice, this list of conditions and the following disclaimer in the 13*57718be8SEnji Cooper# documentation and/or other materials provided with the distribution. 14*57718be8SEnji Cooper# 15*57718be8SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16*57718be8SEnji Cooper# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17*57718be8SEnji Cooper# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18*57718be8SEnji Cooper# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19*57718be8SEnji Cooper# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20*57718be8SEnji Cooper# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21*57718be8SEnji Cooper# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22*57718be8SEnji Cooper# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23*57718be8SEnji Cooper# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24*57718be8SEnji Cooper# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25*57718be8SEnji Cooper# POSSIBILITY OF SUCH DAMAGE. 26*57718be8SEnji Cooper# 27*57718be8SEnji Cooper 28*57718be8SEnji CooperLINT1=/usr/libexec/lint1 29*57718be8SEnji Cooper 30*57718be8SEnji CooperNames= 31*57718be8SEnji Cooper 32*57718be8SEnji Coopercheck_valid() 33*57718be8SEnji Cooper{ 34*57718be8SEnji Cooper atf_check -s exit:0 ${LINT1} -g -S "$(atf_get_srcdir)/$1" /dev/null 35*57718be8SEnji Cooper} 36*57718be8SEnji Cooper 37*57718be8SEnji Coopercheck_invalid() 38*57718be8SEnji Cooper{ 39*57718be8SEnji Cooper atf_check -s not-exit:0 -o ignore -e ignore ${LINT1} -g -S -w \ 40*57718be8SEnji Cooper "$(atf_get_srcdir)/$1" /dev/null 41*57718be8SEnji Cooper} 42*57718be8SEnji Cooper 43*57718be8SEnji Coopertest_case() 44*57718be8SEnji Cooper{ 45*57718be8SEnji Cooper local result="${1}"; shift 46*57718be8SEnji Cooper local name="${1}"; shift 47*57718be8SEnji Cooper local descr="${*}" 48*57718be8SEnji Cooper 49*57718be8SEnji Cooper atf_test_case ${name} 50*57718be8SEnji Cooper eval "${name}_head() { 51*57718be8SEnji Cooper atf_set \"descr\" \"${descr}\"; 52*57718be8SEnji Cooper atf_set \"require.progs\" \"${LINT1}\"; 53*57718be8SEnji Cooper }" 54*57718be8SEnji Cooper eval "${name}_body() { 55*57718be8SEnji Cooper ${result} d_${name}.c; 56*57718be8SEnji Cooper }" 57*57718be8SEnji Cooper 58*57718be8SEnji Cooper Names="${Names} ${name}" 59*57718be8SEnji Cooper} 60*57718be8SEnji Cooper 61*57718be8SEnji Coopertest_case check_valid c99_struct_init "Checks C99 struct initialization" 62*57718be8SEnji Coopertest_case check_valid c99_union_init1 "Checks C99 union initialization" 63*57718be8SEnji Coopertest_case check_valid c99_union_init2 "Checks C99 union initialization" 64*57718be8SEnji Coopertest_case check_valid c99_union_init3 "Checks C99 union initialization" 65*57718be8SEnji Coopertest_case check_valid c99_recursive_init "Checks C99 recursive struct/union" \ 66*57718be8SEnji Cooper "initialization" 67*57718be8SEnji Coopertest_case check_valid c9x_recursive_init "Checks C9X struct/union member" \ 68*57718be8SEnji Cooper "init, with nested union and trailing member" 69*57718be8SEnji Coopertest_case check_valid nested_structs "Checks nested structs" 70*57718be8SEnji Coopertest_case check_valid packed_structs "Checks packed structs" 71*57718be8SEnji Cooper 72*57718be8SEnji Coopertest_case check_valid cast_init "Checks cast initialization" 73*57718be8SEnji Coopertest_case check_valid cast_init2 "Checks cast initialization as the rhs of a" \ 74*57718be8SEnji Cooper "- operand" 75*57718be8SEnji Coopertest_case check_valid cast_lhs "Checks whether pointer casts are valid lhs" \ 76*57718be8SEnji Cooper "lvalues" 77*57718be8SEnji Cooper 78*57718be8SEnji Coopertest_case check_valid gcc_func "Checks GCC __FUNCTION__" 79*57718be8SEnji Coopertest_case check_valid c99_func "Checks C99 __func__" 80*57718be8SEnji Cooper 81*57718be8SEnji Coopertest_case check_valid gcc_variable_array_init "Checks GCC variable array" \ 82*57718be8SEnji Cooper "initializers" 83*57718be8SEnji Coopertest_case check_valid c9x_array_init "Checks C9X array initializers" 84*57718be8SEnji Coopertest_case check_valid c99_decls_after_stmt "Checks C99 decls after statements" 85*57718be8SEnji Coopertest_case check_valid c99_decls_after_stmt3 "Checks C99 decls after statements" 86*57718be8SEnji Coopertest_case check_valid nolimit_init "Checks no limit initializers" 87*57718be8SEnji Coopertest_case check_valid zero_sized_arrays "Checks zero sized arrays" 88*57718be8SEnji Cooper 89*57718be8SEnji Coopertest_case check_valid compound_literals1 "Checks compound literals" 90*57718be8SEnji Coopertest_case check_valid compound_literals2 "Checks compound literals" 91*57718be8SEnji Coopertest_case check_valid gcc_compound_statements1 "Checks GCC compound statements" 92*57718be8SEnji Coopertest_case check_valid gcc_compound_statements2 "Checks GCC compound" \ 93*57718be8SEnji Cooper "statements with non-expressions" 94*57718be8SEnji Coopertest_case check_valid gcc_compound_statements3 "Checks GCC compound" \ 95*57718be8SEnji Cooper "statements with void type" 96*57718be8SEnji Cooper# XXX: Because of polymorphic __builtin_isnan and expression has null effect 97*57718be8SEnji Cooper# test_case check_valid gcc_extension "Checks GCC __extension__ and __typeof__" 98*57718be8SEnji Cooper 99*57718be8SEnji Coopertest_case check_valid cvt_in_ternary "Checks CVT nodes handling in ?" \ 100*57718be8SEnji Coopertest_case check_valid cvt_constant "Checks constant conversion" 101*57718be8SEnji Coopertest_case check_valid ellipsis_in_switch "Checks ellipsis in switch()" 102*57718be8SEnji Coopertest_case check_valid c99_complex_num "Checks C99 complex numbers" 103*57718be8SEnji Coopertest_case check_valid c99_complex_split "Checks C99 complex access" 104*57718be8SEnji Coopertest_case check_valid c99_for_loops "Checks C99 for loops" 105*57718be8SEnji Coopertest_case check_valid alignof "Checks __alignof__" 106*57718be8SEnji Coopertest_case check_valid shift_to_narrower_type "Checks that type shifts that" \ 107*57718be8SEnji Cooper "result in narrower types do not produce warnings" 108*57718be8SEnji Cooper 109*57718be8SEnji Coopertest_case check_invalid constant_conv1 "Checks failing on information-losing" \ 110*57718be8SEnji Cooper "constant conversion in argument lists" 111*57718be8SEnji Coopertest_case check_invalid constant_conv2 "Checks failing on information-losing" \ 112*57718be8SEnji Cooper "constant conversion in argument lists" 113*57718be8SEnji Cooper 114*57718be8SEnji Coopertest_case check_invalid type_conv1 "Checks failing on information-losing" \ 115*57718be8SEnji Cooper "type conversion in argument lists" 116*57718be8SEnji Coopertest_case check_invalid type_conv2 "Checks failing on information-losing" \ 117*57718be8SEnji Cooper "type conversion in argument lists" 118*57718be8SEnji Coopertest_case check_invalid type_conv3 "Checks failing on information-losing" \ 119*57718be8SEnji Cooper "type conversion in argument lists" 120*57718be8SEnji Cooper 121*57718be8SEnji Coopertest_case check_invalid incorrect_array_size "Checks failing on incorrect" \ 122*57718be8SEnji Cooper "array sizes" 123*57718be8SEnji Cooper 124*57718be8SEnji Coopertest_case check_invalid long_double_int "Checks for confusion of 'long" \ 125*57718be8SEnji Cooper "double' with 'long int'; PR 39639" 126*57718be8SEnji Cooper 127*57718be8SEnji Cooperatf_init_test_cases() 128*57718be8SEnji Cooper{ 129*57718be8SEnji Cooper for name in ${Names}; do 130*57718be8SEnji Cooper atf_add_test_case ${name} 131*57718be8SEnji Cooper done 132*57718be8SEnji Cooper} 133