mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-15 10:58:45 +00:00
Sort links to get consistent and repeateable output
When you run sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml multiple times, you get small differences between each run, but only because the output of links is not sorted. Sorting the links solve the problem of reproducibility among runs. Signed-off-by: Agustin Henze <tin@aayy.com.ar>
This commit is contained in:
parent
890db82b46
commit
a85af1d78f
@ -19,6 +19,7 @@ package discover
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
)
|
||||
|
||||
type additionalSymlinks struct {
|
||||
@ -73,6 +74,9 @@ func (d *additionalSymlinks) Hooks() ([]Hook, error) {
|
||||
return hooks, nil
|
||||
}
|
||||
|
||||
// Sort the links to ensure consistent output
|
||||
sort.Strings(links)
|
||||
|
||||
createSymlinkHooks, err := d.hookCreator.Create("create-symlinks", links...).Hooks()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create symlink hook: %v", err)
|
||||
|
@ -301,8 +301,8 @@ func TestWithWithDriverDotSoSymlinks(t *testing.T) {
|
||||
Path: "/path/to/nvidia-cdi-hook",
|
||||
Args: []string{
|
||||
"nvidia-cdi-hook", "create-symlinks",
|
||||
"--link", "libcuda.so.1::/usr/lib/libcuda.so",
|
||||
"--link", "libGLX_nvidia.so.1.2.3::/usr/lib/libGLX_indirect.so.0",
|
||||
"--link", "libcuda.so.1::/usr/lib/libcuda.so",
|
||||
"--link", "libnvidia-opticalflow.so.1::/usr/lib/libnvidia-opticalflow.so",
|
||||
},
|
||||
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||
|
Loading…
Reference in New Issue
Block a user