Fixing checkSentryExec to account for symlinks as the test runs locally.

Updates #4805

PiperOrigin-RevId: 487374028
This commit is contained in:
Shambhavi Srivastava
2022-11-09 16:11:22 -08:00
committed by gVisor bot
parent e038ca2a1c
commit 68c47a2f88
+4 -2
View File
@@ -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 {