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