From 68c47a2f88945da9eaaaea3aa573c09e013fa522 Mon Sep 17 00:00:00 2001 From: Shambhavi Srivastava Date: Wed, 9 Nov 2022 16:11:22 -0800 Subject: [PATCH] Fixing checkSentryExec to account for symlinks as the test runs locally. Updates #4805 PiperOrigin-RevId: 487374028 --- test/trace/trace_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/trace/trace_test.go b/test/trace/trace_test.go index e3cc3e1e3..174e1ed2a 100644 --- a/test/trace/trace_test.go +++ b/test/trace/trace_test.go @@ -324,13 +324,15 @@ func checkSentryExec(msg test.Message) error { if err := checkContextData(p.ContextData); err != nil { return err } - if want := "/bin/true"; want != p.BinaryPath { + // As test runs locally the binary path may resolve to a symlink so would not be exactly same + // as the pathname passed. + if want := "/bin/true"; !strings.Contains(p.BinaryPath, want) { return fmt.Errorf("wrong BinaryPath, want: %q, got: %q", want, p.BinaryPath) } if len(p.Argv) == 0 { return fmt.Errorf("empty Argv") } - if p.Argv[0] != p.BinaryPath { + if !strings.Contains(p.BinaryPath, p.Argv[0]) { return fmt.Errorf("wrong Argv[0], want: %q, got: %q", p.BinaryPath, p.Argv[0]) } if len(p.Env) == 0 {