Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
t/helper: merge test-run-command into test-tool
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sat, 24 Mar 2018 07:44:55 +0000
(08:44 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 27 Mar 2018 15:45:47 +0000
(08:45 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
patch
|
blob
|
history
t/helper/test-run-command.c
patch
|
blob
|
history
t/helper/test-tool.c
patch
|
blob
|
history
t/helper/test-tool.h
patch
|
blob
|
history
t/t0061-run-command.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
77d4b8c
)
diff --git
a/Makefile
b/Makefile
index 3ed461cd5521fc7ddb8f060091e7e039f3643f1c..adece67b8eb685281e7adf494cbcd60539e5389f 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-675,6
+675,7
@@
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-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-sha1.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
TEST_BUILTINS_OBJS += test-sha1.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@
-683,7
+684,6
@@
TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-write-cache
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-run-command
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
TEST_PROGRAMS_NEED_X += test-sha1-array
TEST_PROGRAMS_NEED_X += test-sigchain
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
TEST_PROGRAMS_NEED_X += test-sha1-array
TEST_PROGRAMS_NEED_X += test-sigchain
diff --git
a/t/helper/test-run-command.c
b/t/helper/test-run-command.c
index 153342e44dd11ae357cc299a9214f4c365614a5e..2cc93bb69c522d99491cd8a9e02e211b2c3df807 100644
(file)
--- a/
t/helper/test-run-command.c
+++ b/
t/helper/test-run-command.c
@@
-8,6
+8,7
@@
* published by the Free Software Foundation.
*/
* published by the Free Software Foundation.
*/
+#include "test-tool.h"
#include "git-compat-util.h"
#include "run-command.h"
#include "argv-array.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;
}
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;
{
struct child_process proc = CHILD_PROCESS_INIT;
int jobs;
diff --git
a/t/helper/test-tool.c
b/t/helper/test-tool.c
index 7da5fb4d83ce892d6cd2cba92d615f32ad6b95b0..54bdee04b9b0804a8d6c248147d6e6967edf7693 100644
(file)
--- a/
t/helper/test-tool.c
+++ b/
t/helper/test-tool.c
@@
-30,6
+30,7
@@
static struct test_cmd cmds[] = {
{ "ref-store", cmd__ref_store },
{ "regex", cmd__regex },
{ "revision-walking", cmd__revision_walking },
{ "ref-store", cmd__ref_store },
{ "regex", cmd__regex },
{ "revision-walking", cmd__revision_walking },
+ { "run-command", cmd__run_command },
{ "sha1", cmd__sha1 },
};
{ "sha1", cmd__sha1 },
};
diff --git
a/t/helper/test-tool.h
b/t/helper/test-tool.h
index 4dff2206462a6b889d9084a4903beb736ebedbb2..0fe2dd640b497a8440351765cb9a8a8fff24bcdf 100644
(file)
--- a/
t/helper/test-tool.h
+++ b/
t/helper/test-tool.h
@@
-24,6
+24,7
@@
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__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__sha1(int argc, const char **argv);
#endif
int cmd__sha1(int argc, const char **argv);
#endif
diff --git
a/t/t0061-run-command.sh
b/t/t0061-run-command.sh
index 24c92b6cd7b1c54eb6541a81abd7e5812b3b99b0..d03149be9f667307a181ef17a3291ecc7eeb19cb 100755
(executable)
--- a/
t/t0061-run-command.sh
+++ b/
t/t0061-run-command.sh
@@
-14,13
+14,13
@@
EOF
>empty
test_expect_success 'start_command reports ENOENT' '
>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_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
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 &&
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
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 \
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
'
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 \
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
'
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_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
'
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' '
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_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_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
'
test_cmp expect actual
'
@@
-128,7
+128,7
@@
asking for a quick stop
EOF
test_expect_success 'run_command is asked to abort gracefully' '
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
'
test_cmp expect actual
'
@@
-137,14
+137,14
@@
no further jobs available
EOF
test_expect_success 'run_command outputs ' '
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
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
sed 's/.* run_command: //' >actual &&
echo "$expect true" >expect &&
test_cmp expect actual