diff options
author | baude <bbaude@redhat.com> | 2021-02-18 15:43:46 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-02-19 07:56:14 -0600 |
commit | d6b0b54121558027d087b9dcd157cb7df9d0a778 (patch) | |
tree | e2b742821f6f6fa824eb9227bb88c29572148f34 /test/e2e/run_memory_test.go | |
parent | b2bb05d598452f7653e5b9311e3bd844b767cb26 (diff) | |
download | podman-d6b0b54121558027d087b9dcd157cb7df9d0a778.tar.gz podman-d6b0b54121558027d087b9dcd157cb7df9d0a778.tar.bz2 podman-d6b0b54121558027d087b9dcd157cb7df9d0a778.zip |
Fix segfault in run with memory-swap
when unlimited (-1) was being passed to memory-swap, podman threw a
segfault.
Fixes #9429
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test/e2e/run_memory_test.go')
-rw-r--r-- | test/e2e/run_memory_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go index ad3a2b54f..8371d3cae 100644 --- a/test/e2e/run_memory_test.go +++ b/test/e2e/run_memory_test.go @@ -2,6 +2,7 @@ package integration import ( "os" + "strconv" . "github.com/containers/podman/v2/test/utils" . "github.com/onsi/ginkgo" @@ -90,4 +91,27 @@ var _ = Describe("Podman run memory", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(Equal("41943040")) }) + + It("podman run kernel-memory test", func() { + if podmanTest.Host.Distribution == "ubuntu" { + Skip("Unable to perform test on Ubuntu distributions due to memory management") + } + var session *PodmanSessionIntegration + if CGROUPSV2 { + session = podmanTest.Podman([]string{"run", "--memory", "256m", "--memory-swap", "-1", ALPINE, "cat", "/sys/fs/cgroup/memory.swap.max"}) + } else { + session = podmanTest.Podman([]string{"run", "--cgroupns=private", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"}) + } + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + output := session.OutputToString() + Expect(err).To(BeNil()) + if CGROUPSV2 { + Expect(output).To(Equal("max")) + } else { + crazyHighNumber, err := strconv.ParseInt(output, 10, 64) + Expect(err).To(BeZero()) + Expect(crazyHighNumber).To(BeNumerically(">", 936854771712)) + } + }) }) |