Skip to content

Commit 6e7e1a8

Browse files
committed
Ensure that libcuda.so is in the ldcache
Signed-off-by: Evan Lezar <[email protected]>
1 parent 04e9bf4 commit 6e7e1a8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/e2e/nvidia-container-toolkit_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package e2e
1818

1919
import (
2020
"context"
21+
"strings"
2122

2223
. "github.com/onsi/ginkgo/v2"
2324
. "github.com/onsi/gomega"
@@ -166,4 +167,29 @@ var _ = Describe("docker", Ordered, func() {
166167
Expect(referenceOutput).To(Equal(out4))
167168
})
168169
})
170+
171+
When("A container is run using CDI", Ordered, func() {
172+
BeforeAll(func(ctx context.Context) {
173+
_, _, err := r.Run("docker pull ubuntu")
174+
Expect(err).ToNot(HaveOccurred())
175+
})
176+
177+
It("should include libcuda.so in the ldcache", func(ctx context.Context) {
178+
ldcacheOutput, _, err := r.Run("docker run --rm -ti --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu bash -c \"ldconfig -p | grep 'libcuda.so'\"")
179+
Expect(err).ToNot(HaveOccurred())
180+
Expect(ldcacheOutput).ToNot(BeEmpty())
181+
182+
ldcacheLines := strings.Split(ldcacheOutput, "\n")
183+
Expect(ldcacheLines).To(HaveLen(2))
184+
185+
var libs []string
186+
for _, line := range ldcacheLines {
187+
parts := strings.SplitN(line, " (", 2)
188+
Expect(parts).To(HaveLen(2))
189+
libs = append(libs, strings.TrimSpace(parts[0]))
190+
}
191+
192+
Expect(libs).To(ContainElements([]string{"libcuda.so", "libcuda.so.1"}))
193+
})
194+
})
169195
})

0 commit comments

Comments
 (0)