1 # $NetBSD: Makefile,v 1.19 2021/10/18 20:18:00 rillig Exp $ 2 3 .include <bsd.own.mk> 4 5 TESTSDIR= ${TESTSBASE}/usr.bin/indent 6 TESTS_SH= t_errors 7 TESTS_SH+= t_indent 8 TESTS_SH+= t_misc 9 TESTS_SH+= t_options 10 11 FILESDIR= ${TESTSDIR} 12 FILES= block.0 13 FILES+= block.0.stdout 14 FILES+= declarations.0 15 FILES+= declarations.0.stderr 16 FILES+= declarations.0.stdout 17 FILES+= elsecomment.0 18 FILES+= elsecomment.0.stdout 19 FILES+= elsecomment.0.pro 20 FILES+= f_decls.0 21 FILES+= f_decls.0.stdout 22 FILES+= indent_variables.0 23 FILES+= indent_variables.0.pro 24 FILES+= indent_variables.0.stdout 25 FILES+= label.c 26 FILES+= lex.0 27 FILES+= lex.0.pro 28 FILES+= lex.0.stdout 29 FILES+= lex_char.0 30 FILES+= lex_char.0.pro 31 FILES+= lex_char.0.stdout 32 FILES+= lex_string.0 33 FILES+= lex_string.0.pro 34 FILES+= lex_string.0.stdout 35 FILES+= lineno.0 36 FILES+= lineno.0.pro 37 FILES+= lineno.0.stdout 38 FILES+= list_head.0 39 FILES+= list_head.0.stdout 40 FILES+= ncs.0 41 FILES+= ncs.0.stdout 42 FILES+= ncs.0.pro 43 FILES+= offsetof.0 44 FILES+= offsetof.0.stdout 45 FILES+= opt--version.0 46 FILES+= opt--version.0.pro 47 FILES+= opt--version.0.stdout 48 FILES+= opt-P.0 49 FILES+= opt-P.0.pro 50 FILES+= opt-P.0.stdout 51 FILES+= opt-T.0 52 FILES+= opt-T.0.pro 53 FILES+= opt-T.0.stdout 54 FILES+= opt-U.0 55 FILES+= opt-U.0.list 56 FILES+= opt-U.0.pro 57 FILES+= opt-U.0.stdout 58 FILES+= opt-bap+sob.0 59 FILES+= opt-bap+sob.0.pro 60 FILES+= opt-bap+sob.0.stdout 61 FILES+= opt-bl.0 62 FILES+= opt-bl.0.pro 63 FILES+= opt-bl.0.stdout 64 FILES+= opt-br.0 65 FILES+= opt-br.0.pro 66 FILES+= opt-br.0.stdout 67 FILES+= opt-c.0 68 FILES+= opt-c.0.pro 69 FILES+= opt-c.0.stdout 70 FILES+= opt-cd.0 71 FILES+= opt-cd.0.pro 72 FILES+= opt-cd.0.stdout 73 FILES+= opt-ci.0 74 FILES+= opt-ci.0.pro 75 FILES+= opt-ci.0.stdout 76 FILES+= opt-cli.0 77 FILES+= opt-cli.0.pro 78 FILES+= opt-cli.0.stdout 79 FILES+= opt-d.0 80 FILES+= opt-d.0.pro 81 FILES+= opt-d.0.stdout 82 FILES+= opt-di.0 83 FILES+= opt-di.0.pro 84 FILES+= opt-di.0.stdout 85 FILES+= opt-i.0 86 FILES+= opt-i.0.pro 87 FILES+= opt-i.0.stdout 88 FILES+= opt-l.0 89 FILES+= opt-l.0.pro 90 FILES+= opt-l.0.stdout 91 FILES+= opt-lc.0 92 FILES+= opt-lc.0.pro 93 FILES+= opt-lc.0.stdout 94 FILES+= opt-ldi.0 95 FILES+= opt-ldi.0.pro 96 FILES+= opt-ldi.0.stdout 97 FILES+= opt-npro.0 98 FILES+= opt-npro.0.pro 99 FILES+= opt-npro.0.stdout 100 FILES+= opt-ta.0 101 FILES+= opt-ta.0.pro 102 FILES+= opt-ta.0.stdout 103 FILES+= opt-ts.0 104 FILES+= opt-ts.0.pro 105 FILES+= opt-ts.0.stdout 106 FILES+= opt.0 107 FILES+= opt.0.pro 108 FILES+= opt.0.stdout 109 FILES+= opt_bacc.c 110 FILES+= opt_bad.c 111 FILES+= opt_badp.c 112 FILES+= opt_bap.c 113 FILES+= opt_bbb.c 114 FILES+= opt_bc.c 115 FILES+= opt_bs.c 116 FILES+= opt_cdb.c 117 FILES+= opt_ce.c 118 FILES+= opt_cs.c 119 FILES+= opt_dj.c 120 FILES+= opt_eei.c 121 FILES+= opt_ei.c 122 FILES+= opt_fbs.c 123 FILES+= opt_fc1.c 124 FILES+= opt_fcb.c 125 FILES+= opt_ip.c 126 FILES+= opt_lp.c 127 FILES+= opt_lpl.c 128 FILES+= opt_pcs.c 129 FILES+= opt_psl.c 130 FILES+= opt_sc.c 131 FILES+= opt_sob.c 132 FILES+= opt_ut.c 133 FILES+= opt_v.c 134 FILES+= parens.0 135 FILES+= parens.0.stdout 136 FILES+= parens.0.pro 137 FILES+= pcs.0 138 FILES+= pcs.0.stdout 139 FILES+= pcs.0.pro 140 FILES+= ps_ind_level.0 141 FILES+= ps_ind_level.0.pro 142 FILES+= ps_ind_level.0.stdout 143 FILES+= struct.0 144 FILES+= struct.0.stdout 145 FILES+= surplusbad.0 146 FILES+= surplusbad.0.stdout 147 FILES+= surplusbad.0.pro 148 FILES+= t_options.awk 149 FILES+= token-binary_op.0 150 FILES+= token-binary_op.0.pro 151 FILES+= token-binary_op.0.stdout 152 FILES+= token-case_label.0 153 FILES+= token-case_label.0.pro 154 FILES+= token-case_label.0.stdout 155 FILES+= token-colon.0 156 FILES+= token-colon.0.pro 157 FILES+= token-colon.0.stdout 158 FILES+= token-comma.0 159 FILES+= token-comma.0.pro 160 FILES+= token-comma.0.stdout 161 FILES+= token-decl.0 162 FILES+= token-decl.0.pro 163 FILES+= token-decl.0.stdout 164 FILES+= token-do_stmt.0 165 FILES+= token-do_stmt.0.pro 166 FILES+= token-do_stmt.0.stdout 167 FILES+= token-end_of_file.0 168 FILES+= token-end_of_file.0.pro 169 FILES+= token-end_of_file.0.stdout 170 FILES+= token-for_exprs.0 171 FILES+= token-for_exprs.0.pro 172 FILES+= token-for_exprs.0.stdout 173 FILES+= token-form_feed.0 174 FILES+= token-form_feed.0.pro 175 FILES+= token-form_feed.0.stdout 176 FILES+= token-funcname.0 177 FILES+= token-funcname.0.pro 178 FILES+= token-funcname.0.stdout 179 FILES+= token-if_expr.0 180 FILES+= token-if_expr.0.pro 181 FILES+= token-if_expr.0.stdout 182 FILES+= token-if_expr_stmt.0 183 FILES+= token-if_expr_stmt.0.pro 184 FILES+= token-if_expr_stmt.0.stdout 185 FILES+= token-if_expr_stmt_else.0 186 FILES+= token-if_expr_stmt_else.0.pro 187 FILES+= token-if_expr_stmt_else.0.stdout 188 FILES+= token-keyword_do.0 189 FILES+= token-keyword_do.0.pro 190 FILES+= token-keyword_do.0.stdout 191 FILES+= token-keyword_do_else.0 192 FILES+= token-keyword_do_else.0.pro 193 FILES+= token-keyword_do_else.0.stdout 194 FILES+= token-keyword_else.0 195 FILES+= token-keyword_else.0.pro 196 FILES+= token-keyword_else.0.stdout 197 FILES+= token-keyword_for_if_while.0 198 FILES+= token-keyword_for_if_while.0.pro 199 FILES+= token-keyword_for_if_while.0.stdout 200 FILES+= token-keyword_struct_union_enum.0 201 FILES+= token-keyword_struct_union_enum.0.pro 202 FILES+= token-keyword_struct_union_enum.0.stdout 203 FILES+= token-lbrace.0 204 FILES+= token-lbrace.0.pro 205 FILES+= token-lbrace.0.stdout 206 FILES+= token-lparen.0 207 FILES+= token-lparen.0.pro 208 FILES+= token-lparen.0.stdout 209 FILES+= token-newline.0 210 FILES+= token-newline.0.pro 211 FILES+= token-newline.0.stdout 212 FILES+= token-period.0 213 FILES+= token-period.0.pro 214 FILES+= token-period.0.stdout 215 FILES+= token-postfix_op.0 216 FILES+= token-postfix_op.0.pro 217 FILES+= token-postfix_op.0.stdout 218 FILES+= token-preprocessing.0 219 FILES+= token-preprocessing.0.pro 220 FILES+= token-preprocessing.0.stdout 221 FILES+= token-question.0 222 FILES+= token-question.0.pro 223 FILES+= token-question.0.stdout 224 FILES+= token-rbrace.0 225 FILES+= token-rbrace.0.pro 226 FILES+= token-rbrace.0.stdout 227 FILES+= token-rparen.0 228 FILES+= token-rparen.0.pro 229 FILES+= token-rparen.0.stdout 230 FILES+= token-semicolon.0 231 FILES+= token-semicolon.0.pro 232 FILES+= token-semicolon.0.stdout 233 FILES+= token-stmt.0 234 FILES+= token-stmt.0.pro 235 FILES+= token-stmt.0.stdout 236 FILES+= token-stmt_list.0 237 FILES+= token-stmt_list.0.pro 238 FILES+= token-stmt_list.0.stdout 239 FILES+= token-storage_class.0 240 FILES+= token-storage_class.0.pro 241 FILES+= token-storage_class.0.stdout 242 FILES+= token-string_prefix.0 243 FILES+= token-string_prefix.0.pro 244 FILES+= token-string_prefix.0.stdout 245 FILES+= token-switch_expr.0 246 FILES+= token-switch_expr.0.pro 247 FILES+= token-switch_expr.0.stdout 248 FILES+= token-type_def.0 249 FILES+= token-type_def.0.pro 250 FILES+= token-type_def.0.stdout 251 FILES+= token-unary_op.0 252 FILES+= token-unary_op.0.pro 253 FILES+= token-unary_op.0.stdout 254 FILES+= token-while_expr.0 255 FILES+= token-while_expr.0.pro 256 FILES+= token-while_expr.0.stdout 257 FILES+= token_comment.c 258 FILES+= token_ident.c 259 FILES+= types_from_file.0 260 FILES+= types_from_file.0.stdout 261 FILES+= types_from_file.0.list 262 FILES+= types_from_file.0.pro 263 FILES+= wchar.0 264 FILES+= wchar.0.stdout 265 266 add-test: .PHONY 267 @set -eu; \ 268 test=${NAME:Q}; \ 269 [ "$$test" ] || { \ 270 echo "usage: ${MAKE} add-test NAME=<name>"; \ 271 exit; \ 272 }; \ 273 \ 274 if [ -f "$$test" ]; then \ 275 echo "error: test $$test already exists." 1>&2; \ 276 exit 1; \ 277 fi; \ 278 \ 279 echo "=> Adding test $$test"; \ 280 printf '%s\n' \ 281 '/* $$''NetBSD$$ */' \ 282 '/* $$''FreeBSD$$ */' \ 283 '' \ 284 '/*' \ 285 ' * TODO: Explain the purpose of the test.' \ 286 ' */' \ 287 '' \ 288 '// TODO: Add some code that passes.' \ 289 > "$$test"; \ 290 printf '%s\n' \ 291 '/* $$''NetBSD$$ */' \ 292 '/* $$''FreeBSD$$ */' \ 293 '' \ 294 '/*' \ 295 ' * TODO: Explain the command line options of the test.' \ 296 ' */' \ 297 '' \ 298 '/* TODO: Add some command line options */' \ 299 > "$$test.pro"; \ 300 cat < "$$test" > "$$test.stdout"; \ 301 cvs add "$$test" "$$test.pro" "$$test.stdout"; \ 302 printf '%s\n' \ 303 '/^FILES+=/i' \ 304 "FILES+= $$test" \ 305 "FILES+= $$test.pro" \ 306 "FILES+= $$test.stdout" \ 307 '.' 'w' 'q' \ 308 | ed Makefile; \ 309 ${MAKE} sync-mi 310 311 # Note: only works for adding tests. 312 # To remove a test, the $$mi file must be edited manually. 313 sync-mi: .PHONY 314 @set -eu; \ 315 cd "${MAKEFILE:tA:H}/../../.."; \ 316 mi="distrib/sets/lists/tests/mi"; \ 317 cvs update "$$mi"; \ 318 fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \ 319 cat "$$mi" > "$$mi.tmp"; \ 320 printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp"; \ 321 distrib/sets/fmt-list "$$mi.tmp"; \ 322 mv "$$mi.tmp" "$$mi"; \ 323 cvs diff "$$mi" || true 324 325 .include <bsd.test.mk> 326