t0211: test URL redacting in PERF format
This transmogrifies the test case that was just added to t0210, to also cover the `GIT_TRACE2_PERF` backend. Just like t0211, we now have to toggle the `TEST_PASSES_SANITIZE_LEAK` annotation. Signed-off-by: Jeff Hostetler <jeffhostetler@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff Hostetler committed
Nov 22, 2023 at 19:18 UTC
c73e7f80d32073b6fafec553d5875e720287e216
1 file changed
+20
-1
t/t0211-trace2-perf.sh
+20
-1
@@ -2,7 +2,7 @@
2
3
test_description='test trace2 facility (perf target)'
4
5
-TEST_PASSES_SANITIZE_LEAK=true
5
+TEST_PASSES_SANITIZE_LEAK=false
6
. ./test-lib.sh
7
8
# Turn off any inherited trace2 settings for this test.
@@ -268,4 +268,23 @@ test_expect_success PTHREADS 'global counter test/test2' '
268
have_counter_event "main" "counter" "test" "test2" 60 actual
269
'
270
271
+test_expect_success 'unsafe URLs are redacted by default' '
272
+ test_when_finished \
273
+ "rm -r actual trace.perf unredacted.perf clone clone2" &&
274
+
275
+ test_config_global \
276
+ "url.$(pwd).insteadOf" https://user:pwd@example.com/ &&
277
+ test_config_global trace2.configParams "core.*,remote.*.url" &&
278
+
279
+ GIT_TRACE2_PERF="$(pwd)/trace.perf" \
280
+ git clone https://user:pwd@example.com/ clone &&
281
+ ! grep user:pwd trace.perf &&
282
+
283
+ GIT_TRACE2_REDACT=0 GIT_TRACE2_PERF="$(pwd)/unredacted.perf" \
284
+ git clone https://user:pwd@example.com/ clone2 &&
285
+ perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <unredacted.perf >actual &&
286
+ grep "d0|main|start|.* clone https://user:pwd@example.com" actual &&
287
+ grep "d0|main|def_param|.*|remote.origin.url:https://user:pwd@example.com" actual
288
+'
289
+
290
test_done