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