1 # $NetBSD: Makefile,v 1.23 2021/10/19 19:59:05 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+= offsetof.0 41 FILES+= offsetof.0.stdout 42 FILES+= opt--version.0 43 FILES+= opt--version.0.pro 44 FILES+= opt--version.0.stdout 45 FILES+= opt-P.0 46 FILES+= opt-P.0.pro 47 FILES+= opt-P.0.stdout 48 FILES+= opt-T.0 49 FILES+= opt-T.0.pro 50 FILES+= opt-T.0.stdout 51 FILES+= opt-U.0 52 FILES+= opt-U.0.list 53 FILES+= opt-U.0.pro 54 FILES+= opt-U.0.stdout 55 FILES+= opt-bap+sob.0 56 FILES+= opt-bap+sob.0.pro 57 FILES+= opt-bap+sob.0.stdout 58 FILES+= opt-bl.0 59 FILES+= opt-bl.0.pro 60 FILES+= opt-bl.0.stdout 61 FILES+= opt-br.0 62 FILES+= opt-br.0.pro 63 FILES+= opt-br.0.stdout 64 FILES+= opt-c.0 65 FILES+= opt-c.0.pro 66 FILES+= opt-c.0.stdout 67 FILES+= opt-cd.0 68 FILES+= opt-cd.0.pro 69 FILES+= opt-cd.0.stdout 70 FILES+= opt-ci.0 71 FILES+= opt-ci.0.pro 72 FILES+= opt-ci.0.stdout 73 FILES+= opt-cli.0 74 FILES+= opt-cli.0.pro 75 FILES+= opt-cli.0.stdout 76 FILES+= opt-d.0 77 FILES+= opt-d.0.pro 78 FILES+= opt-d.0.stdout 79 FILES+= opt-di.0 80 FILES+= opt-di.0.pro 81 FILES+= opt-di.0.stdout 82 FILES+= opt-i.0 83 FILES+= opt-i.0.pro 84 FILES+= opt-i.0.stdout 85 FILES+= opt-l.0 86 FILES+= opt-l.0.pro 87 FILES+= opt-l.0.stdout 88 FILES+= opt-lc.0 89 FILES+= opt-lc.0.pro 90 FILES+= opt-lc.0.stdout 91 FILES+= opt-ldi.0 92 FILES+= opt-ldi.0.pro 93 FILES+= opt-ldi.0.stdout 94 FILES+= opt-npro.0 95 FILES+= opt-npro.0.pro 96 FILES+= opt-npro.0.stdout 97 FILES+= opt-ta.0 98 FILES+= opt-ta.0.pro 99 FILES+= opt-ta.0.stdout 100 FILES+= opt-ts.0 101 FILES+= opt-ts.0.pro 102 FILES+= opt-ts.0.stdout 103 FILES+= opt.0 104 FILES+= opt.0.pro 105 FILES+= opt.0.stdout 106 FILES+= opt_bacc.c 107 FILES+= opt_bad.c 108 FILES+= opt_badp.c 109 FILES+= opt_bap.c 110 FILES+= opt_bbb.c 111 FILES+= opt_bc.c 112 FILES+= opt_bs.c 113 FILES+= opt_cdb.c 114 FILES+= opt_ce.c 115 FILES+= opt_cs.c 116 FILES+= opt_dj.c 117 FILES+= opt_eei.c 118 FILES+= opt_ei.c 119 FILES+= opt_fbs.c 120 FILES+= opt_fc1.c 121 FILES+= opt_fcb.c 122 FILES+= opt_ip.c 123 FILES+= opt_lp.c 124 FILES+= opt_lpl.c 125 FILES+= opt_pcs.c 126 FILES+= opt_psl.c 127 FILES+= opt_sc.c 128 FILES+= opt_sob.c 129 FILES+= opt_ut.c 130 FILES+= opt_v.c 131 FILES+= parens.0 132 FILES+= parens.0.stdout 133 FILES+= parens.0.pro 134 FILES+= ps_ind_level.c 135 FILES+= struct.0 136 FILES+= struct.0.stdout 137 FILES+= surplusbad.0 138 FILES+= surplusbad.0.stdout 139 FILES+= surplusbad.0.pro 140 FILES+= t_options.awk 141 FILES+= token_binary_op.c 142 FILES+= token_case_label.c 143 FILES+= token_colon.c 144 FILES+= token_comma.c 145 FILES+= token_comment.c 146 FILES+= token_decl.c 147 FILES+= token_do_stmt.c 148 FILES+= token_end_of_file.c 149 FILES+= token_for_exprs.c 150 FILES+= token_form_feed.c 151 FILES+= token_funcname.c 152 FILES+= token_ident.c 153 FILES+= token_if_expr.c 154 FILES+= token_if_expr_stmt.c 155 FILES+= token_if_expr_stmt_else.c 156 FILES+= token_keyword_do.c 157 FILES+= token_keyword_do_else.c 158 FILES+= token_keyword_else.c 159 FILES+= token_keyword_for_if_while.c 160 FILES+= token_keyword_struct_union_enum.c 161 FILES+= token_lbrace.c 162 FILES+= token_lparen.c 163 FILES+= token_newline.c 164 FILES+= token_period.c 165 FILES+= token_postfix_op.c 166 FILES+= token_preprocessing.c 167 FILES+= token_question.c 168 FILES+= token_rbrace.c 169 FILES+= token_rparen.c 170 FILES+= token_semicolon.c 171 FILES+= token_stmt.c 172 FILES+= token_stmt_list.c 173 FILES+= token_storage_class.c 174 FILES+= token_string_prefix.c 175 FILES+= token_switch_expr.c 176 FILES+= token_type_def.c 177 FILES+= token_unary_op.c 178 FILES+= token_while_expr.c 179 FILES+= types_from_file.0 180 FILES+= types_from_file.0.stdout 181 FILES+= types_from_file.0.list 182 FILES+= types_from_file.0.pro 183 FILES+= wchar.0 184 FILES+= wchar.0.stdout 185 186 add-test: .PHONY 187 @set -eu; \ 188 test=${NAME:Q}.c; \ 189 if [ "$$test" = ".c" ]; then \ 190 echo "usage: ${MAKE} add-test NAME=<name>"; \ 191 exit; \ 192 fi; \ 193 \ 194 if [ -f "$$test" ]; then \ 195 echo "error: test $$test already exists." 1>&2; \ 196 exit 1; \ 197 fi; \ 198 \ 199 echo "=> Adding test $$test"; \ 200 printf '%s\n' \ 201 '/* $$''NetBSD$$ */' \ 202 '/* $$''FreeBSD$$ */' \ 203 '' \ 204 '/*' \ 205 ' * TODO: Explain the purpose of the test.' \ 206 ' */' \ 207 '' \ 208 '#indent input' \ 209 '// TODO: add input' \ 210 '#indent end' \ 211 '' \ 212 '#indent run [-options]' \ 213 '// TODO: add expected output' \ 214 '#indent end' \ 215 > "$$test"; \ 216 cvs add "$$test"; \ 217 printf '%s\n' \ 218 '/^FILES+=/i' \ 219 "FILES+= $$test" \ 220 '.' 'w' 'q' \ 221 | ed Makefile; \ 222 ${MAKE} sync-mi 223 224 # Note: only works for adding tests. 225 # To remove a test, the $$mi file must be edited manually. 226 sync-mi: .PHONY 227 @set -eu; \ 228 cd "${MAKEFILE:tA:H}/../../.."; \ 229 mi="distrib/sets/lists/tests/mi"; \ 230 cvs update "$$mi"; \ 231 fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \ 232 cat "$$mi" > "$$mi.tmp"; \ 233 printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp"; \ 234 distrib/sets/fmt-list "$$mi.tmp"; \ 235 mv "$$mi.tmp" "$$mi"; \ 236 cvs diff "$$mi" || true 237 238 .include <bsd.test.mk> 239