Merge branch 'nd/combined-test-helper'

Small test-helper programs have been consolidated into a single
binary.

* nd/combined-test-helper: (36 commits)
  t/helper: merge test-write-cache into test-tool
  t/helper: merge test-wildmatch into test-tool
  t/helper: merge test-urlmatch-normalization into test-tool
  t/helper: merge test-subprocess into test-tool
  t/helper: merge test-submodule-config into test-tool
  t/helper: merge test-string-list into test-tool
  t/helper: merge test-strcmp-offset into test-tool
  t/helper: merge test-sigchain into test-tool
  t/helper: merge test-sha1-array into test-tool
  t/helper: merge test-scrap-cache-tree into test-tool
  t/helper: merge test-run-command into test-tool
  t/helper: merge test-revision-walking into test-tool
  t/helper: merge test-regex into test-tool
  t/helper: merge test-ref-store into test-tool
  t/helper: merge test-read-cache into test-tool
  t/helper: merge test-prio-queue into test-tool
  t/helper: merge test-path-utils into test-tool
  t/helper: merge test-online-cpus into test-tool
  t/helper: merge test-mktemp into test-tool
  t/helper: merge (unused) test-mergesort into test-tool
  ...
This commit is contained in:
Junio C Hamano 2018-04-11 13:09:56 +09:00
commit 27f25845cf
121 changed files with 684 additions and 542 deletions

View File

@ -80,7 +80,7 @@ valid pack like:
# now add our object data
cat object >>tmp.pack
# and then append the pack trailer
/path/to/git.git/test-sha1 -b <tmp.pack >trailer
/path/to/git.git/t/helper/test-tool sha1 -b <tmp.pack >trailer
cat trailer >>tmp.pack
------------

View File

@ -554,6 +554,7 @@ SCRIPT_PERL =
SCRIPT_PYTHON =
SCRIPT_SH =
SCRIPT_LIB =
TEST_BUILTINS_OBJS =
TEST_PROGRAMS_NEED_X =
# Having this variable in your environment would break pipelines because
@ -659,47 +660,49 @@ X =
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
TEST_PROGRAMS_NEED_X += test-chmtime
TEST_PROGRAMS_NEED_X += test-ctype
TEST_PROGRAMS_NEED_X += test-config
TEST_PROGRAMS_NEED_X += test-date
TEST_PROGRAMS_NEED_X += test-delta
TEST_PROGRAMS_NEED_X += test-drop-caches
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
TEST_BUILTINS_OBJS += test-chmtime.o
TEST_BUILTINS_OBJS += test-config.o
TEST_BUILTINS_OBJS += test-ctype.o
TEST_BUILTINS_OBJS += test-date.o
TEST_BUILTINS_OBJS += test-delta.o
TEST_BUILTINS_OBJS += test-drop-caches.o
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
TEST_BUILTINS_OBJS += test-dump-split-index.o
TEST_BUILTINS_OBJS += test-example-decorate.o
TEST_BUILTINS_OBJS += test-genrandom.o
TEST_BUILTINS_OBJS += test-hashmap.o
TEST_BUILTINS_OBJS += test-index-version.o
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
TEST_BUILTINS_OBJS += test-match-trees.o
TEST_BUILTINS_OBJS += test-mergesort.o
TEST_BUILTINS_OBJS += test-mktemp.o
TEST_BUILTINS_OBJS += test-online-cpus.o
TEST_BUILTINS_OBJS += test-path-utils.o
TEST_BUILTINS_OBJS += test-prio-queue.o
TEST_BUILTINS_OBJS += test-read-cache.o
TEST_BUILTINS_OBJS += test-ref-store.o
TEST_BUILTINS_OBJS += test-regex.o
TEST_BUILTINS_OBJS += test-revision-walking.o
TEST_BUILTINS_OBJS += test-run-command.o
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
TEST_BUILTINS_OBJS += test-sha1-array.o
TEST_BUILTINS_OBJS += test-sha1.o
TEST_BUILTINS_OBJS += test-sigchain.o
TEST_BUILTINS_OBJS += test-strcmp-offset.o
TEST_BUILTINS_OBJS += test-string-list.o
TEST_BUILTINS_OBJS += test-submodule-config.o
TEST_BUILTINS_OBJS += test-subprocess.o
TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
TEST_BUILTINS_OBJS += test-wildmatch.o
TEST_BUILTINS_OBJS += test-write-cache.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
TEST_PROGRAMS_NEED_X += test-dump-split-index
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
TEST_PROGRAMS_NEED_X += test-example-decorate
TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-genrandom
TEST_PROGRAMS_NEED_X += test-hashmap
TEST_PROGRAMS_NEED_X += test-index-version
TEST_PROGRAMS_NEED_X += test-lazy-init-name-hash
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-match-trees
TEST_PROGRAMS_NEED_X += test-mergesort
TEST_PROGRAMS_NEED_X += test-mktemp
TEST_PROGRAMS_NEED_X += test-online-cpus
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-path-utils
TEST_PROGRAMS_NEED_X += test-prio-queue
TEST_PROGRAMS_NEED_X += test-read-cache
TEST_PROGRAMS_NEED_X += test-write-cache
TEST_PROGRAMS_NEED_X += test-ref-store
TEST_PROGRAMS_NEED_X += test-regex
TEST_PROGRAMS_NEED_X += test-revision-walking
TEST_PROGRAMS_NEED_X += test-run-command
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
TEST_PROGRAMS_NEED_X += test-sha1
TEST_PROGRAMS_NEED_X += test-sha1-array
TEST_PROGRAMS_NEED_X += test-sigchain
TEST_PROGRAMS_NEED_X += test-strcmp-offset
TEST_PROGRAMS_NEED_X += test-string-list
TEST_PROGRAMS_NEED_X += test-submodule-config
TEST_PROGRAMS_NEED_X += test-subprocess
TEST_PROGRAMS_NEED_X += test-svn-fe
TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
TEST_PROGRAMS_NEED_X += test-wildmatch
TEST_PROGRAMS_NEED_X += test-tool
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
@ -2092,7 +2095,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o
VCSSVN_OBJS += vcs-svn/svndiff.o
VCSSVN_OBJS += vcs-svn/svndump.o
TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS))
TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
$(XDIFF_OBJS) \
$(VCSSVN_OBJS) \
@ -2503,10 +2506,12 @@ t/helper/test-svn-fe$X: $(VCSSVN_LIB)
.PRECIOUS: $(TEST_OBJS)
t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
check-sha1:: t/helper/test-sha1$X
check-sha1:: t/helper/test-tool$X
t/helper/test-sha1.sh
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))

View File

@ -5,28 +5,29 @@
*
* The mtime can be changed to an absolute value:
*
* test-chmtime =<seconds> file...
* test-tool chmtime =<seconds> file...
*
* Relative to the current time as returned by time(3):
*
* test-chmtime =+<seconds> (or =-<seconds>) file...
* test-tool chmtime =+<seconds> (or =-<seconds>) file...
*
* Or relative to the current mtime of the file:
*
* test-chmtime <seconds> file...
* test-chmtime +<seconds> (or -<seconds>) file...
* test-tool chmtime <seconds> file...
* test-tool chmtime +<seconds> (or -<seconds>) file...
*
* Examples:
*
* To just print the mtime use --verbose and set the file mtime offset to 0:
*
* test-chmtime -v +0 file
* test-tool chmtime -v +0 file
*
* To set the mtime to current time:
*
* test-chmtime =+0 file
* test-tool chmtime =+0 file
*
*/
#include "test-tool.h"
#include "git-compat-util.h"
#include <utime.h>
@ -56,7 +57,7 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
return 1;
}
int cmd_main(int argc, const char **argv)
int cmd__chmtime(int argc, const char **argv)
{
static int verbose;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "config.h"
#include "string-list.h"
@ -32,7 +33,7 @@
* Examples:
*
* To print the value with highest priority for key "foo.bAr Baz.rock":
* test-config get_value "foo.bAr Baz.rock"
* test-tool config get_value "foo.bAr Baz.rock"
*
*/
@ -77,7 +78,7 @@ static int early_config_cb(const char *var, const char *value, void *vdata)
return 0;
}
int cmd_main(int argc, const char **argv)
int cmd__config(int argc, const char **argv)
{
int i, val;
const char *v;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
static int rc;
@ -28,7 +29,7 @@ static int is_in(const char *s, int ch)
#define LOWER "abcdefghijklmnopqrstuvwxyz"
#define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
int cmd_main(int argc, const char **argv)
int cmd__ctype(int argc, const char **argv)
{
TEST_CLASS(isdigit, DIGIT);
TEST_CLASS(isspace, " \n\r\t");

View File

@ -1,13 +1,14 @@
#include "test-tool.h"
#include "cache.h"
static const char *usage_msg = "\n"
" test-date relative [time_t]...\n"
" test-date show:<format> [time_t]...\n"
" test-date parse [date]...\n"
" test-date approxidate [date]...\n"
" test-date timestamp [date]...\n"
" test-date is64bit\n"
" test-date time_t-is64bit\n";
" test-tool date relative [time_t]...\n"
" test-tool date show:<format> [time_t]...\n"
" test-tool date parse [date]...\n"
" test-tool date approxidate [date]...\n"
" test-tool date timestamp [date]...\n"
" test-tool date is64bit\n"
" test-tool date time_t-is64bit\n";
static void show_relative_dates(const char **argv, struct timeval *now)
{
@ -81,7 +82,7 @@ static void parse_approx_timestamp(const char **argv, struct timeval *now)
}
}
int cmd_main(int argc, const char **argv)
int cmd__date(int argc, const char **argv)
{
struct timeval now;
const char *x;

View File

@ -8,14 +8,15 @@
* published by the Free Software Foundation.
*/
#include "test-tool.h"
#include "git-compat-util.h"
#include "delta.h"
#include "cache.h"
static const char usage_str[] =
"test-delta (-d|-p) <from_file> <data_file> <out_file>";
"test-tool delta (-d|-p) <from_file> <data_file> <out_file>";
int cmd_main(int argc, const char **argv)
int cmd__delta(int argc, const char **argv)
{
int fd;
struct stat st;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "git-compat-util.h"
#if defined(GIT_WINDOWS_NATIVE)
@ -157,7 +158,7 @@ static int cmd_dropcaches(void)
#endif
int cmd_main(int argc, const char **argv)
int cmd__drop_caches(int argc, const char **argv)
{
cmd_sync();
return cmd_dropcaches();

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "tree.h"
#include "cache-tree.h"
@ -54,7 +55,7 @@ static int dump_cache_tree(struct cache_tree *it,
return errs;
}
int cmd_main(int ac, const char **av)
int cmd__dump_cache_tree(int ac, const char **av)
{
struct index_state istate;
struct cache_tree *another = cache_tree();

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "split-index.h"
#include "ewah/ewok.h"
@ -7,7 +8,7 @@ static void show_bit(size_t pos, void *data)
printf(" %d", (int)pos);
}
int cmd_main(int ac, const char **av)
int cmd__dump_split_index(int ac, const char **av)
{
struct split_index *si;
int i;

View File

@ -1,8 +1,9 @@
#include "test-tool.h"
#include "cache.h"
#include "object.h"
#include "decorate.h"
int cmd_main(int argc, const char **argv)
int cmd__example_decorate(int argc, const char **argv)
{
struct decoration n;
struct object_id one_oid = { {1} };

View File

@ -4,9 +4,10 @@
* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.
*/
#include "test-tool.h"
#include "git-compat-util.h"
int cmd_main(int argc, const char **argv)
int cmd__genrandom(int argc, const char **argv)
{
unsigned long count, next = 0;
unsigned char *c;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "git-compat-util.h"
#include "hashmap.h"
#include "strbuf.h"
@ -77,7 +78,7 @@ static unsigned int hash(unsigned int method, unsigned int i, const char *key)
/*
* Test performance of hashmap.[ch]
* Usage: time echo "perfhashmap method rounds" | test-hashmap
* Usage: time echo "perfhashmap method rounds" | test-tool hashmap
*/
static void perf_hashmap(unsigned int method, unsigned int rounds)
{
@ -144,7 +145,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
*
* perfhashmap method rounds -> test hashmap.[ch] performance
*/
int cmd_main(int argc, const char **argv)
int cmd__hashmap(int argc, const char **argv)
{
struct strbuf line = STRBUF_INIT;
struct hashmap map;

View File

@ -1,6 +1,7 @@
#include "test-tool.h"
#include "cache.h"
int cmd_main(int argc, const char **argv)
int cmd__index_version(int argc, const char **argv)
{
struct cache_header hdr;
int version;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "parse-options.h"
@ -184,14 +185,14 @@ static void analyze_run(void)
}
}
int cmd_main(int argc, const char **argv)
int cmd__lazy_init_name_hash(int argc, const char **argv)
{
const char *usage[] = {
"test-lazy-init-name-hash -d (-s | -m)",
"test-lazy-init-name-hash -p [-c c]",
"test-lazy-init-name-hash -a a [--step s] [-c c]",
"test-lazy-init-name-hash (-s | -m) [-c c]",
"test-lazy-init-name-hash -s -m [-c c]",
"test-tool lazy-init-name-hash -d (-s | -m)",
"test-tool lazy-init-name-hash -p [-c c]",
"test-tool lazy-init-name-hash -a a [--step s] [-c c]",
"test-tool lazy-init-name-hash (-s | -m) [-c c]",
"test-tool lazy-init-name-hash -s -m [-c c]",
NULL
};
struct option options[] = {

View File

@ -1,7 +1,8 @@
#include "test-tool.h"
#include "cache.h"
#include "tree.h"
int cmd_main(int ac, const char **av)
int cmd__match_trees(int ac, const char **av)
{
struct object_id hash1, hash2, shifted;
struct tree *one, *two;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "mergesort.h"
@ -22,7 +23,7 @@ static int compare_strings(const void *a, const void *b)
return strcmp(x->text, y->text);
}
int cmd_main(int argc, const char **argv)
int cmd__mergesort(int argc, const char **argv)
{
struct line *line, *p = NULL, *lines = NULL;
struct strbuf sb = STRBUF_INIT;

View File

@ -1,9 +1,10 @@
/*
* test-mktemp.c: code to exercise the creation of temporary files
*/
#include "test-tool.h"
#include "git-compat-util.h"
int cmd_main(int argc, const char **argv)
int cmd__mktemp(int argc, const char **argv)
{
if (argc != 2)
usage("Expected 1 parameter defining the temporary file template");

View File

@ -1,7 +1,8 @@
#include "test-tool.h"
#include "git-compat-util.h"
#include "thread-utils.h"
int cmd_main(int argc, const char **argv)
int cmd__online_cpus(int argc, const char **argv)
{
printf("%d\n", online_cpus());
return 0;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "string-list.h"
@ -170,7 +171,7 @@ static struct test_data dirname_data[] = {
{ NULL, NULL }
};
int cmd_main(int argc, const char **argv)
int cmd__path_utils(int argc, const char **argv)
{
if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) {
char *buf = xmallocz(strlen(argv[2]));

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "prio-queue.h"
@ -16,7 +17,7 @@ static void show(int *v)
free(v);
}
int cmd_main(int argc, const char **argv)
int cmd__prio_queue(int argc, const char **argv)
{
struct prio_queue pq = { intcmp };

View File

@ -1,6 +1,7 @@
#include "test-tool.h"
#include "cache.h"
int cmd_main(int argc, const char **argv)
int cmd__read_cache(int argc, const char **argv)
{
int i, cnt = 1;
if (argc == 2)

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "refs.h"
#include "worktree.h"
@ -275,7 +276,7 @@ static struct command commands[] = {
{ NULL, NULL }
};
int cmd_main(int argc, const char **argv)
int cmd__ref_store(int argc, const char **argv)
{
struct ref_store *refs;
const char *func;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "git-compat-util.h"
#include "gettext.h"
@ -36,7 +37,7 @@ static int test_regex_bug(void)
return 0;
}
int cmd_main(int argc, const char **argv)
int cmd__regex(int argc, const char **argv)
{
const char *pat;
const char *str;
@ -47,8 +48,8 @@ int cmd_main(int argc, const char **argv)
if (argc == 2 && !strcmp(argv[1], "--bug"))
return test_regex_bug();
else if (argc < 3)
usage("test-regex --bug\n"
"test-regex <pattern> <string> [<options>]");
usage("test-tool regex --bug\n"
"test-tool regex <pattern> <string> [<options>]");
argv++;
pat = *argv++;

View File

@ -8,6 +8,7 @@
* published by the Free Software Foundation.
*/
#include "test-tool.h"
#include "cache.h"
#include "commit.h"
#include "diff.h"
@ -45,7 +46,7 @@ static int run_revision_walk(void)
return got_revision;
}
int cmd_main(int argc, const char **argv)
int cmd__revision_walking(int argc, const char **argv)
{
if (argc < 2)
return 1;

View File

@ -8,6 +8,7 @@
* published by the Free Software Foundation.
*/
#include "test-tool.h"
#include "git-compat-util.h"
#include "run-command.h"
#include "argv-array.h"
@ -49,7 +50,7 @@ static int task_finished(int result,
return 1;
}
int cmd_main(int argc, const char **argv)
int cmd__run_command(int argc, const char **argv)
{
struct child_process proc = CHILD_PROCESS_INIT;
int jobs;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "lockfile.h"
#include "tree.h"
@ -5,7 +6,7 @@
static struct lock_file index_lock;
int cmd_main(int ac, const char **av)
int cmd__scrap_cache_tree(int ac, const char **av)
{
setup_git_directory();
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "sha1-array.h"
@ -7,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
return 0;
}
int cmd_main(int argc, const char **argv)
int cmd__sha1_array(int argc, const char **argv)
{
struct oid_array array = OID_ARRAY_INIT;
struct strbuf line = STRBUF_INIT;

View File

@ -1,6 +1,7 @@
#include "test-tool.h"
#include "cache.h"
int cmd_main(int ac, const char **av)
int cmd__sha1(int ac, const char **av)
{
git_SHA_CTX ctx;
unsigned char sha1[20];

View File

@ -1,7 +1,7 @@
#!/bin/sh
dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
/usr/bin/time t/helper/test-sha1 >/dev/null
/usr/bin/time t/helper/test-tool sha1 >/dev/null
while read expect cnt pfx
do
@ -11,7 +11,7 @@ do
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
perl -pe 'y/\000/g/'
} | ./t/helper/test-sha1 $cnt
} | ./t/helper/test-tool sha1 $cnt
)
if test "$expect" = "$actual"
then

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "sigchain.h"
@ -13,7 +14,7 @@ X(two)
X(three)
#undef X
int cmd_main(int argc, const char **argv) {
int cmd__sigchain(int argc, const char **argv) {
sigchain_push(SIGTERM, one);
sigchain_push(SIGTERM, two);
sigchain_push(SIGTERM, three);

View File

@ -1,6 +1,7 @@
#include "test-tool.h"
#include "cache.h"
int cmd_main(int argc, const char **argv)
int cmd__strcmp_offset(int argc, const char **argv)
{
int result;
size_t offset;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "string-list.h"
@ -41,7 +42,7 @@ static int prefix_cb(struct string_list_item *item, void *cb_data)
return starts_with(item->string, prefix);
}
int cmd_main(int argc, const char **argv)
int cmd__string_list(int argc, const char **argv)
{
if (argc == 5 && !strcmp(argv[1], "split")) {
struct string_list list = STRING_LIST_INIT_DUP;

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "config.h"
#include "submodule-config.h"
@ -10,7 +11,7 @@ static void die_usage(int argc, const char **argv, const char *msg)
exit(1);
}
int cmd_main(int argc, const char **argv)
int cmd__submodule_config(int argc, const char **argv)
{
const char **arg = argv;
int my_argc = argc;

View File

@ -1,7 +1,8 @@
#include "test-tool.h"
#include "cache.h"
#include "run-command.h"
int cmd_main(int argc, const char **argv)
int cmd__subprocess(int argc, const char **argv)
{
struct child_process cp = CHILD_PROCESS_INIT;
int nogit = 0;

62
t/helper/test-tool.c Normal file
View File

@ -0,0 +1,62 @@
#include "git-compat-util.h"
#include "test-tool.h"
struct test_cmd {
const char *name;
int (*fn)(int argc, const char **argv);
};
static struct test_cmd cmds[] = {
{ "chmtime", cmd__chmtime },
{ "config", cmd__config },
{ "ctype", cmd__ctype },
{ "date", cmd__date },
{ "delta", cmd__delta },
{ "drop-caches", cmd__drop_caches },
{ "dump-cache-tree", cmd__dump_cache_tree },
{ "dump-split-index", cmd__dump_split_index },
{ "example-decorate", cmd__example_decorate },
{ "genrandom", cmd__genrandom },
{ "hashmap", cmd__hashmap },
{ "index-version", cmd__index_version },
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
{ "match-trees", cmd__match_trees },
{ "mergesort", cmd__mergesort },
{ "mktemp", cmd__mktemp },
{ "online-cpus", cmd__online_cpus },
{ "path-utils", cmd__path_utils },
{ "prio-queue", cmd__prio_queue },
{ "read-cache", cmd__read_cache },
{ "ref-store", cmd__ref_store },
{ "regex", cmd__regex },
{ "revision-walking", cmd__revision_walking },
{ "run-command", cmd__run_command },
{ "scrap-cache-tree", cmd__scrap_cache_tree },
{ "sha1-array", cmd__sha1_array },
{ "sha1", cmd__sha1 },
{ "sigchain", cmd__sigchain },
{ "strcmp-offset", cmd__strcmp_offset },
{ "string-list", cmd__string_list },
{ "submodule-config", cmd__submodule_config },
{ "subprocess", cmd__subprocess },
{ "urlmatch-normalization", cmd__urlmatch_normalization },
{ "wildmatch", cmd__wildmatch },
{ "write-cache", cmd__write_cache },
};
int cmd_main(int argc, const char **argv)
{
int i;
if (argc < 2)
die("I need a test name!");
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
if (!strcmp(cmds[i].name, argv[1])) {
argv++;
argc--;
return cmds[i].fn(argc, argv);
}
}
die("There is no test named '%s'", argv[1]);
}

40
t/helper/test-tool.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef __TEST_TOOL_H__
#define __TEST_TOOL_H__
int cmd__chmtime(int argc, const char **argv);
int cmd__config(int argc, const char **argv);
int cmd__ctype(int argc, const char **argv);
int cmd__date(int argc, const char **argv);
int cmd__delta(int argc, const char **argv);
int cmd__drop_caches(int argc, const char **argv);
int cmd__dump_cache_tree(int argc, const char **argv);
int cmd__dump_split_index(int argc, const char **argv);
int cmd__example_decorate(int argc, const char **argv);
int cmd__genrandom(int argc, const char **argv);
int cmd__hashmap(int argc, const char **argv);
int cmd__index_version(int argc, const char **argv);
int cmd__lazy_init_name_hash(int argc, const char **argv);
int cmd__match_trees(int argc, const char **argv);
int cmd__mergesort(int argc, const char **argv);
int cmd__mktemp(int argc, const char **argv);
int cmd__online_cpus(int argc, const char **argv);
int cmd__path_utils(int argc, const char **argv);
int cmd__prio_queue(int argc, const char **argv);
int cmd__read_cache(int argc, const char **argv);
int cmd__ref_store(int argc, const char **argv);
int cmd__regex(int argc, const char **argv);
int cmd__revision_walking(int argc, const char **argv);
int cmd__run_command(int argc, const char **argv);
int cmd__scrap_cache_tree(int argc, const char **argv);
int cmd__sha1_array(int argc, const char **argv);
int cmd__sha1(int argc, const char **argv);
int cmd__sigchain(int argc, const char **argv);
int cmd__strcmp_offset(int argc, const char **argv);
int cmd__string_list(int argc, const char **argv);
int cmd__submodule_config(int argc, const char **argv);
int cmd__subprocess(int argc, const char **argv);
int cmd__urlmatch_normalization(int argc, const char **argv);
int cmd__wildmatch(int argc, const char **argv);
int cmd__write_cache(int argc, const char **argv);
#endif

View File

@ -1,9 +1,10 @@
#include "test-tool.h"
#include "git-compat-util.h"
#include "urlmatch.h"
int cmd_main(int argc, const char **argv)
int cmd__urlmatch_normalization(int argc, const char **argv)
{
const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
const char usage[] = "test-tool urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
char *url1, *url2;
int opt_p = 0, opt_l = 0;

View File

@ -1,6 +1,7 @@
#include "test-tool.h"
#include "cache.h"
int cmd_main(int argc, const char **argv)
int cmd__wildmatch(int argc, const char **argv)
{
int i;
for (i = 2; i < argc; i++) {

View File

@ -1,9 +1,10 @@
#include "test-tool.h"
#include "cache.h"
#include "lockfile.h"
static struct lock_file index_lock;
int cmd_main(int argc, const char **argv)
int cmd__write_cache(int argc, const char **argv)
{
int i, cnt = 1, lockfd;
if (argc == 2)

View File

@ -39,7 +39,7 @@ native_path () {
then
path=$(cygpath --windows "$path")
else
path=$(test-path-utils real_path "$path")
path=$(test-tool path-utils real_path "$path")
fi &&
echo "$path"
}

View File

@ -49,7 +49,7 @@ rawsvnrepo="$svnrepo"
svnrepo="file://$svnrepo"
poke() {
test-chmtime +1 "$1"
test-tool chmtime +1 "$1"
}
# We need this, because we should pass empty configuration directory to

View File

@ -85,7 +85,7 @@ pack_obj () {
# Compute and append pack trailer to "$1"
pack_trailer () {
test-sha1 -b <"$1" >trailer.tmp &&
test-tool sha1 -b <"$1" >trailer.tmp &&
cat trailer.tmp >>"$1" &&
rm -f trailer.tmp
}

View File

@ -8,7 +8,7 @@ test_perf_default_repo
count=1000
test_perf "read_cache/discard_cache $count times" "
test-read-cache $count
test-tool read-cache $count
"
test_done

View File

@ -7,8 +7,8 @@ test_perf_large_repo
test_checkout_worktree
test_expect_success 'verify both methods build the same hashmaps' '
test-lazy-init-name-hash --dump --single >out.single &&
if test-lazy-init-name-hash --dump --multi >out.multi
test-tool lazy-init-name-hash --dump --single >out.single &&
if test-tool lazy-init-name-hash --dump --multi >out.multi
then
test_set_prereq REPO_BIG_ENOUGH_FOR_MULTI &&
sort <out.single >sorted.single &&
@ -46,11 +46,11 @@ test_expect_success 'calibrate' '
'
test_perf "single-threaded, $desc" "
test-lazy-init-name-hash --single --count=$count
test-tool lazy-init-name-hash --single --count=$count
"
test_perf REPO_BIG_ENOUGH_FOR_MULTI "multi-threaded, $desc" "
test-lazy-init-name-hash --multi --count=$count
test-tool lazy-init-name-hash --multi --count=$count
"
test_done

View File

@ -23,7 +23,7 @@ test_expect_success "setup repo" '
count=3
test_perf "write_locked_index $count times ($nr_files files)" "
test-write-cache $count
test-tool write-cache $count
"
test_done

View File

@ -16,7 +16,7 @@ test_perf 'sort(1)' '
'
test_perf 'string_list_sort()' '
test-string-list sort <unsorted >actual
test-tool string-list sort <unsorted >actual
'
test_expect_success 'string_list_sort() sorts like sort(1)' '

View File

@ -118,7 +118,7 @@ test_expect_success "setup for fsmonitor" '
'
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
test-drop-caches
test-tool drop-caches
fi
test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
@ -126,7 +126,7 @@ test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
'
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
test-drop-caches
test-tool drop-caches
fi
test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
@ -134,7 +134,7 @@ test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
'
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
test-drop-caches
test-tool drop-caches
fi
test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
@ -148,7 +148,7 @@ test_expect_success "setup without fsmonitor" '
'
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
test-drop-caches
test-tool drop-caches
fi
test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
@ -156,7 +156,7 @@ test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
'
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
test-drop-caches
test-tool drop-caches
fi
test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
@ -164,7 +164,7 @@ test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
'
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
test-drop-caches
test-tool drop-caches
fi
test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '

View File

@ -10,7 +10,7 @@ one
EOF
test_expect_success 'sigchain works' '
{ test-sigchain >actual; ret=$?; } &&
{ test-tool sigchain >actual; ret=$?; } &&
{
# Signal death by raise() on Windows acts like exit(3),
# regardless of the signal number. So we must allow that
@ -24,7 +24,7 @@ test_expect_success 'sigchain works' '
test_expect_success !MINGW 'signals are propagated using shell convention' '
# we use exec here to avoid any sub-shell interpretation
# of the exit code
git config alias.sigterm "!exec test-sigchain" &&
git config alias.sigterm "!exec test-tool sigchain" &&
test_expect_code 143 git sigterm
'
@ -36,7 +36,7 @@ large_git () {
}
test_expect_success 'create blob' '
test-genrandom foo 16384 >file &&
test-tool genrandom foo 16384 >file &&
git add file
'

View File

@ -10,7 +10,7 @@ check_relative() {
t=$(($TEST_DATE_NOW - $1))
echo "$t -> $2" >expect
test_expect_${3:-success} "relative date ($2)" "
test-date relative $t >actual &&
test-tool date relative $t >actual &&
test_i18ncmp expect actual
"
}
@ -35,7 +35,7 @@ check_show () {
zone=$5
test_expect_success $prereqs "show date ($format:$time)" '
echo "$time -> $expect" >expect &&
TZ=${zone:-$TZ} test-date show:"$format" "$time" >actual &&
TZ=${zone:-$TZ} test-tool date show:"$format" "$time" >actual &&
test_cmp expect actual
'
}
@ -71,7 +71,7 @@ check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_
check_parse() {
echo "$1 -> $2" >expect
test_expect_${4:-success} "parse date ($1${3:+ TZ=$3})" "
TZ=${3:-$TZ} test-date parse '$1' >actual &&
TZ=${3:-$TZ} test-tool date parse '$1' >actual &&
test_cmp expect actual
"
}
@ -92,7 +92,7 @@ check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
check_approxidate() {
echo "$1 -> $2 +0000" >expect
test_expect_${3:-success} "parse approxidate ($1)" "
test-date approxidate '$1' >actual &&
test-tool date approxidate '$1' >actual &&
test_cmp expect actual
"
}

View File

@ -17,7 +17,7 @@ cat >expect <<'EOF'
10
EOF
test_expect_success 'basic ordering' '
test-prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
test_cmp expect actual
'
@ -30,7 +30,7 @@ cat >expect <<'EOF'
6
EOF
test_expect_success 'mixed put and get' '
test-prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
test_cmp expect actual
'
@ -43,7 +43,7 @@ NULL
NULL
EOF
test_expect_success 'notice empty queue' '
test-prio-queue 1 2 get get get 1 2 get get get >actual &&
test-tool prio-queue 1 2 get get get 1 2 get get get >actual &&
test_cmp expect actual
'

View File

@ -4,7 +4,7 @@ test_description='test hashmap and string hash functions'
. ./test-lib.sh
test_hashmap() {
echo "$1" | test-hashmap $3 > actual &&
echo "$1" | test-tool hashmap $3 > actual &&
echo "$2" > expect &&
test_cmp expect actual
}
@ -232,7 +232,7 @@ test_expect_success 'grow / shrink' '
echo value40 >> expect &&
echo size >> in &&
echo 64 39 >> expect &&
cat in | test-hashmap > out &&
cat in | test-tool hashmap > out &&
test_cmp expect out
'

View File

@ -11,7 +11,7 @@ then
fi
test_expect_success 'test-sha1 detects shattered pdf' '
test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
test_i18ngrep collision err &&
grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
'

View File

@ -19,7 +19,7 @@ write_script rot13-filter.pl "$PERL_PATH" \
generate_random_characters () {
LEN=$1
NAME=$2
test-genrandom some-seed $LEN |
test-tool genrandom some-seed $LEN |
perl -pe "s/./chr((ord($&) % 26) + ord('a'))/sge" >"$TEST_ROOT/$NAME"
}
@ -267,7 +267,7 @@ test_expect_success 'filtering large input to small output should use little mem
'
test_expect_success 'filter that does not read is fine' '
test-genrandom foo $((128 * 1024 + 1)) >big &&
test-tool genrandom foo $((128 * 1024 + 1)) >big &&
echo "big filter=epipe" >.gitattributes &&
test_config filter.epipe.clean "echo xyzzy" &&
git add big &&

View File

@ -8,15 +8,15 @@ test_description='Test various path utilities'
. ./test-lib.sh
norm_path() {
expected=$(test-path-utils print_path "$2")
expected=$(test-tool path-utils print_path "$2")
test_expect_success $3 "normalize path: $1 => $2" \
"test \"\$(test-path-utils normalize_path_copy '$1')\" = '$expected'"
"test \"\$(test-tool path-utils normalize_path_copy '$1')\" = '$expected'"
}
relative_path() {
expected=$(test-path-utils print_path "$3")
expected=$(test-tool path-utils print_path "$3")
test_expect_success $4 "relative path: $1 $2 => $3" \
"test \"\$(test-path-utils relative_path '$1' '$2')\" = '$expected'"
"test \"\$(test-tool path-utils relative_path '$1' '$2')\" = '$expected'"
}
test_submodule_relative_url() {
@ -37,7 +37,7 @@ test_git_path() {
# On Windows, we are using MSYS's bash, which mangles the paths.
# Absolute paths are anchored at the MSYS installation directory,
# which means that the path / accounts for this many characters:
rootoff=$(test-path-utils normalize_path_copy / | wc -c)
rootoff=$(test-tool path-utils normalize_path_copy / | wc -c)
# Account for the trailing LF:
if test $rootoff = 2; then
rootoff= # we are on Unix
@ -46,7 +46,7 @@ else
# In MSYS2, the root directory "/" is translated into a Windows
# directory *with* trailing slash. Let's test for that and adjust
# our expected longest ancestor length accordingly.
case "$(test-path-utils print_path /)" in
case "$(test-tool path-utils print_path /)" in
*/) rootslash=1;;
*) rootslash=0;;
esac
@ -61,7 +61,7 @@ ancestor() {
expected=$(($expected+$rootoff))
fi
test_expect_success "longest ancestor: $1 $2 => $expected" \
"actual=\$(test-path-utils longest_ancestor_length '$1' '$2') &&
"actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
test \"\$actual\" = '$expected'"
}
@ -77,8 +77,8 @@ case $(uname -s) in
;;
esac
test_expect_success basename 'test-path-utils basename'
test_expect_success dirname 'test-path-utils dirname'
test_expect_success basename 'test-tool path-utils basename'
test_expect_success dirname 'test-tool path-utils dirname'
norm_path "" ""
norm_path . ""
@ -157,48 +157,48 @@ ancestor /foo/bar /foo:/bar 4
ancestor /foo/bar /bar -1
test_expect_success 'strip_path_suffix' '
test c:/msysgit = $(test-path-utils strip_path_suffix \
test c:/msysgit = $(test-tool path-utils strip_path_suffix \
c:/msysgit/libexec//git-core libexec/git-core)
'
test_expect_success 'absolute path rejects the empty string' '
test_must_fail test-path-utils absolute_path ""
test_must_fail test-tool path-utils absolute_path ""
'
test_expect_success 'real path rejects the empty string' '
test_must_fail test-path-utils real_path ""
test_must_fail test-tool path-utils real_path ""
'
test_expect_success POSIX 'real path works on absolute paths 1' '
nopath="hopefully-absent-path" &&
test "/" = "$(test-path-utils real_path "/")" &&
test "/$nopath" = "$(test-path-utils real_path "/$nopath")"
test "/" = "$(test-tool path-utils real_path "/")" &&
test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
'
test_expect_success 'real path works on absolute paths 2' '
nopath="hopefully-absent-path" &&
# Find an existing top-level directory for the remaining tests:
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
test "$d" = "$(test-path-utils real_path "$d")" &&
test "$d/$nopath" = "$(test-path-utils real_path "$d/$nopath")"
test "$d" = "$(test-tool path-utils real_path "$d")" &&
test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
'
test_expect_success POSIX 'real path removes extra leading slashes' '
nopath="hopefully-absent-path" &&
test "/" = "$(test-path-utils real_path "///")" &&
test "/$nopath" = "$(test-path-utils real_path "///$nopath")" &&
test "/" = "$(test-tool path-utils real_path "///")" &&
test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
# Find an existing top-level directory for the remaining tests:
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
test "$d" = "$(test-path-utils real_path "//$d")" &&
test "$d/$nopath" = "$(test-path-utils real_path "//$d/$nopath")"
test "$d" = "$(test-tool path-utils real_path "//$d")" &&
test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
'
test_expect_success 'real path removes other extra slashes' '
nopath="hopefully-absent-path" &&
# Find an existing top-level directory for the remaining tests:
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
test "$d" = "$(test-path-utils real_path "$d///")" &&
test "$d/$nopath" = "$(test-path-utils real_path "$d///$nopath")"
test "$d" = "$(test-tool path-utils real_path "$d///")" &&
test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
'
test_expect_success SYMLINKS 'real path works on symlinks' '
@ -209,35 +209,35 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
mkdir third &&
dir="$(cd .git; pwd -P)" &&
dir2=third/../second/other/.git &&
test "$dir" = "$(test-path-utils real_path $dir2)" &&
test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
file="$dir"/index &&
test "$file" = "$(test-path-utils real_path $dir2/index)" &&
test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
basename=blub &&
test "$dir/$basename" = "$(cd .git && test-path-utils real_path "$basename")" &&
test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
ln -s ../first/file .git/syml &&
sym="$(cd first; pwd -P)"/file &&
test "$sym" = "$(test-path-utils real_path "$dir2/syml")"
test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
'
test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
ln -s target symlink &&
test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
'
test_expect_success 'prefix_path works with only absolute path to work tree' '
echo "" >expected &&
test-path-utils prefix_path prefix "$(pwd)" >actual &&
test-tool path-utils prefix_path prefix "$(pwd)" >actual &&
test_cmp expected actual
'
test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' '
test_must_fail test-path-utils prefix_path prefix "$(pwd)a"
test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a"
'
test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having same beginning as work tree' '
git init repo &&
ln -s repo repolink &&
test "a" = "$(cd repo && test-path-utils prefix_path prefix "$(pwd)/../repolink/a")"
test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
'
relative_path /foo/a/b/c/ /foo/a/b/ c/

View File

@ -14,13 +14,13 @@ EOF
>empty
test_expect_success 'start_command reports ENOENT' '
test-run-command start-command-ENOENT ./does-not-exist
test-tool run-command start-command-ENOENT ./does-not-exist
'
test_expect_success 'run_command can run a command' '
cat hello-script >hello.sh &&
chmod +x hello.sh &&
test-run-command run-command ./hello.sh >actual 2>err &&
test-tool run-command run-command ./hello.sh >actual 2>err &&
test_cmp hello-script actual &&
test_cmp empty err
@ -31,7 +31,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
cat hello-script
EOF
chmod +x hello &&
test-run-command run-command ./hello >actual 2>err &&
test-tool run-command run-command ./hello >actual 2>err &&
test_cmp hello-script actual &&
test_cmp empty err
@ -45,7 +45,7 @@ test_expect_success 'run_command does not try to execute a directory' '
EOF
PATH=$PWD/bin1:$PWD/bin2:$PATH \
test-run-command run-command greet >actual 2>err &&
test-tool run-command run-command greet >actual 2>err &&
test_cmp bin2/greet actual &&
test_cmp empty err
'
@ -62,7 +62,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
EOF
PATH=$PWD/bin1:$PWD/bin2:$PATH \
test-run-command run-command greet >actual 2>err &&
test-tool run-command run-command greet >actual 2>err &&
test_cmp bin2/greet actual &&
test_cmp empty err
'
@ -70,7 +70,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
test_expect_success POSIXPERM 'run_command reports EACCES' '
cat hello-script >hello.sh &&
chmod -x hello.sh &&
test_must_fail test-run-command run-command ./hello.sh 2>err &&
test_must_fail test-tool run-command run-command ./hello.sh 2>err &&
grep "fatal: cannot exec.*hello.sh" err
'
@ -104,17 +104,17 @@ World
EOF
test_expect_success 'run_command runs in parallel with more jobs available than tasks' '
test-run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test_cmp expect actual
'
test_expect_success 'run_command runs in parallel with as many jobs as tasks' '
test-run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test_cmp expect actual
'
test_expect_success 'run_command runs in parallel with more tasks than jobs available' '
test-run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test_cmp expect actual
'
@ -128,7 +128,7 @@ asking for a quick stop
EOF
test_expect_success 'run_command is asked to abort gracefully' '
test-run-command run-command-abort 3 false 2>actual &&
test-tool run-command run-command-abort 3 false 2>actual &&
test_cmp expect actual
'
@ -137,14 +137,14 @@ no further jobs available
EOF
test_expect_success 'run_command outputs ' '
test-run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
test_cmp expect actual
'
test_trace () {
expect="$1"
shift
GIT_TRACE=1 test-run-command "$@" run-command true 2>&1 >/dev/null | \
GIT_TRACE=1 test-tool run-command "$@" run-command true 2>&1 >/dev/null | \
sed 's/.* run_command: //' >actual &&
echo "$expect true" >expect &&
test_cmp expect actual

View File

@ -26,7 +26,7 @@ test_expect_success 'setup' '
'
test_expect_success 'revision walking can be done twice' '
test-revision-walking run-twice >run_twice_actual &&
test-tool revision-walking run-twice >run_twice_actual &&
test_cmp run_twice_expected run_twice_actual
'

View File

@ -10,9 +10,9 @@ test_description='Test string list functionality'
test_split () {
cat >expected &&
test_expect_success "split $1 at $2, max $3" "
test-string-list split '$1' '$2' '$3' >actual &&
test-tool string-list split '$1' '$2' '$3' >actual &&
test_cmp expected actual &&
test-string-list split_in_place '$1' '$2' '$3' >actual &&
test-tool string-list split_in_place '$1' '$2' '$3' >actual &&
test_cmp expected actual
"
}
@ -61,31 +61,31 @@ test_split ":" ":" "-1" <<EOF
EOF
test_expect_success "test filter_string_list" '
test "x-" = "x$(test-string-list filter - y)" &&
test "x-" = "x$(test-string-list filter no y)" &&
test yes = "$(test-string-list filter yes y)" &&
test yes = "$(test-string-list filter no:yes y)" &&
test yes = "$(test-string-list filter yes:no y)" &&
test y1:y2 = "$(test-string-list filter y1:y2 y)" &&
test y2:y1 = "$(test-string-list filter y2:y1 y)" &&
test "x-" = "x$(test-string-list filter x1:x2 y)"
test "x-" = "x$(test-tool string-list filter - y)" &&
test "x-" = "x$(test-tool string-list filter no y)" &&
test yes = "$(test-tool string-list filter yes y)" &&
test yes = "$(test-tool string-list filter no:yes y)" &&
test yes = "$(test-tool string-list filter yes:no y)" &&
test y1:y2 = "$(test-tool string-list filter y1:y2 y)" &&
test y2:y1 = "$(test-tool string-list filter y2:y1 y)" &&
test "x-" = "x$(test-tool string-list filter x1:x2 y)"
'
test_expect_success "test remove_duplicates" '
test "x-" = "x$(test-string-list remove_duplicates -)" &&
test "x" = "x$(test-string-list remove_duplicates "")" &&
test a = "$(test-string-list remove_duplicates a)" &&
test a = "$(test-string-list remove_duplicates a:a)" &&
test a = "$(test-string-list remove_duplicates a:a:a:a:a)" &&
test a:b = "$(test-string-list remove_duplicates a:b)" &&
test a:b = "$(test-string-list remove_duplicates a:a:b)" &&
test a:b = "$(test-string-list remove_duplicates a:b:b)" &&
test a:b:c = "$(test-string-list remove_duplicates a:b:c)" &&
test a:b:c = "$(test-string-list remove_duplicates a:a:b:c)" &&
test a:b:c = "$(test-string-list remove_duplicates a:b:b:c)" &&
test a:b:c = "$(test-string-list remove_duplicates a:b:c:c)" &&
test a:b:c = "$(test-string-list remove_duplicates a:a:b:b:c:c)" &&
test a:b:c = "$(test-string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
test "x-" = "x$(test-tool string-list remove_duplicates -)" &&
test "x" = "x$(test-tool string-list remove_duplicates "")" &&
test a = "$(test-tool string-list remove_duplicates a)" &&
test a = "$(test-tool string-list remove_duplicates a:a)" &&
test a = "$(test-tool string-list remove_duplicates a:a:a:a:a)" &&
test a:b = "$(test-tool string-list remove_duplicates a:b)" &&
test a:b = "$(test-tool string-list remove_duplicates a:a:b)" &&
test a:b = "$(test-tool string-list remove_duplicates a:b:b)" &&
test a:b:c = "$(test-tool string-list remove_duplicates a:b:c)" &&
test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:c)" &&
test a:b:c = "$(test-tool string-list remove_duplicates a:b:b:c)" &&
test a:b:c = "$(test-tool string-list remove_duplicates a:b:c:c)" &&
test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:b:c:c)" &&
test a:b:c = "$(test-tool string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
'
test_done

View File

@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
{
echo20 append 88 44 aa 55 &&
echo for_each_unique
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
test_cmp expect actual
'
@ -28,7 +28,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
echo20 append 88 44 aa 55 &&
echo20 append 88 44 aa 55 &&
echo for_each_unique
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
test_cmp expect actual
'
@ -36,7 +36,7 @@ test_expect_success 'lookup' '
{
echo20 append 88 44 aa 55 &&
echo20 lookup 55
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -eq 1
'
@ -45,7 +45,7 @@ test_expect_success 'lookup non-existing entry' '
{
echo20 append 88 44 aa 55 &&
echo20 lookup 33
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -lt 0
'
@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
echo20 append 88 44 aa 55 &&
echo20 append 88 44 aa 55 &&
echo20 lookup 55
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -ge 2 &&
test "$n" -le 3
@ -66,7 +66,7 @@ test_expect_success 'lookup non-existing entry with duplicates' '
echo20 append 88 44 aa 55 &&
echo20 append 88 44 aa 55 &&
echo20 lookup 66
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -lt 0
'
@ -76,7 +76,7 @@ test_expect_success 'lookup with almost duplicate values' '
echo "append 5555555555555555555555555555555555555555" &&
echo "append 555555555555555555555555555555555555555f" &&
echo20 lookup 55
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -eq 0
'
@ -85,7 +85,7 @@ test_expect_success 'lookup with single duplicate value' '
{
echo20 append 55 55 &&
echo20 lookup 55
} | test-sha1-array >actual &&
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -ge 0 &&
test "$n" -le 1

View File

@ -8,7 +8,7 @@ while read s1 s2 expect
do
test_expect_success "strcmp_offset($s1, $s2)" '
echo "$expect" >expect &&
test-strcmp-offset "$s1" "$s2" >actual &&
test-tool strcmp-offset "$s1" "$s2" >actual &&
test_cmp expect actual
'
done <<-EOF

View File

@ -9,11 +9,11 @@ Verify wrappers and compatibility functions.
. ./test-lib.sh
test_expect_success 'character classes (isspace, isalpha etc.)' '
test-ctype
test-tool ctype
'
test_expect_success 'mktemp to nonexistent directory prints filename' '
test_must_fail test-mktemp doesnotexist/testXXXXXX 2>err &&
test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
grep "doesnotexist/test" err
'
@ -21,7 +21,7 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
mkdir cannotwrite &&
chmod -w cannotwrite &&
test_when_finished "chmod +w cannotwrite" &&
test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
grep "cannotwrite/test" err
'
@ -31,7 +31,7 @@ test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
test_expect_success 'check for a bug in the regex routines' '
# if this test fails, re-build git with NO_REGEX=1
test-regex --bug
test-tool regex --bug
'
test_done

View File

@ -8,13 +8,13 @@ cache-tree extension.
. ./test-lib.sh
cmp_cache_tree () {
test-dump-cache-tree | sed -e '/#(ref)/d' >actual &&
test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
sed "s/$_x40/SHA/" <actual >filtered &&
test_cmp "$1" filtered
}
# We don't bother with actually checking the SHA1:
# test-dump-cache-tree already verifies that all existing data is
# test-tool dump-cache-tree already verifies that all existing data is
# correct.
generate_expected_cache_tree_rec () {
dir="$1${1:+/}" &&
@ -47,7 +47,7 @@ test_cache_tree () {
test_invalid_cache_tree () {
printf "invalid %s ()\n" "" "$@" >expect &&
test-dump-cache-tree |
test-tool dump-cache-tree |
sed -n -e "s/[0-9]* subtrees//" -e '/#(ref)/d' -e '/^invalid /p' >actual &&
test_cmp expect actual
}
@ -115,14 +115,14 @@ test_expect_success 'update-index invalidates cache-tree' '
'
test_expect_success 'write-tree establishes cache-tree' '
test-scrap-cache-tree &&
test-tool scrap-cache-tree &&
git write-tree &&
test_cache_tree
'
test_expect_success 'test-scrap-cache-tree works' '
test_expect_success 'test-tool scrap-cache-tree works' '
git read-tree HEAD &&
test-scrap-cache-tree &&
test-tool scrap-cache-tree &&
test_no_cache_tree
'
@ -170,7 +170,7 @@ test_expect_success 'commit in child dir has cache-tree' '
'
test_expect_success 'reset --hard gives cache-tree' '
test-scrap-cache-tree &&
test-tool scrap-cache-tree &&
git reset --hard &&
test_cache_tree
'
@ -246,9 +246,9 @@ test_expect_success 'switching trees does not invalidate shared index' '
git update-index --split-index &&
>split &&
git add split &&
test-dump-split-index .git/index | grep -v ^own >before &&
test-tool dump-split-index .git/index | grep -v ^own >before &&
git commit -m "as-is" &&
test-dump-split-index .git/index | grep -v ^own >after &&
test-tool dump-split-index .git/index | grep -v ^own >after &&
test_cmp before after
'

View File

@ -9,172 +9,172 @@ tu="$TEST_DIRECTORY/t0110/url"
# Note that only file: URLs should be allowed without a host
test_expect_success 'url scheme' '
! test-urlmatch-normalization "" &&
! test-urlmatch-normalization "_" &&
! test-urlmatch-normalization "scheme" &&
! test-urlmatch-normalization "scheme:" &&
! test-urlmatch-normalization "scheme:/" &&
! test-urlmatch-normalization "scheme://" &&
! test-urlmatch-normalization "file" &&
! test-urlmatch-normalization "file:" &&
! test-urlmatch-normalization "file:/" &&
test-urlmatch-normalization "file://" &&
! test-urlmatch-normalization "://acme.co" &&
! test-urlmatch-normalization "x_test://acme.co" &&
! test-urlmatch-normalization "-test://acme.co" &&
! test-urlmatch-normalization "0test://acme.co" &&
! test-urlmatch-normalization "+test://acme.co" &&
! test-urlmatch-normalization ".test://acme.co" &&
! test-urlmatch-normalization "schem%6e://" &&
test-urlmatch-normalization "x-Test+v1.0://acme.co" &&
test "$(test-urlmatch-normalization -p "AbCdeF://x.Y")" = "abcdef://x.y/"
! test-tool urlmatch-normalization "" &&
! test-tool urlmatch-normalization "_" &&
! test-tool urlmatch-normalization "scheme" &&
! test-tool urlmatch-normalization "scheme:" &&
! test-tool urlmatch-normalization "scheme:/" &&
! test-tool urlmatch-normalization "scheme://" &&
! test-tool urlmatch-normalization "file" &&
! test-tool urlmatch-normalization "file:" &&
! test-tool urlmatch-normalization "file:/" &&
test-tool urlmatch-normalization "file://" &&
! test-tool urlmatch-normalization "://acme.co" &&
! test-tool urlmatch-normalization "x_test://acme.co" &&
! test-tool urlmatch-normalization "-test://acme.co" &&
! test-tool urlmatch-normalization "0test://acme.co" &&
! test-tool urlmatch-normalization "+test://acme.co" &&
! test-tool urlmatch-normalization ".test://acme.co" &&
! test-tool urlmatch-normalization "schem%6e://" &&
test-tool urlmatch-normalization "x-Test+v1.0://acme.co" &&
test "$(test-tool urlmatch-normalization -p "AbCdeF://x.Y")" = "abcdef://x.y/"
'
test_expect_success 'url authority' '
! test-urlmatch-normalization "scheme://user:pass@" &&
! test-urlmatch-normalization "scheme://?" &&
! test-urlmatch-normalization "scheme://#" &&
! test-urlmatch-normalization "scheme:///" &&
! test-urlmatch-normalization "scheme://:" &&
! test-urlmatch-normalization "scheme://:555" &&
test-urlmatch-normalization "file://user:pass@" &&
test-urlmatch-normalization "file://?" &&
test-urlmatch-normalization "file://#" &&
test-urlmatch-normalization "file:///" &&
test-urlmatch-normalization "file://:" &&
! test-urlmatch-normalization "file://:555" &&
test-urlmatch-normalization "scheme://user:pass@host" &&
test-urlmatch-normalization "scheme://@host" &&
test-urlmatch-normalization "scheme://%00@host" &&
! test-urlmatch-normalization "scheme://%%@host" &&
! test-urlmatch-normalization "scheme://host_" &&
test-urlmatch-normalization "scheme://user:pass@host/" &&
test-urlmatch-normalization "scheme://@host/" &&
test-urlmatch-normalization "scheme://host/" &&
test-urlmatch-normalization "scheme://host?x" &&
test-urlmatch-normalization "scheme://host#x" &&
test-urlmatch-normalization "scheme://host/@" &&
test-urlmatch-normalization "scheme://host?@x" &&
test-urlmatch-normalization "scheme://host#@x" &&
test-urlmatch-normalization "scheme://[::1]" &&
test-urlmatch-normalization "scheme://[::1]/" &&
! test-urlmatch-normalization "scheme://hos%41/" &&
test-urlmatch-normalization "scheme://[invalid....:/" &&
test-urlmatch-normalization "scheme://invalid....:]/" &&
! test-urlmatch-normalization "scheme://invalid....:[/" &&
! test-urlmatch-normalization "scheme://invalid....:["
! test-tool urlmatch-normalization "scheme://user:pass@" &&
! test-tool urlmatch-normalization "scheme://?" &&
! test-tool urlmatch-normalization "scheme://#" &&
! test-tool urlmatch-normalization "scheme:///" &&
! test-tool urlmatch-normalization "scheme://:" &&
! test-tool urlmatch-normalization "scheme://:555" &&
test-tool urlmatch-normalization "file://user:pass@" &&
test-tool urlmatch-normalization "file://?" &&
test-tool urlmatch-normalization "file://#" &&
test-tool urlmatch-normalization "file:///" &&
test-tool urlmatch-normalization "file://:" &&
! test-tool urlmatch-normalization "file://:555" &&
test-tool urlmatch-normalization "scheme://user:pass@host" &&
test-tool urlmatch-normalization "scheme://@host" &&
test-tool urlmatch-normalization "scheme://%00@host" &&
! test-tool urlmatch-normalization "scheme://%%@host" &&
! test-tool urlmatch-normalization "scheme://host_" &&
test-tool urlmatch-normalization "scheme://user:pass@host/" &&
test-tool urlmatch-normalization "scheme://@host/" &&
test-tool urlmatch-normalization "scheme://host/" &&
test-tool urlmatch-normalization "scheme://host?x" &&
test-tool urlmatch-normalization "scheme://host#x" &&
test-tool urlmatch-normalization "scheme://host/@" &&
test-tool urlmatch-normalization "scheme://host?@x" &&
test-tool urlmatch-normalization "scheme://host#@x" &&
test-tool urlmatch-normalization "scheme://[::1]" &&
test-tool urlmatch-normalization "scheme://[::1]/" &&
! test-tool urlmatch-normalization "scheme://hos%41/" &&
test-tool urlmatch-normalization "scheme://[invalid....:/" &&
test-tool urlmatch-normalization "scheme://invalid....:]/" &&
! test-tool urlmatch-normalization "scheme://invalid....:[/" &&
! test-tool urlmatch-normalization "scheme://invalid....:["
'
test_expect_success 'url port checks' '
test-urlmatch-normalization "xyz://q@some.host:" &&
test-urlmatch-normalization "xyz://q@some.host:456/" &&
! test-urlmatch-normalization "xyz://q@some.host:0" &&
! test-urlmatch-normalization "xyz://q@some.host:0000000" &&
test-urlmatch-normalization "xyz://q@some.host:0000001?" &&
test-urlmatch-normalization "xyz://q@some.host:065535#" &&
test-urlmatch-normalization "xyz://q@some.host:65535" &&
! test-urlmatch-normalization "xyz://q@some.host:65536" &&
! test-urlmatch-normalization "xyz://q@some.host:99999" &&
! test-urlmatch-normalization "xyz://q@some.host:100000" &&
! test-urlmatch-normalization "xyz://q@some.host:100001" &&
test-urlmatch-normalization "http://q@some.host:80" &&
test-urlmatch-normalization "https://q@some.host:443" &&
test-urlmatch-normalization "http://q@some.host:80/" &&
test-urlmatch-normalization "https://q@some.host:443?" &&
! test-urlmatch-normalization "http://q@:8008" &&
! test-urlmatch-normalization "http://:8080" &&
! test-urlmatch-normalization "http://:" &&
test-urlmatch-normalization "xyz://q@some.host:456/" &&
test-urlmatch-normalization "xyz://[::1]:456/" &&
test-urlmatch-normalization "xyz://[::1]:/" &&
! test-urlmatch-normalization "xyz://[::1]:000/" &&
! test-urlmatch-normalization "xyz://[::1]:0%300/" &&
! test-urlmatch-normalization "xyz://[::1]:0x80/" &&
! test-urlmatch-normalization "xyz://[::1]:4294967297/" &&
! test-urlmatch-normalization "xyz://[::1]:030f/"
test-tool urlmatch-normalization "xyz://q@some.host:" &&
test-tool urlmatch-normalization "xyz://q@some.host:456/" &&
! test-tool urlmatch-normalization "xyz://q@some.host:0" &&
! test-tool urlmatch-normalization "xyz://q@some.host:0000000" &&
test-tool urlmatch-normalization "xyz://q@some.host:0000001?" &&
test-tool urlmatch-normalization "xyz://q@some.host:065535#" &&
test-tool urlmatch-normalization "xyz://q@some.host:65535" &&
! test-tool urlmatch-normalization "xyz://q@some.host:65536" &&
! test-tool urlmatch-normalization "xyz://q@some.host:99999" &&
! test-tool urlmatch-normalization "xyz://q@some.host:100000" &&
! test-tool urlmatch-normalization "xyz://q@some.host:100001" &&
test-tool urlmatch-normalization "http://q@some.host:80" &&
test-tool urlmatch-normalization "https://q@some.host:443" &&
test-tool urlmatch-normalization "http://q@some.host:80/" &&
test-tool urlmatch-normalization "https://q@some.host:443?" &&
! test-tool urlmatch-normalization "http://q@:8008" &&
! test-tool urlmatch-normalization "http://:8080" &&
! test-tool urlmatch-normalization "http://:" &&
test-tool urlmatch-normalization "xyz://q@some.host:456/" &&
test-tool urlmatch-normalization "xyz://[::1]:456/" &&
test-tool urlmatch-normalization "xyz://[::1]:/" &&
! test-tool urlmatch-normalization "xyz://[::1]:000/" &&
! test-tool urlmatch-normalization "xyz://[::1]:0%300/" &&
! test-tool urlmatch-normalization "xyz://[::1]:0x80/" &&
! test-tool urlmatch-normalization "xyz://[::1]:4294967297/" &&
! test-tool urlmatch-normalization "xyz://[::1]:030f/"
'
test_expect_success 'url port normalization' '
test "$(test-urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
test "$(test-urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
test "$(test-urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
test "$(test-urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
test "$(test-urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
test "$(test-urlmatch-normalization -p "http://x:80")" = "http://x/" &&
test "$(test-urlmatch-normalization -p "http://x:080")" = "http://x/" &&
test "$(test-urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
test "$(test-urlmatch-normalization -p "https://x:443")" = "https://x/" &&
test "$(test-urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
test "$(test-urlmatch-normalization -p "https://x:000000443")" = "https://x/"
test "$(test-tool urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
test "$(test-tool urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
test "$(test-tool urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
test "$(test-tool urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
test "$(test-tool urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
test "$(test-tool urlmatch-normalization -p "http://x:80")" = "http://x/" &&
test "$(test-tool urlmatch-normalization -p "http://x:080")" = "http://x/" &&
test "$(test-tool urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
test "$(test-tool urlmatch-normalization -p "https://x:443")" = "https://x/" &&
test "$(test-tool urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
test "$(test-tool urlmatch-normalization -p "https://x:000000443")" = "https://x/"
'
test_expect_success 'url general escapes' '
! test-urlmatch-normalization "http://x.y?%fg" &&
test "$(test-urlmatch-normalization -p "X://W/%7e%41^%3a")" = "x://w/~A%5E%3A" &&
test "$(test-urlmatch-normalization -p "X://W/:/?#[]@")" = "x://w/:/?#[]@" &&
test "$(test-urlmatch-normalization -p "X://W/$&()*+,;=")" = "x://w/$&()*+,;=" &&
test "$(test-urlmatch-normalization -p "X://W/'\''")" = "x://w/'\''" &&
test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
! test-tool urlmatch-normalization "http://x.y?%fg" &&
test "$(test-tool urlmatch-normalization -p "X://W/%7e%41^%3a")" = "x://w/~A%5E%3A" &&
test "$(test-tool urlmatch-normalization -p "X://W/:/?#[]@")" = "x://w/:/?#[]@" &&
test "$(test-tool urlmatch-normalization -p "X://W/$&()*+,;=")" = "x://w/$&()*+,;=" &&
test "$(test-tool urlmatch-normalization -p "X://W/'\''")" = "x://w/'\''" &&
test "$(test-tool urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
'
test_expect_success !MINGW 'url high-bit escapes' '
test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-4")")" = "x://q/%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-5")")" = "x://q/%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-6")")" = "x://q/%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-4")")" = "x://q/%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-5")")" = "x://q/%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-6")")" = "x://q/%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
'
test_expect_success 'url utf-8 escapes' '
test "$(test-urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
test "$(test-tool urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
'
test_expect_success 'url username/password escapes' '
test "$(test-urlmatch-normalization -p "x://%41%62(^):%70+d@foo")" = "x://Ab(%5E):p+d@foo/"
test "$(test-tool urlmatch-normalization -p "x://%41%62(^):%70+d@foo")" = "x://Ab(%5E):p+d@foo/"
'
test_expect_success 'url normalized lengths' '
test "$(test-urlmatch-normalization -l "Http://%4d%65:%4d^%70@The.Host")" = 25 &&
test "$(test-urlmatch-normalization -l "http://%41:%42@x.y/%61/")" = 17 &&
test "$(test-urlmatch-normalization -l "http://@x.y/^")" = 15
test "$(test-tool urlmatch-normalization -l "Http://%4d%65:%4d^%70@The.Host")" = 25 &&
test "$(test-tool urlmatch-normalization -l "http://%41:%42@x.y/%61/")" = 17 &&
test "$(test-tool urlmatch-normalization -l "http://@x.y/^")" = 15
'
test_expect_success 'url . and .. segments' '
test "$(test-urlmatch-normalization -p "x://y/.")" = "x://y/" &&
test "$(test-urlmatch-normalization -p "x://y/./")" = "x://y/" &&
test "$(test-urlmatch-normalization -p "x://y/a/.")" = "x://y/a" &&
test "$(test-urlmatch-normalization -p "x://y/a/./")" = "x://y/a/" &&
test "$(test-urlmatch-normalization -p "x://y/.?")" = "x://y/?" &&
test "$(test-urlmatch-normalization -p "x://y/./?")" = "x://y/?" &&
test "$(test-urlmatch-normalization -p "x://y/a/.?")" = "x://y/a?" &&
test "$(test-urlmatch-normalization -p "x://y/a/./?")" = "x://y/a/?" &&
test "$(test-urlmatch-normalization -p "x://y/a/./b/.././../c")" = "x://y/c" &&
test "$(test-urlmatch-normalization -p "x://y/a/./b/../.././c/")" = "x://y/c/" &&
test "$(test-urlmatch-normalization -p "x://y/a/./b/.././../c/././.././.")" = "x://y/" &&
! test-urlmatch-normalization "x://y/a/./b/.././../c/././.././.." &&
test "$(test-urlmatch-normalization -p "x://y/a/./?/././..")" = "x://y/a/?/././.." &&
test "$(test-urlmatch-normalization -p "x://y/%2e/")" = "x://y/" &&
test "$(test-urlmatch-normalization -p "x://y/%2E/")" = "x://y/" &&
test "$(test-urlmatch-normalization -p "x://y/a/%2e./")" = "x://y/" &&
test "$(test-urlmatch-normalization -p "x://y/b/.%2E/")" = "x://y/" &&
test "$(test-urlmatch-normalization -p "x://y/c/%2e%2E/")" = "x://y/"
test "$(test-tool urlmatch-normalization -p "x://y/.")" = "x://y/" &&
test "$(test-tool urlmatch-normalization -p "x://y/./")" = "x://y/" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/.")" = "x://y/a" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/./")" = "x://y/a/" &&
test "$(test-tool urlmatch-normalization -p "x://y/.?")" = "x://y/?" &&
test "$(test-tool urlmatch-normalization -p "x://y/./?")" = "x://y/?" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/.?")" = "x://y/a?" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/./?")" = "x://y/a/?" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/./b/.././../c")" = "x://y/c" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/./b/../.././c/")" = "x://y/c/" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/./b/.././../c/././.././.")" = "x://y/" &&
! test-tool urlmatch-normalization "x://y/a/./b/.././../c/././.././.." &&
test "$(test-tool urlmatch-normalization -p "x://y/a/./?/././..")" = "x://y/a/?/././.." &&
test "$(test-tool urlmatch-normalization -p "x://y/%2e/")" = "x://y/" &&
test "$(test-tool urlmatch-normalization -p "x://y/%2E/")" = "x://y/" &&
test "$(test-tool urlmatch-normalization -p "x://y/a/%2e./")" = "x://y/" &&
test "$(test-tool urlmatch-normalization -p "x://y/b/.%2E/")" = "x://y/" &&
test "$(test-tool urlmatch-normalization -p "x://y/c/%2e%2E/")" = "x://y/"
'
# http://@foo specifies an empty user name but does not specify a password
# http://foo specifies neither a user name nor a password
# So they should not be equivalent
test_expect_success 'url equivalents' '
test-urlmatch-normalization "httP://x" "Http://X/" &&
test-urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
! test-urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&
test-urlmatch-normalization "https://@x.y/^" "httpS://@x.y:0443/^" &&
test-urlmatch-normalization "https://@x.y/^/../abc" "httpS://@x.y:0443/abc" &&
test-urlmatch-normalization "https://@x.y/^/.." "httpS://@x.y:0443/"
test-tool urlmatch-normalization "httP://x" "Http://X/" &&
test-tool urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
! test-tool urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&
test-tool urlmatch-normalization "https://@x.y/^" "httpS://@x.y:0443/^" &&
test-tool urlmatch-normalization "https://@x.y/^/../abc" "httpS://@x.y:0443/abc" &&
test-tool urlmatch-normalization "https://@x.y/^/.." "httpS://@x.y:0443/"
'
test_done

View File

@ -282,7 +282,7 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" '
'
test_expect_success 'setup blobs which are likely to delta' '
test-genrandom foo 10240 >foo &&
test-tool genrandom foo 10240 >foo &&
{ cat foo; echo plus; } >foo-plus &&
git add foo foo-plus &&
git commit -m foo &&

View File

@ -103,9 +103,9 @@ test_expect_success 'packsize limit' '
# mid1 and mid2 will fit within 256k limit but
# appending mid3 will bust the limit and will
# result in a separate packfile.
test-genrandom "a" $(( 66 * 1024 )) >mid1 &&
test-genrandom "b" $(( 80 * 1024 )) >mid2 &&
test-genrandom "c" $(( 128 * 1024 )) >mid3 &&
test-tool genrandom "a" $(( 66 * 1024 )) >mid1 &&
test-tool genrandom "b" $(( 80 * 1024 )) >mid2 &&
test-tool genrandom "c" $(( 128 * 1024 )) >mid3 &&
git add mid1 mid2 mid3 &&
count=0

View File

@ -914,7 +914,7 @@ test_expect_success 'get --expiry-date' '
invalid1 = "abc"
EOF
cat >expect <<-EOF &&
$(test-date timestamp $rel)
$(test-tool date timestamp $rel)
1275666415
1510441871
1510348087

View File

@ -224,7 +224,7 @@ test_expect_success 'conditional include, early config reading' '
echo "[includeIf \"gitdir:foo/\"]path=bar6" >>.git/config &&
echo "[test]six=6" >.git/bar6 &&
echo 6 >expect &&
test-config read_early_config test.six >actual &&
test-tool config read_early_config test.six >actual &&
test_cmp expect actual
)
'

View File

@ -18,7 +18,7 @@ check_config () {
then
printf "%s\n" "$@"
fi >expect &&
test_expect_code $expect_code test-config "$op" "$key" >actual &&
test_expect_code $expect_code test-tool config "$op" "$key" >actual &&
test_cmp expect actual
}
@ -125,7 +125,7 @@ test_expect_success 'find string value for a key' '
'
test_expect_success 'check line error when NULL string is queried' '
test_expect_code 128 test-config get_string case.foo 2>result &&
test_expect_code 128 test-tool config get_string case.foo 2>result &&
test_i18ngrep "fatal: .*case\.foo.*\.git/config.*line 7" result
'
@ -155,13 +155,13 @@ test_expect_success 'find value from a configset' '
baz = ball
EOF
echo silk >expect &&
test-config configset_get_value my.new config2 .git/config >actual &&
test-tool config configset_get_value my.new config2 .git/config >actual &&
test_cmp expect actual
'
test_expect_success 'find value with highest priority from a configset' '
echo hask >expect &&
test-config configset_get_value case.baz config2 .git/config >actual &&
test-tool config configset_get_value case.baz config2 .git/config >actual &&
test_cmp expect actual
'
@ -173,20 +173,20 @@ test_expect_success 'find value_list for a key from a configset' '
lama
ball
EOF
test-config configset_get_value case.baz config2 .git/config >actual &&
test-tool config configset_get_value case.baz config2 .git/config >actual &&
test_cmp expect actual
'
test_expect_success 'proper error on non-existent files' '
echo "Error (-1) reading configuration file non-existent-file." >expect &&
test_expect_code 2 test-config configset_get_value foo.bar non-existent-file 2>actual &&
test_expect_code 2 test-tool config configset_get_value foo.bar non-existent-file 2>actual &&
test_cmp expect actual
'
test_expect_success 'proper error on directory "files"' '
echo "Error (-1) reading configuration file a-directory." >expect &&
mkdir a-directory &&
test_expect_code 2 test-config configset_get_value foo.bar a-directory 2>output &&
test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
grep "^warning:" output &&
grep "^Error" output >actual &&
test_cmp expect actual
@ -196,7 +196,7 @@ test_expect_success POSIXPERM,SANITY 'proper error on non-accessible files' '
chmod -r .git/config &&
test_when_finished "chmod +r .git/config" &&
echo "Error (-1) reading configuration file .git/config." >expect &&
test_expect_code 2 test-config configset_get_value foo.bar .git/config 2>output &&
test_expect_code 2 test-tool config configset_get_value foo.bar .git/config 2>output &&
grep "^warning:" output &&
grep "^Error" output >actual &&
test_cmp expect actual
@ -207,14 +207,14 @@ test_expect_success 'proper error on error in default config files' '
test_when_finished "mv .git/config.old .git/config" &&
echo "[" >>.git/config &&
echo "fatal: bad config line 34 in file .git/config" >expect &&
test_expect_code 128 test-config get_value foo.bar 2>actual &&
test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
test_i18ncmp expect actual
'
test_expect_success 'proper error on error in custom config files' '
echo "[" >>syntax-error &&
echo "fatal: bad config line 1 in file syntax-error" >expect &&
test_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&
test_expect_code 128 test-tool config configset_get_value foo.bar syntax-error 2>actual &&
test_i18ncmp expect actual
'
@ -267,7 +267,7 @@ test_expect_success 'iteration shows correct origins' '
name=
scope=cmdline
EOF
GIT_CONFIG_PARAMETERS=$cmdline_config test-config iterate >actual &&
GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
test_cmp expect actual
'

View File

@ -6,7 +6,7 @@ test_description='Test read_early_config()'
test_expect_success 'read early config' '
test_config early.config correct &&
test-config read_early_config early.config >output &&
test-tool config read_early_config early.config >output &&
test correct = "$(cat output)"
'
@ -15,7 +15,7 @@ test_expect_success 'in a sub-directory' '
mkdir -p sub &&
(
cd sub &&
test-config read_early_config early.config
test-tool config read_early_config early.config
) >output &&
test sub = "$(cat output)"
'
@ -27,7 +27,7 @@ test_expect_success 'ceiling' '
GIT_CEILING_DIRECTORIES="$PWD" &&
export GIT_CEILING_DIRECTORIES &&
cd sub &&
test-config read_early_config early.config
test-tool config read_early_config early.config
) >output &&
test -z "$(cat output)"
'
@ -42,7 +42,7 @@ test_expect_success 'ceiling #2' '
GIT_CEILING_DIRECTORIES="$PWD" &&
export GIT_CEILING_DIRECTORIES XDG_CONFIG_HOME &&
cd sub &&
test-config read_early_config early.config
test-tool config read_early_config early.config
) >output &&
test xdg = "$(cat output)"
'
@ -54,7 +54,7 @@ test_expect_success 'read config file in right order' '
(
cd foo &&
echo "[test]source = repo" >>.git/config &&
GIT_CONFIG_PARAMETERS=$cmdline_config test-config \
GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config \
read_early_config test.source >actual &&
cat >expected <<-\EOF &&
home
@ -71,7 +71,7 @@ test_with_config () {
(
cd throwaway &&
echo "$*" >.git/config &&
test-config read_early_config early.config
test-tool config read_early_config early.config
)
}

View File

@ -4,7 +4,7 @@ test_description='test main ref store api'
. ./test-lib.sh
RUN="test-ref-store main"
RUN="test-tool ref-store main"
test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
test_commit one &&

View File

@ -4,7 +4,7 @@ test_description='test submodule ref store api'
. ./test-lib.sh
RUN="test-ref-store submodule:sub"
RUN="test-tool ref-store submodule:sub"
test_expect_success 'setup' '
git init sub &&

View File

@ -4,8 +4,8 @@ test_description='test worktree ref store api'
. ./test-lib.sh
RWT="test-ref-store worktree:wt"
RMAIN="test-ref-store worktree:main"
RWT="test-tool ref-store worktree:wt"
RMAIN="test-tool ref-store worktree:main"
test_expect_success 'setup' '
test_commit first &&

View File

@ -341,7 +341,7 @@ test_expect_success 'make_relative_path handles double slashes in GIT_DIR' '
test_expect_success 'relative $GIT_WORK_TREE and git subprocesses' '
GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \
test-subprocess --setup-work-tree rev-parse --show-toplevel >actual &&
test-tool subprocess --setup-work-tree rev-parse --show-toplevel >actual &&
echo "$(pwd)/repo.git/work" >expected &&
test_cmp expected actual
'
@ -360,7 +360,7 @@ test_expect_success 'GIT_DIR set (1)' '
(
cd work &&
GIT_DIR=../gitfile git rev-parse --git-common-dir >actual &&
test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test_cmp expect actual
)
'
@ -371,7 +371,7 @@ test_expect_success 'GIT_DIR set (2)' '
(
cd work &&
GIT_DIR=../gitfile git rev-parse --git-common-dir >actual &&
test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test_cmp expect actual
)
'
@ -382,7 +382,7 @@ test_expect_success 'Auto discovery' '
(
cd work &&
git rev-parse --git-common-dir >actual &&
test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test_cmp expect actual &&
echo haha >data1 &&
git add data1 &&
@ -400,7 +400,7 @@ test_expect_success '$GIT_DIR/common overrides core.worktree' '
(
cd work &&
git rev-parse --git-common-dir >actual &&
test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
test_cmp expect actual &&
echo haha >data2 &&
git add data2 &&

View File

@ -68,7 +68,7 @@ test_expect_success 'GIT_INDEX_VERSION takes precedence over config' '
git config --add index.version 2 &&
git add a 2>&1 &&
echo 4 >expect &&
test-index-version <.git/index >actual &&
test-tool index-version <.git/index >actual &&
test_cmp expect actual
)
'

View File

@ -11,8 +11,8 @@ sane_unset GIT_FSMONITOR_TEST
test_expect_success 'enable split index' '
git config splitIndex.maxPercentChange 100 &&
git update-index --split-index &&
test-dump-split-index .git/index >actual &&
indexversion=$(test-index-version <.git/index) &&
test-tool dump-split-index .git/index >actual &&
indexversion=$(test-tool index-version <.git/index) &&
if test "$indexversion" = "4"
then
own=432ef4b63f32193984f339431fd50ca796493569
@ -39,7 +39,7 @@ test_expect_success 'add one file' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
base $base
100644 $EMPTY_BLOB 0 one
@ -57,8 +57,8 @@ test_expect_success 'disable split index' '
EOF
test_cmp ls-files.expect ls-files.actual &&
BASE=$(test-dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
BASE=$(test-tool dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
not a split index
EOF
@ -73,7 +73,7 @@ test_expect_success 'enable split index again, "one" now belongs to base index"'
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -91,7 +91,7 @@ test_expect_success 'modify original file, base index untouched' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
q_to_tab >expect <<-EOF &&
$BASE
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@ -111,7 +111,7 @@ test_expect_success 'add another file, which stays index' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
q_to_tab >expect <<-EOF &&
$BASE
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@ -130,7 +130,7 @@ test_expect_success 'remove file not in base index' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
q_to_tab >expect <<-EOF &&
$BASE
100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@ -147,7 +147,7 @@ test_expect_success 'remove file in base index' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -165,7 +165,7 @@ test_expect_success 'add original file back' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
100644 $EMPTY_BLOB 0 one
@ -195,7 +195,7 @@ test_expect_success 'unify index, two files remain' '
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
not a split index
EOF
@ -229,8 +229,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two
EOF
test_cmp ls-files.expect ls-files.actual &&
BASE=$(test-dump-split-index .git/index | grep "^base") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -248,7 +248,7 @@ test_expect_success 'set core.splitIndex config variable to false' '
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two
EOF
test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
not a split index
EOF
@ -259,8 +259,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
git config core.splitIndex true &&
: >three &&
git update-index --add three &&
BASE=$(test-dump-split-index .git/index | grep "^base") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -269,7 +269,7 @@ test_expect_success 'set core.splitIndex config variable to true' '
test_cmp expect actual &&
: >four &&
git update-index --add four &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 four
@ -283,8 +283,8 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
git config --unset splitIndex.maxPercentChange &&
: >five &&
git update-index --add five &&
BASE=$(test-dump-split-index .git/index | grep "^base") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -293,7 +293,7 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
test_cmp expect actual &&
: >six &&
git update-index --add six &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 six
@ -307,8 +307,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
git config splitIndex.maxPercentChange 0 &&
: >seven &&
git update-index --add seven &&
BASE=$(test-dump-split-index .git/index | grep "^base") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -317,8 +317,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
test_cmp expect actual &&
: >eight &&
git update-index --add eight &&
BASE=$(test-dump-split-index .git/index | grep "^base") &&
test-dump-split-index .git/index | sed "/^own/d" >actual &&
BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<-EOF &&
$BASE
replacements:
@ -332,12 +332,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
git update-index --add ten &&
test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
just_under_2_weeks_ago=$((5-14*86400)) &&
test-chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
test-tool chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
: >eleven &&
git update-index --add eleven &&
test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
just_over_2_weeks_ago=$((-1-14*86400)) &&
test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
: >twelve &&
git update-index --add twelve &&
test $(ls .git/sharedindex.* | wc -l) -le 2
@ -345,12 +345,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
git config splitIndex.sharedIndexExpire "16.days.ago" &&
test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
: >thirteen &&
git update-index --add thirteen &&
test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
just_over_16_days_ago=$((-1-16*86400)) &&
test-chmtime =$just_over_16_days_ago .git/sharedindex.* &&
test-tool chmtime =$just_over_16_days_ago .git/sharedindex.* &&
: >fourteen &&
git update-index --add fourteen &&
test $(ls .git/sharedindex.* | wc -l) -le 2
@ -359,13 +359,13 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"' '
git config splitIndex.sharedIndexExpire never &&
just_10_years_ago=$((-365*10*86400)) &&
test-chmtime =$just_10_years_ago .git/sharedindex.* &&
test-tool chmtime =$just_10_years_ago .git/sharedindex.* &&
: >fifteen &&
git update-index --add fifteen &&
test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
git config splitIndex.sharedIndexExpire now &&
just_1_second_ago=-1 &&
test-chmtime =$just_1_second_ago .git/sharedindex.* &&
test-tool chmtime =$just_1_second_ago .git/sharedindex.* &&
: >sixteen &&
git update-index --add sixteen &&
test $(ls .git/sharedindex.* | wc -l) -le 2
@ -435,7 +435,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
commit=$(git commit-tree $tree -p HEAD <msg) &&
git update-ref HEAD "$commit" &&
GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
(test-dump-cache-tree >cache-tree.out || true) &&
(test-tool dump-cache-tree >cache-tree.out || true) &&
test_line_count = 0 cache-tree.out
'

View File

@ -68,13 +68,13 @@ test_expect_success 'do not touch files that are already up-to-date' '
git add file1 file2 &&
git commit -m base &&
echo modified >file1 &&
test-chmtime =1000000000 file2 &&
test-tool chmtime =1000000000 file2 &&
git update-index -q --refresh &&
git checkout HEAD -- file1 file2 &&
echo one >expect &&
test_cmp expect file1 &&
echo "1000000000 file2" >expect &&
test-chmtime -v +0 file2 >actual &&
test-tool chmtime -v +0 file2 >actual &&
test_cmp expect actual
'

View File

@ -33,7 +33,7 @@ test_expect_success 'setup' '
'
test_expect_success 'index is at version 2' '
test "$(test-index-version < .git/index)" = 2
test "$(test-tool index-version < .git/index)" = 2
'
test_expect_success 'update-index --skip-worktree' '
@ -42,7 +42,7 @@ test_expect_success 'update-index --skip-worktree' '
'
test_expect_success 'index is at version 3 after having some skip-worktree entries' '
test "$(test-index-version < .git/index)" = 3
test "$(test-tool index-version < .git/index)" = 3
'
test_expect_success 'ls-files -t' '
@ -55,7 +55,7 @@ test_expect_success 'update-index --no-skip-worktree' '
'
test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
test "$(test-index-version < .git/index)" = 2
test "$(test-tool index-version < .git/index)" = 2
'
test_done

View File

@ -4,7 +4,7 @@ test_description='Test the lazy init name hash with various folder structures'
. ./test-lib.sh
if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-online-cpus)
if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-tool online-cpus)
then
skip_all='skipping lazy-init tests, single cpu'
test_done
@ -21,7 +21,7 @@ test_expect_success 'no buffer overflow in lazy_init_name_hash' '
) |
sed "s/^/100644 $EMPTY_BLOB /" |
git update-index --index-info &&
test-lazy-init-name-hash -m
test-tool lazy-init-name-hash -m
'
test_done

View File

@ -79,12 +79,12 @@ match_with_function() {
if test "$match_expect" = 1
then
test_expect_success "$match_function: match '$text' '$pattern'" "
test-wildmatch $match_function '$text' '$pattern'
test-tool wildmatch $match_function '$text' '$pattern'
"
elif test "$match_expect" = 0
then
test_expect_success "$match_function: no match '$text' '$pattern'" "
test_must_fail test-wildmatch $match_function '$text' '$pattern'
test_must_fail test-tool wildmatch $match_function '$text' '$pattern'
"
else
test_expect_success "PANIC: Test framework error. Unknown matches value $match_expect" 'false'
@ -148,7 +148,7 @@ match_with_ls_files() {
match() {
if test "$#" = 6
then
# When test-wildmatch and git ls-files produce the same
# When test-tool wildmatch and git ls-files produce the same
# result.
match_glob=$1
match_file_glob=$match_glob
@ -204,19 +204,19 @@ match() {
fi
'
# $1: Case sensitive glob match: test-wildmatch & ls-files
# $1: Case sensitive glob match: test-tool wildmatch & ls-files
match_with_function "$text" "$pattern" $match_glob "wildmatch"
match_with_ls_files "$text" "$pattern" $match_file_glob "wildmatch" " --glob-pathspecs"
# $2: Case insensitive glob match: test-wildmatch & ls-files
# $2: Case insensitive glob match: test-tool wildmatch & ls-files
match_with_function "$text" "$pattern" $match_iglob "iwildmatch"
match_with_ls_files "$text" "$pattern" $match_file_iglob "iwildmatch" " --glob-pathspecs --icase-pathspecs"
# $3: Case sensitive path match: test-wildmatch & ls-files
# $3: Case sensitive path match: test-tool wildmatch & ls-files
match_with_function "$text" "$pattern" $match_pathmatch "pathmatch"
match_with_ls_files "$text" "$pattern" $match_file_pathmatch "pathmatch" ""
# $4: Case insensitive path match: test-wildmatch & ls-files
# $4: Case insensitive path match: test-tool wildmatch & ls-files
match_with_function "$text" "$pattern" $match_pathmatchi "ipathmatch"
match_with_ls_files "$text" "$pattern" $match_file_pathmatchi "ipathmatch" " --icase-pathspecs"
}

View File

@ -22,7 +22,7 @@ test_expect_success 'setup: create a few commits with notes' '
git commit -m 3rd &&
COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
test -f $COMMIT_FILE &&
test-chmtime =+0 $COMMIT_FILE &&
test-tool chmtime =+0 $COMMIT_FILE &&
git notes add -m "Note #3"
'

View File

@ -711,13 +711,13 @@ test_expect_success 'rebase -i continue with unstaged submodule' '
test_expect_success 'avoid unnecessary reset' '
git checkout master &&
git reset --hard &&
test-chmtime =123456789 file3 &&
test-tool chmtime =123456789 file3 &&
git update-index --refresh &&
HEAD=$(git rev-parse HEAD) &&
set_fake_editor &&
git rebase -i HEAD~4 &&
test $HEAD = $(git rev-parse HEAD) &&
MTIME=$(test-chmtime -v +0 file3 | sed 's/[^0-9].*$//') &&
MTIME=$(test-tool chmtime -v +0 file3 | sed 's/[^0-9].*$//') &&
test 123456789 = $MTIME
'

View File

@ -24,7 +24,7 @@ test_expect_success 'interactive rebase --continue works with touched file' '
git checkout master &&
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
test-chmtime =-60 F1 &&
test-tool chmtime =-60 F1 &&
git rebase --continue
'
@ -36,7 +36,7 @@ test_expect_success 'non-interactive rebase --continue works with touched file'
test_must_fail git rebase --onto master master topic &&
echo "Resolved" >F2 &&
git add F2 &&
test-chmtime =-60 F1 &&
test-tool chmtime =-60 F1 &&
git rebase --continue
'

View File

@ -86,7 +86,7 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
(
cd copy &&
git checkout initial &&
test-chmtime +40 oops &&
test-tool chmtime +40 oops &&
git cherry-pick added
)
'

View File

@ -247,9 +247,9 @@ test_expect_success '--abort after last commit in sequence' '
test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
pristine_detach initial &&
test_expect_code 1 git cherry-pick base..anotherpick &&
test-chmtime -v +0 .git/sequencer >expect &&
test-tool chmtime -v +0 .git/sequencer >expect &&
test_expect_code 128 git cherry-pick unrelatedpick &&
test-chmtime -v +0 .git/sequencer >actual &&
test-tool chmtime -v +0 .git/sequencer >actual &&
test_cmp expect actual
'

View File

@ -232,7 +232,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
test_expect_success 'refresh index before checking if it is up-to-date' '
git reset --hard &&
test-chmtime -86400 frotz/nitfol &&
test-tool chmtime -86400 frotz/nitfol &&
git rm frotz/nitfol &&
test ! -f frotz/nitfol

View File

@ -187,7 +187,7 @@ test_expect_success 'git add --refresh with pathspec' '
echo >foo && echo >bar && echo >baz &&
git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
echo "100644 $H 3 foo" | git update-index --index-info &&
test-chmtime -60 bar baz &&
test-tool chmtime -60 bar baz &&
>expect &&
git add --refresh bar >actual &&
test_cmp expect actual &&

View File

@ -73,7 +73,7 @@ test_expect_success 'diff identical, but newly created symlink and file' '
>expected &&
rm -f frotz nitfol &&
echo xyzzy >nitfol &&
test-chmtime +10 nitfol &&
test-tool chmtime +10 nitfol &&
if test_have_prereq SYMLINKS
then
ln -s xyzzy frotz

View File

@ -76,7 +76,7 @@ test_expect_success setup '
mkdir dir3 &&
cp dir/sub dir3/sub &&
test-chmtime +1 dir3/sub &&
test-tool chmtime +1 dir3/sub &&
git config log.showroot false &&
git commit --amend &&

View File

@ -147,7 +147,7 @@ test_expect_success 'git diff --ignore-all-space, both files outside repo' '
'
test_expect_success 'git diff --quiet ignores stat-change only entries' '
test-chmtime +10 a &&
test-tool chmtime +10 a &&
echo modified >>b &&
test_expect_code 1 git diff --quiet
'

View File

@ -171,7 +171,7 @@ test_expect_success 'am --skip leaves index stat info alone' '
git checkout -f --orphan skip-stat-info &&
git reset &&
test_commit skip-should-be-untouched &&
test-chmtime =0 skip-should-be-untouched.t &&
test-tool chmtime =0 skip-should-be-untouched.t &&
git update-index --refresh &&
git diff-files --exit-code --quiet &&
test_must_fail git am 0001-*.patch &&
@ -183,7 +183,7 @@ test_expect_success 'am --abort leaves index stat info alone' '
git checkout -f --orphan abort-stat-info &&
git reset &&
test_commit abort-should-be-untouched &&
test-chmtime =0 abort-should-be-untouched.t &&
test-tool chmtime =0 abort-should-be-untouched.t &&
git update-index --refresh &&
git diff-files --exit-code --quiet &&
test_must_fail git am 0001-*.patch &&

View File

@ -166,7 +166,7 @@ test_expect_success 'first postimage wins' '
git commit -q -a -m "prefer first over second" &&
test -f $rr/postimage &&
oldmtimepost=$(test-chmtime -v -60 $rr/postimage | cut -f 1) &&
oldmtimepost=$(test-tool chmtime -v -60 $rr/postimage | cut -f 1) &&
git checkout -b third master &&
git show second^:a1 | sed "s/To die: t/To die! T/" >a1 &&
@ -179,7 +179,7 @@ test_expect_success 'first postimage wins' '
'
test_expect_success 'rerere updates postimage timestamp' '
newmtimepost=$(test-chmtime -v +0 $rr/postimage | cut -f 1) &&
newmtimepost=$(test-tool chmtime -v +0 $rr/postimage | cut -f 1) &&
test $oldmtimepost -lt $newmtimepost
'
@ -220,9 +220,9 @@ test_expect_success 'set up for garbage collection tests' '
almost_60_days_ago=$((60-60*86400)) &&
just_over_60_days_ago=$((-1-60*86400)) &&
test-chmtime =$just_over_60_days_ago $rr/preimage &&
test-chmtime =$almost_60_days_ago $rr/postimage &&
test-chmtime =$almost_15_days_ago $rr2/preimage
test-tool chmtime =$just_over_60_days_ago $rr/preimage &&
test-tool chmtime =$almost_60_days_ago $rr/postimage &&
test-tool chmtime =$almost_15_days_ago $rr2/preimage
'
test_expect_success 'gc preserves young or recently used records' '
@ -232,8 +232,8 @@ test_expect_success 'gc preserves young or recently used records' '
'
test_expect_success 'old records rest in peace' '
test-chmtime =$just_over_60_days_ago $rr/postimage &&
test-chmtime =$just_over_15_days_ago $rr2/preimage &&
test-tool chmtime =$just_over_60_days_ago $rr/postimage &&
test-tool chmtime =$just_over_15_days_ago $rr2/preimage &&
git rerere gc &&
! test -f $rr/preimage &&
! test -f $rr2/preimage
@ -249,8 +249,8 @@ rerere_gc_custom_expiry_test () {
>"$rr/postimage" &&
two_days_ago=$((-2*86400)) &&
test-chmtime =$two_days_ago "$rr/preimage" &&
test-chmtime =$two_days_ago "$rr/postimage" &&
test-tool chmtime =$two_days_ago "$rr/preimage" &&
test-tool chmtime =$two_days_ago "$rr/postimage" &&
find .git/rr-cache -type f | sort >original &&
@ -512,7 +512,7 @@ test_expect_success 'multiple identical conflicts' '
count_pre_post 2 0 &&
# Pretend that the conflicts were made quite some time ago
find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
# Unresolved entries have not expired yet
git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
@ -568,7 +568,7 @@ test_expect_success 'multiple identical conflicts' '
git rerere &&
# Pretend that the resolutions are old again
find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
# Resolved entries have not expired yet
git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&

View File

@ -101,7 +101,7 @@ test_expect_success \
ten=0123456789 && hundred=$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten &&
echo long filename >a/four$hundred &&
mkdir a/bin &&
test-genrandom "frotz" 500000 >a/bin/sh &&
test-tool genrandom "frotz" 500000 >a/bin/sh &&
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
printf "A not substituted O" >a/substfile2 &&
if test_have_prereq SYMLINKS; then
@ -192,7 +192,7 @@ test_expect_success \
'validate file modification time' \
'mkdir extract &&
"$TAR" xf b.tar -C extract a/a &&
test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
test-tool chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
echo "1117231200" >expected.mtime &&
test_cmp expected.mtime b.mtime'

View File

@ -16,8 +16,8 @@ test_expect_success \
perl -e "print \"a\" x 4096;" > a &&
perl -e "print \"b\" x 4096;" > b &&
perl -e "print \"c\" x 4096;" > c &&
test-genrandom "seed a" 2097152 > a_big &&
test-genrandom "seed b" 2097152 > b_big &&
test-tool genrandom "seed a" 2097152 > a_big &&
test-tool genrandom "seed b" 2097152 > b_big &&
git update-index --add a a_big b b_big c &&
cat c >d && echo foo >>d && git update-index --add d &&
tree=$(git write-tree) &&

View File

@ -12,7 +12,7 @@ test_expect_success \
for i in a b c
do
echo $i >$i &&
test-genrandom "$i" 32768 >>$i &&
test-tool genrandom "$i" 32768 >>$i &&
git update-index --add $i || return 1
done &&
echo d >d && cat c >>d && git update-index --add d &&

View File

@ -15,17 +15,17 @@ test_expect_success \
while test $i -le 100
do
iii=$(printf '%03i' $i)
test-genrandom "bar" 200 > wide_delta_$iii &&
test-genrandom "baz $iii" 50 >> wide_delta_$iii &&
test-genrandom "foo"$i 100 > deep_delta_$iii &&
test-genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
test-genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
test-tool genrandom "bar" 200 > wide_delta_$iii &&
test-tool genrandom "baz $iii" 50 >> wide_delta_$iii &&
test-tool genrandom "foo"$i 100 > deep_delta_$iii &&
test-tool genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
test-tool genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
echo $iii >file_$iii &&
test-genrandom "$iii" 8192 >>file_$iii &&
test-tool genrandom "$iii" 8192 >>file_$iii &&
git update-index --add file_$iii deep_delta_$iii wide_delta_$iii &&
i=$(expr $i + 1) || return 1
done &&
{ echo 101 && test-genrandom 100 8192; } >file_101 &&
{ echo 101 && test-tool genrandom 100 8192; } >file_101 &&
git update-index --add file_101 &&
tree=$(git write-tree) &&
commit=$(git commit-tree $tree </dev/null) && {

View File

@ -19,14 +19,14 @@ test_description='resilience to pack corruptions with redundant objects'
# 3) object header is always 2 bytes.
create_test_files() {
test-genrandom "foo" 2000 > file_1 &&
test-genrandom "foo" 1800 > file_2 &&
test-genrandom "foo" 1800 > file_3 &&
test-tool genrandom "foo" 2000 > file_1 &&
test-tool genrandom "foo" 1800 > file_2 &&
test-tool genrandom "foo" 1800 > file_3 &&
echo " base " >> file_1 &&
echo " delta1 " >> file_2 &&
echo " delta delta2 " >> file_3 &&
test-genrandom "bar" 150 >> file_2 &&
test-genrandom "baz" 100 >> file_3
test-tool genrandom "bar" 150 >> file_2 &&
test-tool genrandom "baz" 100 >> file_3
}
create_new_pack() {

View File

@ -15,7 +15,7 @@ add_blob() {
BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
test_path_is_file $BLOB_FILE &&
test-chmtime =+0 $BLOB_FILE
test-tool chmtime =+0 $BLOB_FILE
}
test_expect_success setup '
@ -33,7 +33,7 @@ test_expect_success 'prune stale packs' '
orig_pack=$(echo .git/objects/pack/*.pack) &&
: > .git/objects/tmp_1.pack &&
: > .git/objects/tmp_2.pack &&
test-chmtime =-86501 .git/objects/tmp_1.pack &&
test-tool chmtime =-86501 .git/objects/tmp_1.pack &&
git prune --expire 1.day &&
test_path_is_file $orig_pack &&
test_path_is_file .git/objects/tmp_2.pack &&
@ -47,7 +47,7 @@ test_expect_success 'prune --expire' '
git prune --expire=1.hour.ago &&
verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
test_path_is_file $BLOB_FILE &&
test-chmtime =-86500 $BLOB_FILE &&
test-tool chmtime =-86500 $BLOB_FILE &&
git prune --expire 1.day &&
verbose test $before = $(git count-objects | sed "s/ .*//") &&
test_path_is_missing $BLOB_FILE
@ -57,11 +57,11 @@ test_expect_success 'prune --expire' '
test_expect_success 'gc: implicit prune --expire' '
add_blob &&
test-chmtime =-$((2*$week-30)) $BLOB_FILE &&
test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
git gc &&
verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
test_path_is_file $BLOB_FILE &&
test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
git gc &&
verbose test $before = $(git count-objects | sed "s/ .*//") &&
test_path_is_missing $BLOB_FILE
@ -141,7 +141,7 @@ test_expect_success 'prune: do not prune heads listed as an argument' '
test_expect_success 'gc --no-prune' '
add_blob &&
test-chmtime =-$((5001*$day)) $BLOB_FILE &&
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
git config gc.pruneExpire 2.days.ago &&
git gc --no-prune &&
verbose test 1 = $(git count-objects | sed "s/ .*//") &&
@ -163,7 +163,7 @@ test_expect_success 'gc respects gc.pruneExpire' '
test_expect_success 'gc --prune=<date>' '
add_blob &&
test-chmtime =-$((5001*$day)) $BLOB_FILE &&
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
git gc --prune=5002.days.ago &&
test_path_is_file $BLOB_FILE &&
git gc --prune=5000.days.ago &&
@ -205,7 +205,7 @@ test_expect_success 'prune --expire=never' '
test_expect_success 'gc: prune old objects after local clone' '
add_blob &&
test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
git clone --no-hardlinks . aclone &&
(
cd aclone &&

View File

@ -284,7 +284,7 @@ test_expect_success JGIT 'jgit can read our bitmaps' '
'
test_expect_success 'splitting packs does not generate bogus bitmaps' '
test-genrandom foo $((1024 * 1024)) >rand &&
test-tool genrandom foo $((1024 * 1024)) >rand &&
git add rand &&
git commit -m "commit with big file" &&
git -c pack.packSizeLimit=500k repack -adb &&

View File

@ -163,8 +163,8 @@ test_expect_success 'bogus offset inside v2 extended table' '
test_expect_success 'bogus OFS_DELTA in packfile' '
# Generate a pack with a delta in it.
base=$(test-genrandom foo 3000 | git hash-object --stdin -w) &&
delta=$(test-genrandom foo 2000 | git hash-object --stdin -w) &&
base=$(test-tool genrandom foo 3000 | git hash-object --stdin -w) &&
delta=$(test-tool genrandom foo 2000 | git hash-object --stdin -w) &&
do_pack "$base $delta" --delta-base-offset &&
rm -f .git/objects/??/* &&

View File

@ -73,7 +73,7 @@ make_pack () {
}
test_expect_success 'setup' '
test-genrandom base 4096 >base &&
test-tool genrandom base 4096 >base &&
for i in one two
do
# we want shared content here to encourage deltas...

Some files were not shown because too many files have changed in this diff Show More