Package: git / 1:2.20.1-2+deb10u3

0021-quote-stress-test-allow-skipping-some-trials.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 2f76b19a118b92ea502766d8620f1c0abba387bd Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Thu, 19 Sep 2019 23:46:31 +0200
Subject: quote-stress-test: allow skipping some trials

When the, say, 93rd trial run fails, it is a good idea to have a way to
skip the first 92 trials and dig directly into the 93rd in a debugger.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
(cherry picked from commit 7530a6287e20a74b9fe6d4ca3a66df0f0f5cc52c)
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/helper/test-run-command.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index d310e79f98..6da11d3a3c 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -68,11 +68,12 @@ static int quote_stress_test(int argc, const char **argv)
 	 * were passed in.
 	 */
 	char special[] = ".?*\\^_\"'`{}()[]<>@~&+:;$%"; // \t\r\n\a";
-	int i, j, k, trials = 100;
+	int i, j, k, trials = 100, skip = 0;
 	struct strbuf out = STRBUF_INIT;
 	struct argv_array args = ARGV_ARRAY_INIT;
 	struct option options[] = {
 		OPT_INTEGER('n', "trials", &trials, "Number of trials"),
+		OPT_INTEGER('s', "skip", &skip, "Skip <n> trials"),
 		OPT_END()
 	};
 	const char * const usage[] = {
@@ -114,6 +115,9 @@ static int quote_stress_test(int argc, const char **argv)
 			}
 		}
 
+		if (i < skip)
+			continue;
+
 		cp.argv = args.argv;
 		strbuf_reset(&out);
 		if (pipe_command(&cp, NULL, 0, &out, 0, NULL, 0) < 0)
-- 
2.24.0.393.g34dc348eaf