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