Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/unit-tests/unit-test.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / unit-tests / unit-test.c` 68 lines ยท 2046 bytes Raw Blame History 1 #include "unit-test.h" 2 #include "hex.h" 3 #include "parse-options.h" 4 #include "strbuf.h" 5 #include "string-list.h" 6 #include "strvec.h" 7 8 static const char * const unit_test_usage[] = { 9 N_("unit-test []"), 10 NULL, 11 }; 12 13 int cmd_main(int argc, const char **argv) 14 { 15 struct string_list run_args = STRING_LIST_INIT_NODUP; 16 struct string_list exclude_args = STRING_LIST_INIT_NODUP; 17 int immediate = 0; 18 struct option options[] = { 19 OPT_BOOL('i', "immediate", &immediate, 20 N_("immediately exit upon the first failed test")), 21 OPT_STRING_LIST('r', "run", &run_args, N_("suite[::test]"), 22 N_("run only test suite or individual test ")), 23 OPT_STRING_LIST(0, "exclude", &exclude_args, N_("suite"), 24 N_("exclude test suite ")), 25 /* 26 * Compatibility wrappers so that we don't have to filter 27 * options understood by integration tests. 28 */ 29 OPT_NOOP_NOARG('d', "debug"), 30 OPT_NOOP_NOARG(0, "github-workflow-markup"), 31 OPT_NOOP_NOARG('l', "long-tests"), 32 OPT_NOOP_NOARG(0, "no-bin-wrappers"), 33 OPT_NOOP_ARG(0, "no-chain-lint"), 34 OPT_NOOP_ARG(0, "root"), 35 OPT_NOOP_ARG(0, "stress"), 36 OPT_NOOP_NOARG(0, "tee"), 37 OPT_NOOP_ARG(0, "valgrind"), 38 OPT_NOOP_ARG(0, "valgrind-only"), 39 OPT_NOOP_NOARG('v', "verbose"), 40 OPT_NOOP_NOARG('V', "verbose-log"), 41 OPT_NOOP_ARG(0, "verbose-only"), 42 OPT_NOOP_NOARG(0, "with-dashes"), 43 OPT_NOOP_NOARG('x', NULL), 44 OPT_END(), 45 }; 46 struct strvec args = STRVEC_INIT; 47 int ret; 48 49 argc = parse_options(argc, argv, NULL, options, 50 unit_test_usage, PARSE_OPT_KEEP_ARGV0); 51 if (argc > 1) 52 usagef(_("extra command line parameter '%s'"), argv[0]); 53 54 strvec_push(&args, argv[0]); 55 strvec_push(&args, "-t"); 56 if (immediate) 57 strvec_push(&args, "-Q"); 58 for (size_t i = 0; i < run_args.nr; i++) 59 strvec_pushf(&args, "-s%s", run_args.items[i].string); 60 for (size_t i = 0; i < exclude_args.nr; i++) 61 strvec_pushf(&args, "-x%s", exclude_args.items[i].string); 62 63 ret = clar_test(args.nr, (char **) args.v); 64 65 string_list_clear(&run_args, 0); 66 strvec_clear(&args); 67 return ret; 68 }