t_integration.sh revision 1.6 1 1.6 rillig # $NetBSD: t_integration.sh,v 1.6 2020/12/28 09:58:56 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.1 jruoho check_valid()
33 1.1 jruoho {
34 1.1 jruoho atf_check -s exit:0 ${LINT1} -g -S "$(atf_get_srcdir)/$1" /dev/null
35 1.1 jruoho }
36 1.1 jruoho
37 1.1 jruoho check_invalid()
38 1.1 jruoho {
39 1.6 rillig local src="$(atf_get_srcdir)/$1"
40 1.6 rillig local exp="${src%.c}.exp"
41 1.6 rillig
42 1.6 rillig atf_check -s not-exit:0 -o "file:${exp}" -e empty \
43 1.6 rillig ${LINT1} -g -S -w "${src}" /dev/null
44 1.1 jruoho }
45 1.1 jruoho
46 1.1 jruoho test_case()
47 1.1 jruoho {
48 1.1 jruoho local result="${1}"; shift
49 1.1 jruoho local name="${1}"; shift
50 1.1 jruoho local descr="${*}"
51 1.1 jruoho
52 1.1 jruoho atf_test_case ${name}
53 1.1 jruoho eval "${name}_head() {
54 1.1 jruoho atf_set \"descr\" \"${descr}\";
55 1.1 jruoho atf_set \"require.progs\" \"${LINT1}\";
56 1.1 jruoho }"
57 1.1 jruoho eval "${name}_body() {
58 1.1 jruoho ${result} d_${name}.c;
59 1.1 jruoho }"
60 1.1 jruoho
61 1.1 jruoho Names="${Names} ${name}"
62 1.1 jruoho }
63 1.1 jruoho
64 1.1 jruoho test_case check_valid c99_struct_init "Checks C99 struct initialization"
65 1.1 jruoho test_case check_valid c99_union_init1 "Checks C99 union initialization"
66 1.1 jruoho test_case check_valid c99_union_init2 "Checks C99 union initialization"
67 1.1 jruoho test_case check_valid c99_union_init3 "Checks C99 union initialization"
68 1.1 jruoho test_case check_valid c99_recursive_init "Checks C99 recursive struct/union" \
69 1.1 jruoho "initialization"
70 1.1 jruoho test_case check_valid c9x_recursive_init "Checks C9X struct/union member" \
71 1.1 jruoho "init, with nested union and trailing member"
72 1.1 jruoho test_case check_valid nested_structs "Checks nested structs"
73 1.1 jruoho test_case check_valid packed_structs "Checks packed structs"
74 1.1 jruoho
75 1.1 jruoho test_case check_valid cast_init "Checks cast initialization"
76 1.1 jruoho test_case check_valid cast_init2 "Checks cast initialization as the rhs of a" \
77 1.1 jruoho "- operand"
78 1.1 jruoho test_case check_valid cast_lhs "Checks whether pointer casts are valid lhs" \
79 1.1 jruoho "lvalues"
80 1.1 jruoho
81 1.1 jruoho test_case check_valid gcc_func "Checks GCC __FUNCTION__"
82 1.1 jruoho test_case check_valid c99_func "Checks C99 __func__"
83 1.1 jruoho
84 1.1 jruoho test_case check_valid gcc_variable_array_init "Checks GCC variable array" \
85 1.1 jruoho "initializers"
86 1.1 jruoho test_case check_valid c9x_array_init "Checks C9X array initializers"
87 1.1 jruoho test_case check_valid c99_decls_after_stmt "Checks C99 decls after statements"
88 1.2 njoly test_case check_valid c99_decls_after_stmt3 "Checks C99 decls after statements"
89 1.1 jruoho test_case check_valid nolimit_init "Checks no limit initializers"
90 1.1 jruoho test_case check_valid zero_sized_arrays "Checks zero sized arrays"
91 1.1 jruoho
92 1.1 jruoho test_case check_valid compound_literals1 "Checks compound literals"
93 1.1 jruoho test_case check_valid compound_literals2 "Checks compound literals"
94 1.1 jruoho test_case check_valid gcc_compound_statements1 "Checks GCC compound statements"
95 1.1 jruoho test_case check_valid gcc_compound_statements2 "Checks GCC compound" \
96 1.1 jruoho "statements with non-expressions"
97 1.1 jruoho test_case check_valid gcc_compound_statements3 "Checks GCC compound" \
98 1.1 jruoho "statements with void type"
99 1.4 christos # XXX: Because of polymorphic __builtin_isnan and expression has null effect
100 1.4 christos # test_case check_valid gcc_extension "Checks GCC __extension__ and __typeof__"
101 1.1 jruoho
102 1.1 jruoho test_case check_valid cvt_in_ternary "Checks CVT nodes handling in ?" \
103 1.3 christos test_case check_valid cvt_constant "Checks constant conversion"
104 1.1 jruoho test_case check_valid ellipsis_in_switch "Checks ellipsis in switch()"
105 1.1 jruoho test_case check_valid c99_complex_num "Checks C99 complex numbers"
106 1.3 christos test_case check_valid c99_complex_split "Checks C99 complex access"
107 1.1 jruoho test_case check_valid c99_for_loops "Checks C99 for loops"
108 1.1 jruoho test_case check_valid alignof "Checks __alignof__"
109 1.1 jruoho test_case check_valid shift_to_narrower_type "Checks that type shifts that" \
110 1.1 jruoho "result in narrower types do not produce warnings"
111 1.1 jruoho
112 1.1 jruoho test_case check_invalid constant_conv1 "Checks failing on information-losing" \
113 1.1 jruoho "constant conversion in argument lists"
114 1.1 jruoho test_case check_invalid constant_conv2 "Checks failing on information-losing" \
115 1.1 jruoho "constant conversion in argument lists"
116 1.1 jruoho
117 1.1 jruoho test_case check_invalid type_conv1 "Checks failing on information-losing" \
118 1.1 jruoho "type conversion in argument lists"
119 1.1 jruoho test_case check_invalid type_conv2 "Checks failing on information-losing" \
120 1.1 jruoho "type conversion in argument lists"
121 1.1 jruoho test_case check_invalid type_conv3 "Checks failing on information-losing" \
122 1.1 jruoho "type conversion in argument lists"
123 1.1 jruoho
124 1.1 jruoho test_case check_invalid incorrect_array_size "Checks failing on incorrect" \
125 1.1 jruoho "array sizes"
126 1.1 jruoho
127 1.1 jruoho test_case check_invalid long_double_int "Checks for confusion of 'long" \
128 1.5 jruoho "double' with 'long int'; PR bin/39639"
129 1.1 jruoho
130 1.1 jruoho atf_init_test_cases()
131 1.1 jruoho {
132 1.1 jruoho for name in ${Names}; do
133 1.1 jruoho atf_add_test_case ${name}
134 1.1 jruoho done
135 1.1 jruoho }
136