1 # $NetBSD: Makefile,v 1.20 2021/10/18 22:30:34 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.c 150 FILES+= token_case_label.c 151 FILES+= token_colon.c 152 FILES+= token_comma.c 153 FILES+= token_comment.c 154 FILES+= token_decl.c 155 FILES+= token_do_stmt.c 156 FILES+= token_end_of_file.c 157 FILES+= token_for_exprs.c 158 FILES+= token_form_feed.c 159 FILES+= token_funcname.c 160 FILES+= token_ident.c 161 FILES+= token_if_expr.c 162 FILES+= token_if_expr_stmt.c 163 FILES+= token_if_expr_stmt_else.c 164 FILES+= token_keyword_do.c 165 FILES+= token_keyword_do_else.c 166 FILES+= token_keyword_else.c 167 FILES+= token_keyword_for_if_while.c 168 FILES+= token_keyword_struct_union_enum.c 169 FILES+= token_lbrace.c 170 FILES+= token_lparen.c 171 FILES+= token_newline.c 172 FILES+= token_period.c 173 FILES+= token_postfix_op.c 174 FILES+= token_preprocessing.c 175 FILES+= token_question.c 176 FILES+= token_rbrace.c 177 FILES+= token_rparen.c 178 FILES+= token_semicolon.c 179 FILES+= token_stmt.c 180 FILES+= token_stmt_list.c 181 FILES+= token_storage_class.c 182 FILES+= token_string_prefix.c 183 FILES+= token_switch_expr.c 184 FILES+= token_type_def.c 185 FILES+= token_unary_op.c 186 FILES+= token_while_expr.c 187 FILES+= types_from_file.0 188 FILES+= types_from_file.0.stdout 189 FILES+= types_from_file.0.list 190 FILES+= types_from_file.0.pro 191 FILES+= wchar.0 192 FILES+= wchar.0.stdout 193 194 add-test: .PHONY 195 @set -eu; \ 196 test=${NAME:Q}; \ 197 [ "$$test" ] || { \ 198 echo "usage: ${MAKE} add-test NAME=<name>"; \ 199 exit; \ 200 }; \ 201 \ 202 if [ -f "$$test" ]; then \ 203 echo "error: test $$test already exists." 1>&2; \ 204 exit 1; \ 205 fi; \ 206 \ 207 echo "=> Adding test $$test"; \ 208 printf '%s\n' \ 209 '/* $$''NetBSD$$ */' \ 210 '/* $$''FreeBSD$$ */' \ 211 '' \ 212 '/*' \ 213 ' * TODO: Explain the purpose of the test.' \ 214 ' */' \ 215 '' \ 216 '// TODO: Add some code that passes.' \ 217 > "$$test"; \ 218 printf '%s\n' \ 219 '/* $$''NetBSD$$ */' \ 220 '/* $$''FreeBSD$$ */' \ 221 '' \ 222 '/*' \ 223 ' * TODO: Explain the command line options of the test.' \ 224 ' */' \ 225 '' \ 226 '/* TODO: Add some command line options */' \ 227 > "$$test.pro"; \ 228 cat < "$$test" > "$$test.stdout"; \ 229 cvs add "$$test" "$$test.pro" "$$test.stdout"; \ 230 printf '%s\n' \ 231 '/^FILES+=/i' \ 232 "FILES+= $$test" \ 233 "FILES+= $$test.pro" \ 234 "FILES+= $$test.stdout" \ 235 '.' 'w' 'q' \ 236 | ed Makefile; \ 237 ${MAKE} sync-mi 238 239 # Note: only works for adding tests. 240 # To remove a test, the $$mi file must be edited manually. 241 sync-mi: .PHONY 242 @set -eu; \ 243 cd "${MAKEFILE:tA:H}/../../.."; \ 244 mi="distrib/sets/lists/tests/mi"; \ 245 cvs update "$$mi"; \ 246 fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \ 247 cat "$$mi" > "$$mi.tmp"; \ 248 printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp"; \ 249 distrib/sets/fmt-list "$$mi.tmp"; \ 250 mv "$$mi.tmp" "$$mi"; \ 251 cvs diff "$$mi" || true 252 253 .include <bsd.test.mk> 254