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