| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: t_integration.sh,v 1.66 2021/06/29 13:58:13 rillig Exp $ | | 1 | # $NetBSD: t_integration.sh,v 1.67 2021/07/11 22:41:36 rillig Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. | | 3 | # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # | | 14 | # |
| @@ -55,95 +55,84 @@ configure_test_case() | | | @@ -55,95 +55,84 @@ configure_test_case() |
55 | platform["powerpc64"] = "uchar lp64 long ldbl-64" | | 55 | platform["powerpc64"] = "uchar lp64 long ldbl-64" |
56 | platform["powerpc64"] = "uchar lp64 long ldbl-64" | | 56 | platform["powerpc64"] = "uchar lp64 long ldbl-64" |
57 | platform["riscv32"] = "schar ilp32 int ldbl-64" | | 57 | platform["riscv32"] = "schar ilp32 int ldbl-64" |
58 | platform["riscv64"] = "schar lp64 long ldbl-64" | | 58 | platform["riscv64"] = "schar lp64 long ldbl-64" |
59 | platform["sh3"] = "schar ilp32 int ldbl-64" | | 59 | platform["sh3"] = "schar ilp32 int ldbl-64" |
60 | platform["sparc"] = "schar ilp32 long ldbl-64" | | 60 | platform["sparc"] = "schar ilp32 long ldbl-64" |
61 | platform["sparc64"] = "schar lp64 long ldbl-128" | | 61 | platform["sparc64"] = "schar lp64 long ldbl-128" |
62 | platform["vax"] = "schar ilp32 long ldbl-64" | | 62 | platform["vax"] = "schar ilp32 long ldbl-64" |
63 | platform["x86_64"] = "schar lp64 long ldbl-128" | | 63 | platform["x86_64"] = "schar lp64 long ldbl-128" |
64 | } | | 64 | } |
65 | | | 65 | |
66 | function platform_has(prop) { | | 66 | function platform_has(prop) { |
67 | if (!match(prop, /^(schar|uchar|ilp32|lp64|int|long|ldbl-64|ldbl-96|ldbl-128)$/)) { | | 67 | if (!match(prop, /^(schar|uchar|ilp32|lp64|int|long|ldbl-64|ldbl-96|ldbl-128)$/)) { |
68 | printf("bad property '\''%s'\''\n", prop) > "/dev/stderr"; | | 68 | printf("bad property '\''%s'\''\n", prop) > "/dev/stderr" |
69 | exit(1); | | 69 | exit(1) |
70 | } | | 70 | } |
71 | if (platform[machine_arch] == "") { | | 71 | if (platform[machine_arch] == "") { |
72 | printf("bad machine_arch '\''%s'\''\n", machine_arch) > "/dev/stderr"; | | 72 | printf("bad machine_arch '\''%s'\''\n", machine_arch) > "/dev/stderr" |
73 | exit(1); | | 73 | exit(1) |
74 | } | | 74 | } |
75 | return match(" " platform[machine_arch] " ", " " prop " ") | | 75 | return match(" " platform[machine_arch] " ", " " prop " ") |
76 | } | | 76 | } |
77 | | | 77 | |
78 | BEGIN { | | 78 | BEGIN { |
79 | machine_arch = "'"$machine_arch"'" | | 79 | machine_arch = "'"$machine_arch"'" |
80 | flags = "-g -S -w" | | 80 | flags = "-g -S -w" |
81 | seen_only_on_arch = 0 | | 81 | skip = "no" |
82 | match_only_on_arch = 0 | | | |
83 | skip = 0 | | | |
84 | } | | 82 | } |
85 | $1 == "/*" && $2 ~ /^lint1-/ && $NF == "*/" { | | 83 | $1 == "/*" && $2 ~ /^lint1-/ && $NF == "*/" { |
86 | if ($2 == "lint1-flags:" || $2 == "lint1-extra-flags:") { | | 84 | if ($2 == "lint1-flags:" || $2 == "lint1-extra-flags:") { |
87 | if ($2 == "lint1-flags:") | | 85 | if ($2 == "lint1-flags:") |
88 | flags = "" | | 86 | flags = "" |
89 | for (i = 3; i < NF; i++) | | 87 | for (i = 3; i < NF; i++) |
90 | flags = flags " " $i | | 88 | flags = flags " " $i |
91 | } | | 89 | } |
92 | if ($2 == "lint1-only-if-arch") { | | | |
93 | seen_only_on_arch = 1 | | | |
94 | if ($3 == machine_arch) | | | |
95 | match_only_on_arch = 1 | | | |
96 | } | | | |
97 | if ($2 == "lint1-skip-if-arch" && $3 == machine_arch) | | | |
98 | skip = 1 | | | |
99 | if ($2 == "lint1-only-if" && !platform_has($3)) | | 90 | if ($2 == "lint1-only-if" && !platform_has($3)) |
100 | skip = 1 | | 91 | skip = "yes" |
101 | if ($2 == "lint1-skip-if" && platform_has($3)) | | 92 | if ($2 == "lint1-skip-if" && platform_has($3)) |
102 | skip = 1 | | 93 | skip = "yes" |
103 | } | | 94 | } |
104 | | | 95 | |
105 | END { | | 96 | END { |
106 | if (seen_only_on_arch && !match_only_on_arch) | | | |
107 | skip = 1 | | | |
108 | | | | |
109 | printf("flags='\''%s'\''\n", flags) | | 97 | printf("flags='\''%s'\''\n", flags) |
110 | printf("skip=%s\n", skip ? "yes" : "no") | | 98 | printf("skip=%s\n", skip) |
111 | } | | 99 | } |
112 | ' | | 100 | ' |
113 | | | 101 | |
114 | eval "$(awk "$awk" "$1")" | | 102 | local config |
| | | 103 | config="$(awk "$awk" "$1")" || exit 1 |
| | | 104 | eval "$config" |
115 | } | | 105 | } |
116 | | | 106 | |
117 | # shellcheck disable=SC2155 | | 107 | # shellcheck disable=SC2155 |
118 | check_lint1() | | 108 | check_lint1() |
119 | { | | 109 | { |
120 | local src="$(atf_get_srcdir)/$1" | | 110 | local src="$(atf_get_srcdir)/$1" |
121 | local exp="${src%.c}.exp" | | 111 | local exp="${src%.c}.exp" |
122 | local exp_ln="${src%.c}.exp-ln" | | 112 | local exp_ln="${src%.c}.exp-ln" |
123 | local wrk_ln="${1%.c}.ln" | | 113 | local wrk_ln="${1%.c}.ln" |
124 | local flags="" | | 114 | local flags="" |
125 | local skip="" | | 115 | local skip="" |
126 | | | 116 | |
127 | if [ ! -f "$exp_ln" ]; then | | 117 | if [ ! -f "$exp_ln" ]; then |
128 | exp_ln='/dev/null' | | 118 | exp_ln='/dev/null' |
129 | wrk_ln='/dev/null' | | 119 | wrk_ln='/dev/null' |
130 | fi | | 120 | fi |
131 | | | 121 | |
132 | configure_test_case "$src" | | 122 | configure_test_case "$src" # sets 'skip' and 'flags' |
133 | | | 123 | |
134 | if [ "$skip" = "yes" ]; then | | 124 | if [ "$skip" = "yes" ]; then |
135 | atf_check -o 'ignore' echo 'skipped' | | 125 | atf_skip "unsuitable platform" |
136 | return | | | |
137 | fi | | 126 | fi |
138 | | | 127 | |
139 | if [ -f "$exp" ]; then | | 128 | if [ -f "$exp" ]; then |
140 | # shellcheck disable=SC2086 | | 129 | # shellcheck disable=SC2086 |
141 | atf_check -s not-exit:0 -o "file:$exp" -e empty \ | | 130 | atf_check -s not-exit:0 -o "file:$exp" -e empty \ |
142 | "$lint1" $flags "$src" "$wrk_ln" | | 131 | "$lint1" $flags "$src" "$wrk_ln" |
143 | else | | 132 | else |
144 | # shellcheck disable=SC2086 | | 133 | # shellcheck disable=SC2086 |
145 | atf_check -s exit:0 \ | | 134 | atf_check -s exit:0 \ |
146 | "$lint1" $flags "$src" "$wrk_ln" | | 135 | "$lint1" $flags "$src" "$wrk_ln" |
147 | fi | | 136 | fi |
148 | | | 137 | |
149 | if [ "$exp_ln" != '/dev/null' ]; then | | 138 | if [ "$exp_ln" != '/dev/null' ]; then |