xref: /minix3/tests/usr.bin/xlint/lint1/t_integration.sh (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc# $NetBSD: t_integration.sh,v 1.4 2014/04/21 19:10:41 christos Exp $
211be35a1SLionel Sambuc#
311be35a1SLionel Sambuc# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
411be35a1SLionel Sambuc# All rights reserved.
511be35a1SLionel Sambuc#
611be35a1SLionel Sambuc# Redistribution and use in source and binary forms, with or without
711be35a1SLionel Sambuc# modification, are permitted provided that the following conditions
811be35a1SLionel Sambuc# are met:
911be35a1SLionel Sambuc# 1. Redistributions of source code must retain the above copyright
1011be35a1SLionel Sambuc#    notice, this list of conditions and the following disclaimer.
1111be35a1SLionel Sambuc# 2. Redistributions in binary form must reproduce the above copyright
1211be35a1SLionel Sambuc#    notice, this list of conditions and the following disclaimer in the
1311be35a1SLionel Sambuc#    documentation and/or other materials provided with the distribution.
1411be35a1SLionel Sambuc#
1511be35a1SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1611be35a1SLionel Sambuc# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1711be35a1SLionel Sambuc# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1811be35a1SLionel Sambuc# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1911be35a1SLionel Sambuc# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2011be35a1SLionel Sambuc# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2111be35a1SLionel Sambuc# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2211be35a1SLionel Sambuc# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2311be35a1SLionel Sambuc# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2411be35a1SLionel Sambuc# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2511be35a1SLionel Sambuc# POSSIBILITY OF SUCH DAMAGE.
2611be35a1SLionel Sambuc#
2711be35a1SLionel Sambuc
2811be35a1SLionel SambucLINT1=/usr/libexec/lint1
2911be35a1SLionel Sambuc
3011be35a1SLionel SambucNames=
3111be35a1SLionel Sambuc
3211be35a1SLionel Sambuccheck_valid()
3311be35a1SLionel Sambuc{
3411be35a1SLionel Sambuc	atf_check -s exit:0 ${LINT1} -g -S "$(atf_get_srcdir)/$1" /dev/null
3511be35a1SLionel Sambuc}
3611be35a1SLionel Sambuc
3711be35a1SLionel Sambuccheck_invalid()
3811be35a1SLionel Sambuc{
3911be35a1SLionel Sambuc	atf_check -s not-exit:0 -o ignore -e ignore ${LINT1} -g -S -w \
4011be35a1SLionel Sambuc	    "$(atf_get_srcdir)/$1" /dev/null
4111be35a1SLionel Sambuc}
4211be35a1SLionel Sambuc
4311be35a1SLionel Sambuctest_case()
4411be35a1SLionel Sambuc{
4511be35a1SLionel Sambuc	local result="${1}"; shift
4611be35a1SLionel Sambuc	local name="${1}"; shift
4711be35a1SLionel Sambuc	local descr="${*}"
4811be35a1SLionel Sambuc
4911be35a1SLionel Sambuc	atf_test_case ${name}
5011be35a1SLionel Sambuc	eval "${name}_head() {
5111be35a1SLionel Sambuc		atf_set \"descr\" \"${descr}\";
5211be35a1SLionel Sambuc		atf_set \"require.progs\" \"${LINT1}\";
5311be35a1SLionel Sambuc	}"
5411be35a1SLionel Sambuc	eval "${name}_body() {
5511be35a1SLionel Sambuc		${result} d_${name}.c;
5611be35a1SLionel Sambuc	}"
5711be35a1SLionel Sambuc
5811be35a1SLionel Sambuc	Names="${Names} ${name}"
5911be35a1SLionel Sambuc}
6011be35a1SLionel Sambuc
6111be35a1SLionel Sambuctest_case check_valid c99_struct_init "Checks C99 struct initialization"
6211be35a1SLionel Sambuctest_case check_valid c99_union_init1 "Checks C99 union initialization"
6311be35a1SLionel Sambuctest_case check_valid c99_union_init2 "Checks C99 union initialization"
6411be35a1SLionel Sambuctest_case check_valid c99_union_init3 "Checks C99 union initialization"
6511be35a1SLionel Sambuctest_case check_valid c99_recursive_init "Checks C99 recursive struct/union" \
6611be35a1SLionel Sambuc    "initialization"
6711be35a1SLionel Sambuctest_case check_valid c9x_recursive_init "Checks C9X struct/union member" \
6811be35a1SLionel Sambuc    "init, with nested union and trailing member"
6911be35a1SLionel Sambuctest_case check_valid nested_structs "Checks nested structs"
7011be35a1SLionel Sambuctest_case check_valid packed_structs "Checks packed structs"
7111be35a1SLionel Sambuc
7211be35a1SLionel Sambuctest_case check_valid cast_init "Checks cast initialization"
7311be35a1SLionel Sambuctest_case check_valid cast_init2 "Checks cast initialization as the rhs of a" \
7411be35a1SLionel Sambuc    "- operand"
7511be35a1SLionel Sambuctest_case check_valid cast_lhs "Checks whether pointer casts are valid lhs" \
7611be35a1SLionel Sambuc    "lvalues"
7711be35a1SLionel Sambuc
7811be35a1SLionel Sambuctest_case check_valid gcc_func "Checks GCC __FUNCTION__"
7911be35a1SLionel Sambuctest_case check_valid c99_func "Checks C99 __func__"
8011be35a1SLionel Sambuc
8111be35a1SLionel Sambuctest_case check_valid gcc_variable_array_init "Checks GCC variable array" \
8211be35a1SLionel Sambuc    "initializers"
8311be35a1SLionel Sambuctest_case check_valid c9x_array_init "Checks C9X array initializers"
8411be35a1SLionel Sambuctest_case check_valid c99_decls_after_stmt "Checks C99 decls after statements"
85*0a6a1f1dSLionel Sambuctest_case check_valid c99_decls_after_stmt3 "Checks C99 decls after statements"
8611be35a1SLionel Sambuctest_case check_valid nolimit_init "Checks no limit initializers"
8711be35a1SLionel Sambuctest_case check_valid zero_sized_arrays "Checks zero sized arrays"
8811be35a1SLionel Sambuc
8911be35a1SLionel Sambuctest_case check_valid compound_literals1 "Checks compound literals"
9011be35a1SLionel Sambuctest_case check_valid compound_literals2 "Checks compound literals"
9111be35a1SLionel Sambuctest_case check_valid gcc_compound_statements1 "Checks GCC compound statements"
9211be35a1SLionel Sambuctest_case check_valid gcc_compound_statements2 "Checks GCC compound" \
9311be35a1SLionel Sambuc    "statements with non-expressions"
9411be35a1SLionel Sambuctest_case check_valid gcc_compound_statements3 "Checks GCC compound" \
9511be35a1SLionel Sambuc    "statements with void type"
96*0a6a1f1dSLionel Sambuc# XXX: Because of polymorphic __builtin_isnan and expression has null effect
97*0a6a1f1dSLionel Sambuc# test_case check_valid gcc_extension "Checks GCC __extension__ and __typeof__"
9811be35a1SLionel Sambuc
9911be35a1SLionel Sambuctest_case check_valid cvt_in_ternary "Checks CVT nodes handling in ?" \
100*0a6a1f1dSLionel Sambuctest_case check_valid cvt_constant "Checks constant conversion"
10111be35a1SLionel Sambuctest_case check_valid ellipsis_in_switch "Checks ellipsis in switch()"
10211be35a1SLionel Sambuctest_case check_valid c99_complex_num "Checks C99 complex numbers"
103*0a6a1f1dSLionel Sambuctest_case check_valid c99_complex_split "Checks C99 complex access"
10411be35a1SLionel Sambuctest_case check_valid c99_for_loops "Checks C99 for loops"
10511be35a1SLionel Sambuctest_case check_valid alignof "Checks __alignof__"
10611be35a1SLionel Sambuctest_case check_valid shift_to_narrower_type "Checks that type shifts that" \
10711be35a1SLionel Sambuc    "result in narrower types do not produce warnings"
10811be35a1SLionel Sambuc
10911be35a1SLionel Sambuctest_case check_invalid constant_conv1 "Checks failing on information-losing" \
11011be35a1SLionel Sambuc    "constant conversion in argument lists"
11111be35a1SLionel Sambuctest_case check_invalid constant_conv2 "Checks failing on information-losing" \
11211be35a1SLionel Sambuc    "constant conversion in argument lists"
11311be35a1SLionel Sambuc
11411be35a1SLionel Sambuctest_case check_invalid type_conv1 "Checks failing on information-losing" \
11511be35a1SLionel Sambuc    "type conversion in argument lists"
11611be35a1SLionel Sambuctest_case check_invalid type_conv2 "Checks failing on information-losing" \
11711be35a1SLionel Sambuc    "type conversion in argument lists"
11811be35a1SLionel Sambuctest_case check_invalid type_conv3 "Checks failing on information-losing" \
11911be35a1SLionel Sambuc    "type conversion in argument lists"
12011be35a1SLionel Sambuc
12111be35a1SLionel Sambuctest_case check_invalid incorrect_array_size "Checks failing on incorrect" \
12211be35a1SLionel Sambuc    "array sizes"
12311be35a1SLionel Sambuc
12411be35a1SLionel Sambuctest_case check_invalid long_double_int "Checks for confusion of 'long" \
12511be35a1SLionel Sambuc    "double' with 'long int'; PR 39639"
12611be35a1SLionel Sambuc
12711be35a1SLionel Sambucatf_init_test_cases()
12811be35a1SLionel Sambuc{
12911be35a1SLionel Sambuc	for name in ${Names}; do
13011be35a1SLionel Sambuc		atf_add_test_case ${name}
13111be35a1SLionel Sambuc	done
13211be35a1SLionel Sambuc}
133