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