From b9545da71c2f5e93355d82a1f9b5ead02f2bc617 Mon Sep 17 00:00:00 2001 From: Ethan Reesor Date: Thu, 5 Mar 2026 14:20:45 -0600 Subject: testing: escapes framing markers Uses `^[` to escape the framing marker `^V` used to delimit test output. A test that itself executes a go test binary, or otherwise emits that control character, previously would corrupt the test2json parse of the enclosing run. Updates #62728. Change-Id: I0e8790a05fd7af469cd7ee2e8ccc13786cc372dc Reviewed-on: https://go-review.googlesource.com/c/go/+/751940 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob Reviewed-by: Damien Neil --- .../internal/test2json/testdata/frameescape.json | 137 +++++++++++++++++++++ .../internal/test2json/testdata/frameescape.test | Bin 0 -> 2573 bytes 2 files changed, 137 insertions(+) create mode 100644 src/cmd/internal/test2json/testdata/frameescape.json create mode 100644 src/cmd/internal/test2json/testdata/frameescape.test (limited to 'src/cmd/internal/test2json/testdata') diff --git a/src/cmd/internal/test2json/testdata/frameescape.json b/src/cmd/internal/test2json/testdata/frameescape.json new file mode 100644 index 0000000000..c959089b92 --- /dev/null +++ b/src/cmd/internal/test2json/testdata/frameescape.json @@ -0,0 +1,137 @@ +{"Action":"start"} +{"Action":"run","Test":"TestAscii"} +{"Action":"output","Test":"TestAscii","Output":"=== RUN TestAscii\n"} +{"Action":"run","Test":"TestAscii/Log"} +{"Action":"output","Test":"TestAscii/Log","Output":"=== RUN TestAscii/Log\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0000\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0001\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0002\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0003\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0004\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0005\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0006\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0007\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \b\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \t\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \n"} +{"Action":"output","Test":"TestAscii/Log","Output":" \n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u000b\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \f\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \r\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u000e\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u000f\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0010\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0011\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0012\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0013\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0014\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0015\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0016\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0017\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0018\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0019\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u001a\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u001b\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u001c\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u001d\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u001e\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u001f\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: !\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \"\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: #\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: $\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: %\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u0026\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: '\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: (\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: )\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: *\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: +\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: ,\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: -\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: .\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: /\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 0\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 1\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 2\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 3\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 4\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 5\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 6\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 7\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 8\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: 9\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: :\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: ;\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u003c\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: =\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \u003e\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: ?\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: @\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: A\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: B\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: C\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: D\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: E\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: F\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: G\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: H\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: I\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: J\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: K\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: L\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: M\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: N\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: O\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: P\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: Q\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: R\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: S\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: T\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: U\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: V\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: W\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: X\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: Y\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: Z\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: [\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \\\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: ]\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: ^\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: _\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: `\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: a\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: b\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: c\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: d\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: e\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: f\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: g\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: h\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: i\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: j\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: k\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: l\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: m\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: n\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: o\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: p\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: q\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: r\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: s\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: t\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: u\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: v\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: w\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: x\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: y\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: z\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: {\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: |\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: }\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: ~\n"} +{"Action":"output","Test":"TestAscii/Log","Output":" x_test.go:8: \n"} +{"Action":"output","Test":"TestAscii/Log","Output":"--- PASS: TestAscii/Log (0.00s)\n"} +{"Action":"pass","Test":"TestAscii/Log"} +{"Action":"output","Test":"TestAscii","Output":"--- PASS: TestAscii (0.00s)\n"} diff --git a/src/cmd/internal/test2json/testdata/frameescape.test b/src/cmd/internal/test2json/testdata/frameescape.test new file mode 100644 index 0000000000..46abdfe1ea Binary files /dev/null and b/src/cmd/internal/test2json/testdata/frameescape.test differ -- cgit v1.3