# $NetBSD: t_integration.sh,v 1.85 2025/01/03 02:14:52 rillig Exp $
#
# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
BEGIN {
archsubdir = "'"$archsubdir"'"
flags = "-g -S -w"
skip = "no"
}
$1 == "/*" && $2 ~ /^lint1-/ && $NF == "*/" {
if ($2 == "lint1-flags:" || $2 == "lint1-extra-flags:") {
if ($2 == "lint1-flags:")
flags = ""
for (i = 3; i < NF; i++)
flags = flags " " $i
} else if ($2 == "lint1-only-if:") {
for (i = 3; i < NF; i++)
if (!platform_has($i))
skip = "yes"
} else {
printf("bad lint1 comment '\''%s'\''\n", $2) > "/dev/stderr"
exit(1)
}
}
END {
printf("flags='\''%s'\''\n", flags)
printf("skip=%s\n", skip)
}
'
local config
config="$(awk "$awk" "$1")" || exit 1
eval "$config"
case "_${1%.c}_" in
*_utf8_*)
LC_ALL=en_US.UTF-8;;
*)
LC_ALL=C;;
esac
export LC_ALL
}
tests_done=''
check_lint1()
{
local src="$1"
local base="${src##*/}"
local exp="${base%.c}.exp"
local exp_ln="${src%.c}.exp-ln"
local wrk_ln="${base%.c}.ln"
local flags=""
local skip=""
if [ ! -f "$exp_ln" ]; then
exp_ln='/dev/null'
wrk_ln='/dev/null'
fi
configure_test_case "$src" # sets 'skip' and 'flags'
if [ "$skip" = "yes" ]; then
return
fi
tests_done="$tests_done $src"