@@ -18,6 +18,7 @@ package e2e
18
18
19
19
import (
20
20
"context"
21
+ "strings"
21
22
22
23
. "github.com/onsi/ginkgo/v2"
23
24
. "github.com/onsi/gomega"
@@ -166,4 +167,29 @@ var _ = Describe("docker", Ordered, func() {
166
167
Expect (referenceOutput ).To (Equal (out4 ))
167
168
})
168
169
})
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
+ })
169
195
})
0 commit comments