shell-test: remove REP_NODELAY, less delay with REP

REP_NODELAY was added because REP delayed too much.  This changes REP to
only add a delay on every 100th line instead.

This helps to cover the additional pulse steps with
out_data_decide_throttle, which would have required to change
REP_NODELAY anyway.
This commit is contained in:
Daniel Hahler 2019-08-27 13:04:28 +02:00
parent b3ab7ba1d6
commit bf85023005
2 changed files with 6 additions and 13 deletions

View File

@ -40,7 +40,6 @@ static void help(void)
puts(" 0: foo bar");
puts(" ...");
puts(" 96: foo bar");
puts(" shell-test REP_NODELAY N {text}");
puts(" shell-test INTERACT");
puts(" Prints \"interact $ \" to stderr, and waits for \"exit\" input.");
}
@ -67,8 +66,7 @@ int main(int argc, char **argv)
if (argc >= 3) {
fprintf(stderr, "%s\n", argv[2]);
}
} else if (strcmp(argv[1], "REP") == 0 ||
strcmp(argv[1], "REP_NODELAY") == 0) {
} else if (strcmp(argv[1], "REP") == 0) {
if (argc != 4) {
fprintf(stderr, "REP expects exactly 3 arguments\n");
return 4;
@ -78,15 +76,10 @@ int main(int argc, char **argv)
fprintf(stderr, "Invalid count: %s\n", argv[2]);
return 4;
}
if (strcmp(argv[1], "REP_NODELAY") == 0) {
for (int i = 0; i < count; i++) {
printf("%d: %s\n", i, argv[3]);
fflush(stdout);
}
} else {
for (int i = 0; i < count; i++) {
printf("%d: %s\n", i, argv[3]);
fflush(stdout);
for (int i = 0; i < count; i++) {
printf("%d: %s\n", i, argv[3]);
fflush(stdout);
if (i % 100 == 0) {
usleep(1000); // Wait 1 ms (simulate typical output).
}
}

View File

@ -50,7 +50,7 @@ describe("shell command :!", function()
end)
it("throttles shell-command output greater than ~10KB", function()
child_session.feed_data(":!"..nvim_dir.."/shell-test REP_NODELAY 30001 foo\n")
child_session.feed_data(":!"..nvim_dir.."/shell-test REP 30001 foo\n")
-- If we observe any line starting with a dot, then throttling occurred.
-- Avoid false failure on slow systems.