2018-10-18 06:13:26 +08:00
|
|
|
#ifndef TEST_TOOL_H
|
|
|
|
#define TEST_TOOL_H
|
2018-03-24 15:44:30 +08:00
|
|
|
|
2019-01-24 16:29:12 +08:00
|
|
|
#define USE_THE_INDEX_COMPATIBILITY_MACROS
|
2018-08-22 02:41:40 +08:00
|
|
|
#include "git-compat-util.h"
|
|
|
|
|
2020-03-03 04:01:59 +08:00
|
|
|
int cmd__advise_if_enabled(int argc, const char **argv);
|
2021-04-01 09:32:11 +08:00
|
|
|
int cmd__bitmap(int argc, const char **argv);
|
2020-03-30 08:31:24 +08:00
|
|
|
int cmd__bloom(int argc, const char **argv);
|
2018-03-24 15:44:31 +08:00
|
|
|
int cmd__chmtime(int argc, const char **argv);
|
2018-03-24 15:44:34 +08:00
|
|
|
int cmd__config(int argc, const char **argv);
|
2020-09-12 01:49:18 +08:00
|
|
|
int cmd__crontab(int argc, const char **argv);
|
2018-03-24 15:44:35 +08:00
|
|
|
int cmd__ctype(int argc, const char **argv);
|
2018-03-24 15:44:36 +08:00
|
|
|
int cmd__date(int argc, const char **argv);
|
2018-03-24 15:44:37 +08:00
|
|
|
int cmd__delta(int argc, const char **argv);
|
2019-07-11 07:58:57 +08:00
|
|
|
int cmd__dir_iterator(int argc, const char **argv);
|
2018-03-24 15:44:38 +08:00
|
|
|
int cmd__drop_caches(int argc, const char **argv);
|
2018-03-24 15:44:39 +08:00
|
|
|
int cmd__dump_cache_tree(int argc, const char **argv);
|
2018-09-10 01:36:30 +08:00
|
|
|
int cmd__dump_fsmonitor(int argc, const char **argv);
|
2018-03-24 15:44:40 +08:00
|
|
|
int cmd__dump_split_index(int argc, const char **argv);
|
2018-09-10 01:36:27 +08:00
|
|
|
int cmd__dump_untracked_cache(int argc, const char **argv);
|
2018-03-24 15:44:41 +08:00
|
|
|
int cmd__example_decorate(int argc, const char **argv);
|
2020-10-30 04:32:13 +08:00
|
|
|
int cmd__fast_rebase(int argc, const char **argv);
|
2018-03-24 15:44:42 +08:00
|
|
|
int cmd__genrandom(int argc, const char **argv);
|
tests: teach the test-tool to generate NUL bytes and use it
In cc95bc2025 (t5562: replace /dev/zero with a pipe from
generate_zero_bytes, 2019-02-09), we replaced usage of /dev/zero (which
is not available on NonStop, apparently) by a Perl script snippet to
generate NUL bytes.
Sadly, it does not seem to work on NonStop, as t5562 reportedly hangs.
Worse, this also hangs in the Ubuntu 16.04 agents of the CI builds on
Azure Pipelines: for some reason, the Perl script snippet that is run
via `generate_zero_bytes` in t5562's 'CONTENT_LENGTH overflow ssite_t'
test case tries to write out an infinite amount of NUL bytes unless a
broken pipe is encountered, that snippet never encounters the broken
pipe, and keeps going until the build times out.
Oddly enough, this does not reproduce on the Windows and macOS agents,
nor in a local Ubuntu 18.04.
This developer tried for a day to figure out the exact circumstances
under which this hang happens, to no avail, the details remain a
mystery.
In the end, though, what counts is that this here change incidentally
fixes that hang (maybe also on NonStop?). Even more positively, it gets
rid of yet another unnecessary Perl invocation.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-15 05:33:12 +08:00
|
|
|
int cmd__genzeros(int argc, const char **argv);
|
2018-03-24 15:44:43 +08:00
|
|
|
int cmd__hashmap(int argc, const char **argv);
|
2018-11-14 12:09:34 +08:00
|
|
|
int cmd__hash_speed(int argc, const char **argv);
|
2018-03-24 15:44:44 +08:00
|
|
|
int cmd__index_version(int argc, const char **argv);
|
2018-07-14 00:54:08 +08:00
|
|
|
int cmd__json_writer(int argc, const char **argv);
|
2018-03-24 15:44:33 +08:00
|
|
|
int cmd__lazy_init_name_hash(int argc, const char **argv);
|
2018-03-24 15:44:45 +08:00
|
|
|
int cmd__match_trees(int argc, const char **argv);
|
2018-03-24 15:44:46 +08:00
|
|
|
int cmd__mergesort(int argc, const char **argv);
|
2018-03-24 15:44:47 +08:00
|
|
|
int cmd__mktemp(int argc, const char **argv);
|
2019-06-15 18:06:59 +08:00
|
|
|
int cmd__oidmap(int argc, const char **argv);
|
2018-03-24 15:44:48 +08:00
|
|
|
int cmd__online_cpus(int argc, const char **argv);
|
2018-09-10 01:36:29 +08:00
|
|
|
int cmd__parse_options(int argc, const char **argv);
|
2019-12-31 18:15:12 +08:00
|
|
|
int cmd__parse_pathspec_file(int argc, const char** argv);
|
2018-03-24 15:44:49 +08:00
|
|
|
int cmd__path_utils(int argc, const char **argv);
|
grep/pcre2: better support invalid UTF-8 haystacks
Improve the support for invalid UTF-8 haystacks given a non-ASCII
needle when using the PCREv2 backend.
This is a more complete fix for a bug I started to fix in
870eea8166 (grep: do not enter PCRE2_UTF mode on fixed matching,
2019-07-26), now that PCREv2 has the PCRE2_MATCH_INVALID_UTF mode we
can make use of it.
This fixes the sort of case described in 8a5999838e (grep: stess test
PCRE v2 on invalid UTF-8 data, 2019-07-26), i.e.:
- The subject string is non-ASCII (e.g. "ævar")
- We're under a is_utf8_locale(), e.g. "en_US.UTF-8", not "C"
- We are using --ignore-case, or we're a non-fixed pattern
If those conditions were satisfied and we matched found non-valid
UTF-8 data PCREv2 might bark on it, in practice this only happened
under the JIT backend (turned on by default on most platforms).
Ultimately this fixes a "regression" in b65abcafc7 ("grep: use PCRE v2
for optimized fixed-string search", 2019-07-01), I'm putting that in
scare-quotes because before then we wouldn't properly support these
complex case-folding, locale etc. cases either, it just broke in
different ways.
There was a bug related to this the PCRE2_NO_START_OPTIMIZE flag fixed
in PCREv2 10.36. It can be worked around by setting the
PCRE2_NO_START_OPTIMIZE flag. Let's do that in those cases, and add
tests for the bug.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-25 01:28:13 +08:00
|
|
|
int cmd__pcre2_config(int argc, const char **argv);
|
2018-09-10 01:36:28 +08:00
|
|
|
int cmd__pkt_line(int argc, const char **argv);
|
2018-03-24 15:44:50 +08:00
|
|
|
int cmd__prio_queue(int argc, const char **argv);
|
receive-pack: add new proc-receive hook
Git calls an internal `execute_commands` function to handle commands
sent from client to `git-receive-pack`. Regardless of what references
the user pushes, git creates or updates the corresponding references if
the user has write-permission. A contributor who has no
write-permission, cannot push to the repository directly. So, the
contributor has to write commits to an alternate location, and sends
pull request by emails or by other ways. We call this workflow as a
distributed workflow.
It would be more convenient to work in a centralized workflow like what
Gerrit provided for some cases. For example, a read-only user who
cannot push to a branch directly can run the following `git push`
command to push commits to a pseudo reference (has a prefix "refs/for/",
not "refs/heads/") to create a code review.
git push origin \
HEAD:refs/for/<branch-name>/<session>
The `<branch-name>` in the above example can be as simple as "master",
or a more complicated branch name like "foo/bar". The `<session>` in
the above example command can be the local branch name of the client
side, such as "my/topic".
We cannot implement a centralized workflow elegantly by using
"pre-receive" + "post-receive", because Git will call the internal
function "execute_commands" to create references (even the special
pseudo reference) between these two hooks. Even though we can delete
the temporarily created pseudo reference via the "post-receive" hook,
having a temporary reference is not safe for concurrent pushes.
So, add a filter and a new handler to support this kind of workflow.
The filter will check the prefix of the reference name, and if the
command has a special reference name, the filter will turn a specific
field (`run_proc_receive`) on for the command. Commands with this filed
turned on will be executed by a new handler (a hook named
"proc-receive") instead of the internal `execute_commands` function.
We can use this "proc-receive" command to create pull requests or send
emails for code review.
Suggested by Junio, this "proc-receive" hook reads the commands,
push-options (optional), and send result using a protocol in pkt-line
format. In the following example, the letter "S" stands for
"receive-pack" and letter "H" stands for the hook.
# Version and features negotiation.
S: PKT-LINE(version=1\0push-options atomic...)
S: flush-pkt
H: PKT-LINE(version=1\0push-options...)
H: flush-pkt
# Send commands from server to the hook.
S: PKT-LINE(<old-oid> <new-oid> <ref>)
S: ... ...
S: flush-pkt
# Send push-options only if the 'push-options' feature is enabled.
S: PKT-LINE(push-option)
S: ... ...
S: flush-pkt
# Receive result from the hook.
# OK, run this command successfully.
H: PKT-LINE(ok <ref>)
# NO, I reject it.
H: PKT-LINE(ng <ref> <reason>)
# Fall through, let 'receive-pack' to execute it.
H: PKT-LINE(ok <ref>)
H: PKT-LINE(option fall-through)
# OK, but has an alternate reference. The alternate reference name
# and other status can be given in options
H: PKT-LINE(ok <ref>)
H: PKT-LINE(option refname <refname>)
H: PKT-LINE(option old-oid <old-oid>)
H: PKT-LINE(option new-oid <new-oid>)
H: PKT-LINE(option forced-update)
H: ... ...
H: flush-pkt
After receiving a command, the hook will execute the command, and may
create/update different reference. For example, a command for a pseudo
reference "refs/for/master/topic" may create/update different reference
such as "refs/pull/123/head". The alternate reference name and other
status are given in option lines.
The list of commands returned from "proc-receive" will replace the
relevant commands that are sent from user to "receive-pack", and
"receive-pack" will continue to run the "execute_commands" function and
other routines. Finally, the result of the execution of these commands
will be reported to end user.
The reporting function from "receive-pack" to "send-pack" will be
extended in latter commit just like what the "proc-receive" hook reports
to "receive-pack".
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-27 23:45:44 +08:00
|
|
|
int cmd__proc_receive(int argc, const char **argv);
|
Test the progress display
'progress.c' has seen a few fixes recently [1], and, unfortunately,
some of those fixes required further fixes [2]. It seems it's time to
have a few tests focusing on the subtleties of the progress display.
Add the 'test-tool progress' subcommand to help testing the progress
display, reading instructions from standard input and turning them
into calls to the display_progress() and display_throughput()
functions with the given parameters.
The progress display is, however, critically dependent on timing,
because it's only updated once every second or, if the toal is known
in advance, every 1%, and there is the throughput rate as well. These
make the progress display far too undeterministic for testing as-is.
To address this, add a few testing-specific variables and functions to
'progress.c', allowing the the new test helper to:
- Disable the triggered-every-second SIGALRM and set the
'progress_update' flag explicitly based in the input instructions.
This way the progress line will be updated deterministically when
the test wants it to be updated.
- Specify the time elapsed since start_progress() to make the
throughput rate calculations deterministic.
Add the new test script 't0500-progress-display.sh' to check a few
simple cases with and without throughput, and that a shorter progress
line properly covers up the previously displayed line in different
situations.
[1] See commits 545dc345eb (progress: break too long progress bar
lines, 2019-04-12) and 9f1fd84e15 (progress: clear previous
progress update dynamically, 2019-04-12).
[2] 1aed1a5f25 (progress: avoid empty line when breaking the progress
line, 2019-05-19)
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-17 04:54:12 +08:00
|
|
|
int cmd__progress(int argc, const char **argv);
|
2018-07-21 00:33:15 +08:00
|
|
|
int cmd__reach(int argc, const char **argv);
|
2018-03-24 15:44:51 +08:00
|
|
|
int cmd__read_cache(int argc, const char **argv);
|
2019-11-13 00:58:20 +08:00
|
|
|
int cmd__read_graph(int argc, const char **argv);
|
2018-07-13 03:39:23 +08:00
|
|
|
int cmd__read_midx(int argc, const char **argv);
|
2018-03-24 15:44:52 +08:00
|
|
|
int cmd__ref_store(int argc, const char **argv);
|
2018-03-24 15:44:53 +08:00
|
|
|
int cmd__regex(int argc, const char **argv);
|
2018-07-12 06:42:42 +08:00
|
|
|
int cmd__repository(int argc, const char **argv);
|
2018-03-24 15:44:54 +08:00
|
|
|
int cmd__revision_walking(int argc, const char **argv);
|
2018-03-24 15:44:55 +08:00
|
|
|
int cmd__run_command(int argc, const char **argv);
|
2018-03-24 15:44:56 +08:00
|
|
|
int cmd__scrap_cache_tree(int argc, const char **argv);
|
2019-04-18 21:16:51 +08:00
|
|
|
int cmd__serve_v2(int argc, const char **argv);
|
2018-03-24 15:44:32 +08:00
|
|
|
int cmd__sha1(int argc, const char **argv);
|
2020-03-30 22:04:03 +08:00
|
|
|
int cmd__oid_array(int argc, const char **argv);
|
2018-11-14 12:09:36 +08:00
|
|
|
int cmd__sha256(int argc, const char **argv);
|
2018-03-24 15:44:58 +08:00
|
|
|
int cmd__sigchain(int argc, const char **argv);
|
2021-03-22 18:29:48 +08:00
|
|
|
int cmd__simple_ipc(int argc, const char **argv);
|
2018-03-24 15:44:59 +08:00
|
|
|
int cmd__strcmp_offset(int argc, const char **argv);
|
2018-03-24 15:45:00 +08:00
|
|
|
int cmd__string_list(int argc, const char **argv);
|
2018-03-24 15:45:01 +08:00
|
|
|
int cmd__submodule_config(int argc, const char **argv);
|
2018-10-26 00:18:13 +08:00
|
|
|
int cmd__submodule_nested_repo_config(int argc, const char **argv);
|
2018-03-24 15:45:02 +08:00
|
|
|
int cmd__subprocess(int argc, const char **argv);
|
2019-02-23 06:25:10 +08:00
|
|
|
int cmd__trace2(int argc, const char **argv);
|
2021-04-08 23:04:21 +08:00
|
|
|
int cmd__userdiff(int argc, const char **argv);
|
2018-03-24 15:45:03 +08:00
|
|
|
int cmd__urlmatch_normalization(int argc, const char **argv);
|
2019-01-29 22:19:27 +08:00
|
|
|
int cmd__xml_encode(int argc, const char **argv);
|
2018-03-24 15:45:04 +08:00
|
|
|
int cmd__wildmatch(int argc, const char **argv);
|
2018-09-12 04:06:01 +08:00
|
|
|
#ifdef GIT_WINDOWS_NATIVE
|
|
|
|
int cmd__windows_named_pipe(int argc, const char **argv);
|
|
|
|
#endif
|
2018-03-24 15:45:05 +08:00
|
|
|
int cmd__write_cache(int argc, const char **argv);
|
2018-03-24 15:44:31 +08:00
|
|
|
|
2018-11-14 12:09:32 +08:00
|
|
|
int cmd_hash_impl(int ac, const char **av, int algo);
|
|
|
|
|
2018-03-24 15:44:30 +08:00
|
|
|
#endif
|