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