1- # $NetBSD: t_integration.sh,v 1.84 2024/06/08 06:42:59 rillig Exp $
1+ # $NetBSD: t_integration.sh,v 1.85 2025/01/03 02:14:52 rillig Exp $
22#
33# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
44# All rights reserved.
2828: " ${lint1:=/ usr/ libexec/ lint1} "
2929: " ${archsubdir:= archsubdir_must_be_set} "
3030
31+ srcdir=" $( atf_get_srcdir) "
3132
3233configure_test_case ()
3334{
@@ -113,13 +114,14 @@ configure_test_case()
113114 export LC_ALL
114115}
115116
116- # shellcheck disable=SC2155
117+ tests_done= ' '
117118check_lint1 ()
118119{
119- local src=" $( atf_get_srcdir) /$1 "
120- local exp=" ${1% .c} .exp"
120+ local src=" $1 "
121+ local base=" ${src##*/ } "
122+ local exp=" ${base% .c} .exp"
121123 local exp_ln=" ${src% .c} .exp-ln"
122- local wrk_ln=" ${1 % .c} .ln"
124+ local wrk_ln=" ${base % .c} .ln"
123125 local flags=" "
124126 local skip=" "
125127
@@ -131,13 +133,13 @@ check_lint1()
131133 configure_test_case " $src " # sets 'skip' and 'flags'
132134
133135 if [ " $skip " = " yes" ]; then
134- atf_skip " unsuitable platform "
136+ return
135137 fi
138+ tests_done=" $tests_done $src "
136139
137140 # shellcheck disable=SC2086
138141 atf_check -s ' exit' -o " save:$exp " \
139142 " $lint1 " $flags " $src " " $wrk_ln "
140- atf_check lua " $( atf_get_srcdir) /check-expect.lua" " $src "
141143
142144 if [ " $exp_ln " != ' /dev/null' ]; then
143145 # Remove comments and whitespace from the .exp-ln file.
@@ -152,21 +154,22 @@ check_lint1()
152154 fi
153155}
154156
157+ atf_test_case lint1
158+ lint1_head () {
159+ atf_set ' require.progs' " $lint1 "
160+ }
161+ lint1_body () {
162+ local src
163+
164+ for src in " $srcdir " /* .c; do
165+ check_lint1 " $src "
166+ done
167+
168+ # shellcheck disable=SC2086
169+ atf_check lua " $srcdir /check-expect.lua" $tests_done
170+ }
171+
155172atf_init_test_cases ()
156173{
157- local src name
158-
159- for src in " $( atf_get_srcdir) " /* .c; do
160- src=${src##*/ }
161- name=${src% .c}
162-
163- atf_test_case " $name "
164- eval " ${name} _head() {
165- atf_set 'require.progs' '$lint1 '
166- }"
167- eval " ${name} _body() {
168- check_lint1 '$name .c'
169- }"
170- atf_add_test_case " $name "
171- done
174+ atf_add_test_case lint1
172175}
0 commit comments