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