added tests for BootLoaderFindPath for x86/aarch64

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-03-18 16:14:16 +01:00
committed by Jonathon Anderson
parent 4f2e50b20c
commit 16f5b7408e
2 changed files with 70 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ func ShimFind(container string) string {
} else {
container_path = "/"
}
wwlog.Debug("Finding grub under paths: %s", container_path)
wwlog.Debug("Finding shim under paths: %s", container_path)
return BootLoaderFindPath(container_path, shimNames, shimDirs)
}
@@ -76,10 +76,13 @@ find the path of the shim binary in container
*/
func BootLoaderFindPath(cpath string, names func() []string, paths func() []string) string {
for _, bdir := range paths() {
wwlog.Debug("Checking shim directory: %s", bdir)
wwlog.Debug("Checking directory: %s", bdir)
for _, bname := range names() {
wwlog.Debug("Checking for bootloader name: %s", bname)
shimPaths, _ := filepath.Glob(path.Join(cpath, bdir, bname))
wwlog.Debug("Checking for bootloader name: %s", path.Join(cpath, bdir, bname))
shimPaths, err := filepath.Glob(path.Join(cpath, bdir, bname))
if err != nil {
wwlog.Debug("Got error when globing %s: %s", path.Join(cpath, bdir, bname), err)
}
for _, shimPath := range shimPaths {
wwlog.Debug("Checking for bootloader path: %s", shimPath)
// Only succeeds if shimPath exists and, if a