From c201c30c7fbb329f734aa76f511360d397a48914 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Wed, 9 Oct 2024 00:21:31 +0900 Subject: [PATCH] helper/bwrap: check args only for internal tests Tests internal to the helper package sets crash-test-dummy as the command whenever a launch is expected to go through, and the hardcoded args are only valid for internal tests, so this characteristic is used here to exclude external tests that pass real program names and custom bwrap configurations. Signed-off-by: Ophestra Umiker --- helper/stub.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper/stub.go b/helper/stub.go index 78559b5..f9ff368 100644 --- a/helper/stub.go +++ b/helper/stub.go @@ -160,7 +160,7 @@ func bwrapStub(argsFD, statFD *int) { panic("cannot read want: " + err.Error()) } - if got.String() != want.String() { + if len(flag.CommandLine.Args()) > 0 && flag.CommandLine.Args()[0] == "crash-test-dummy" && got.String() != want.String() { panic("bad bwrap args\ngot: " + got.String() + "\nwant: " + want.String()) } }()