1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 20:46:09 +02:00

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:
Junio C Hamano 2021-08-04 13:28:55 -07:00
commit fea3738ac5
5 changed files with 33 additions and 1 deletions

View File

@ -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
View 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;
}

View File

@ -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 },

View File

@ -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);

View File

@ -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 &&