Merge branch 'ab/getcwd-test'
Portability test update.
* ab/getcwd-test:
t0001: fix broken not-quite getcwd(3) test in bed67874e2
This commit is contained in:
commit
fea3738ac5
1
Makefile
1
Makefile
@ -715,6 +715,7 @@ TEST_BUILTINS_OBJS += test-example-decorate.o
|
||||
TEST_BUILTINS_OBJS += test-fast-rebase.o
|
||||
TEST_BUILTINS_OBJS += test-genrandom.o
|
||||
TEST_BUILTINS_OBJS += test-genzeros.o
|
||||
TEST_BUILTINS_OBJS += test-getcwd.o
|
||||
TEST_BUILTINS_OBJS += test-hash-speed.o
|
||||
TEST_BUILTINS_OBJS += test-hash.o
|
||||
TEST_BUILTINS_OBJS += test-hashmap.o
|
||||
|
26
t/helper/test-getcwd.c
Normal file
26
t/helper/test-getcwd.c
Normal file
@ -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;
|
||||
}
|
@ -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 },
|
||||
|
@ -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);
|
||||
|
@ -356,7 +356,10 @@ test_lazy_prereq GETCWD_IGNORES_PERMS '
|
||||
chmod 100 $base ||
|
||||
BUG "cannot prepare $base"
|
||||
|
||||
(cd $base/dir && /bin/pwd -P)
|
||||
(
|
||||
cd $base/dir &&
|
||||
test-tool getcwd
|
||||
)
|
||||
status=$?
|
||||
|
||||
chmod 700 $base &&
|
||||
|
Loading…
Reference in New Issue
Block a user