| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | # $NetBSD: check-portability.sh,v 1.3 2020/05/05 05:55:25 rillig Exp $ | | 2 | # $NetBSD: check-portability.sh,v 1.4 2020/05/05 06:11:29 rillig Exp $ |
3 | # | | 3 | # |
4 | # Test cases for mk/check/check-portability.*. | | 4 | # Test cases for mk/check/check-portability.*. |
5 | # | | 5 | # |
6 | | | 6 | |
7 | set -eu | | 7 | set -eu |
8 | | | 8 | |
9 | . "./test.subr" | | 9 | . "./test.subr" |
10 | | | 10 | |
11 | # Runs the shell program for the given file. | | 11 | # Runs the shell program for the given file. |
12 | check_portability_sh() { | | 12 | check_portability_sh() { |
13 | env PATCHDIR='patches' \ | | 13 | env PATCHDIR='patches' \ |
14 | PREFIX='/nonexistent' \ | | 14 | PREFIX='/nonexistent' \ |
15 | "$@" \ | | 15 | "$@" \ |
| @@ -110,26 +110,69 @@ if test_case_begin 'configure patched, c | | | @@ -110,26 +110,69 @@ if test_case_begin 'configure patched, c |
110 | create_file_lines 'work/configure.in' \ | | 110 | create_file_lines 'work/configure.in' \ |
111 | 'test a == b' | | 111 | 'test a == b' |
112 | | | 112 | |
113 | check_portability_sh \ | | 113 | check_portability_sh \ |
114 | 'CHECK_PORTABILITY_EXPERIMENTAL=yes' | | 114 | 'CHECK_PORTABILITY_EXPERIMENTAL=yes' |
115 | | | 115 | |
116 | assert_that "out" --file-is-empty | | 116 | assert_that "out" --file-is-empty |
117 | assert_that $exitcode --equals 0 | | 117 | assert_that $exitcode --equals 0 |
118 | | | 118 | |
119 | test_case_end | | 119 | test_case_end |
120 | fi | | 120 | fi |
121 | | | 121 | |
122 | | | 122 | |
| | | 123 | if test_case_begin 'Makefile.in patched, Makefile.am bad'; then |
| | | 124 | |
| | | 125 | # As of 2020-05-05, Makefile.am is not checked at all since only |
| | | 126 | # very few packages actually use that file during the build. |
| | | 127 | |
| | | 128 | create_file_lines 'work/patches/patch-aa' \ |
| | | 129 | '+++ Makefile.in 2020-05-05' |
| | | 130 | create_file_lines 'work/Makefile.in' \ |
| | | 131 | 'test a = b' |
| | | 132 | create_file_lines 'work/Makefile.am' \ |
| | | 133 | 'test a == b' |
| | | 134 | |
| | | 135 | check_portability_sh \ |
| | | 136 | 'CHECK_PORTABILITY_EXPERIMENTAL=yes' |
| | | 137 | |
| | | 138 | assert_that "out" --file-is-empty |
| | | 139 | assert_that $exitcode --equals 0 |
| | | 140 | |
| | | 141 | test_case_end |
| | | 142 | fi |
| | | 143 | |
| | | 144 | |
| | | 145 | if test_case_begin 'files that are usually not used for building'; then |
| | | 146 | |
| | | 147 | # The following files are mostly interesting to the upstream |
| | | 148 | # developers and are not used during the actual build, except |
| | | 149 | # if the package rebuilds everything using the GNU autotools. |
| | | 150 | |
| | | 151 | create_file_lines 'work/configure.ac' \ |
| | | 152 | 'test a == b' |
| | | 153 | create_file_lines 'work/Makefile.am' \ |
| | | 154 | 'test a == b' |
| | | 155 | |
| | | 156 | check_portability_sh \ |
| | | 157 | 'CHECK_PORTABILITY_EXPERIMENTAL=yes' |
| | | 158 | |
| | | 159 | assert_that "out" --file-is-empty |
| | | 160 | assert_that $exitcode --equals 0 |
| | | 161 | |
| | | 162 | test_case_end |
| | | 163 | fi |
| | | 164 | |
| | | 165 | |
123 | if test_case_begin 'configure patched and still bad'; then | | 166 | if test_case_begin 'configure patched and still bad'; then |
124 | | | 167 | |
125 | create_file_lines 'work/patches/patch-aa' \ | | 168 | create_file_lines 'work/patches/patch-aa' \ |
126 | '+++ configure 2020-05-04' | | 169 | '+++ configure 2020-05-04' |
127 | create_file_lines 'work/configure' \ | | 170 | create_file_lines 'work/configure' \ |
128 | '#! /bin/sh' \ | | 171 | '#! /bin/sh' \ |
129 | 'test a == b' | | 172 | 'test a == b' |
130 | | | 173 | |
131 | check_portability_sh \ | | 174 | check_portability_sh \ |
132 | 'CHECK_PORTABILITY_EXPERIMENTAL=yes' | | 175 | 'CHECK_PORTABILITY_EXPERIMENTAL=yes' |
133 | | | 176 | |
134 | create_file 'expected' <<'EOF' | | 177 | create_file 'expected' <<'EOF' |
135 | ERROR: [check-portability.awk] => Found test ... == ...: | | 178 | ERROR: [check-portability.awk] => Found test ... == ...: |