diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-08-04 23:28:55 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-04 23:28:55 +0300 |
commit | fea3738ac550776db44eddd2cd1ab37ae1004d6b (patch) | |
tree | 0a7cc4b59a450cdace31d99fde62043af8c7f748 /t/helper | |
parent | 4dc964691f83543d2e4b508e0354a431dbb528ce (diff) | |
parent | 482e1488a9b549cbf7466f4ee5396f93bb4588d6 (diff) |
Merge branch 'ab/getcwd-test'
Portability test update.
* ab/getcwd-test:
t0001: fix broken not-quite getcwd(3) test in bed67874e2
Diffstat (limited to 't/helper')
-rw-r--r-- | t/helper/test-getcwd.c | 26 | ||||
-rw-r--r-- | t/helper/test-tool.c | 1 | ||||
-rw-r--r-- | t/helper/test-tool.h | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/t/helper/test-getcwd.c b/t/helper/test-getcwd.c new file mode 100644 index 0000000000..d680038a78 --- /dev/null +++ b/t/helper/test-getcwd.c @@ -0,0 +1,26 @@ +#include "test-tool.h" +#include "git-compat-util.h" +#include "parse-options.h" + +static const char *getcwd_usage[] = { + "test-tool getcwd", + NULL +}; + +int cmd__getcwd(int argc, const char **argv) +{ + struct option options[] = { + OPT_END() + }; + char *cwd; + + argc = parse_options(argc, argv, "test-tools", options, getcwd_usage, 0); + if (argc > 0) + usage_with_options(getcwd_usage, options); + + cwd = xgetcwd(); + puts(cwd); + free(cwd); + + return 0; +} diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 490ac026c5..3ce5585e53 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -33,6 +33,7 @@ static struct test_cmd cmds[] = { { "fast-rebase", cmd__fast_rebase }, { "genrandom", cmd__genrandom }, { "genzeros", cmd__genzeros }, + { "getcwd", cmd__getcwd }, { "hashmap", cmd__hashmap }, { "hash-speed", cmd__hash_speed }, { "index-version", cmd__index_version }, diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h index f8dc266721..9f0f522850 100644 --- a/t/helper/test-tool.h +++ b/t/helper/test-tool.h @@ -23,6 +23,7 @@ int cmd__example_decorate(int argc, const char **argv); int cmd__fast_rebase(int argc, const char **argv); int cmd__genrandom(int argc, const char **argv); int cmd__genzeros(int argc, const char **argv); +int cmd__getcwd(int argc, const char **argv); int cmd__hashmap(int argc, const char **argv); int cmd__hash_speed(int argc, const char **argv); int cmd__index_version(int argc, const char **argv); |