From 6abc19720fff1c45b5a248a32c0b3de3fe8586ab Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Fri, 22 Aug 2025 09:13:59 -0400 Subject: [PATCH] hs-test: fix core file detection Type: test Change-Id: I7d6c494d66a053124d176a261b65dabe1a125215 Signed-off-by: Matus Fabian --- extras/hs-test/docker/Dockerfile.base | 1 + extras/hs-test/infra/utils.go | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/extras/hs-test/docker/Dockerfile.base b/extras/hs-test/docker/Dockerfile.base index 8186d7b3079..e6e3b442764 100644 --- a/extras/hs-test/docker/Dockerfile.base +++ b/extras/hs-test/docker/Dockerfile.base @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Basic utilities ca-certificates \ wget \ + file \ gnupg \ gnupg2 \ git \ diff --git a/extras/hs-test/infra/utils.go b/extras/hs-test/infra/utils.go index 14d084014bc..1d84a3f61ea 100644 --- a/extras/hs-test/infra/utils.go +++ b/extras/hs-test/infra/utils.go @@ -313,8 +313,12 @@ func (s *HstSuite) StartClientApp(c *Container, cmd string, } func (s *HstSuite) GetCoreProcessName(file string) (string, bool) { - cmd := fmt.Sprintf("sudo file -b %s", file) - output, _ := exechelper.Output(cmd) + cmd := fmt.Sprintf("file -b %s", file) + output, err := exechelper.Output(cmd) + if err != nil { + s.Log(fmt.Sprint(err)) + return "", false + } outputStr := string(output) // ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from 'vpp -c /tmp/server/etc/vpp/startup.conf', real uid: 0, effective uid: 0, real gid: 0, effective gid: 0, execfn: '/usr/bin/vpp', platform: 'x86_64' if !strings.Contains(outputStr, "core file") { -- 2.16.6