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