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