func TestModuleNames(t *testing.T) {
	t.Parallel()
	ver, err := readKernelVersion()
	require.NoError(t, err)
	conf := &generatorConfig{
		universal:           true,
		kernelVersion:       ver,
		modulesDir:          "/usr/lib/modules/" + ver,
		readHostModules:     readHostModules,
		readDeviceAliases:   readDeviceAliases,
		readModprobeOptions: readModprobeOptions,
	}
	kmod, err := NewKmod(conf)
	require.NoError(t, err)
	ch := make(chan error)
	wg := sync.WaitGroup{}
	for name, fn := range kmod.nameToPathMapping.forward {
		require.NotEqual(t, '/', fn[0], "module filename should not start with slash")
		require.Equal(t, fn, path.Clean(fn), "filepath is not clean")
		if _, ok := kmod.builtinModules[name]; ok {
			continue  
		}
		wg.Add(1)
		go checkModuleName(name, path.Join(kmod.hostModulesDir, fn), &wg, ch)
	}
	w := make(chan struct{})
	go func() {
		defer close(w)
		wg.Wait()
	}()
	select {
	case err := <-ch:
		require.Fail(t, err.Error())
	case <-w:
		break
	}
}
Scans all modules at the current kernel and verifies that its calculated mod name equal to one embeeded into the module
package main
import (
	"bytes"
	"debug/elf"
	"fmt"
	"io"
	"os"
	"path"
	"strings"
	"sync"
	"testing"
	"github.com/klauspost/compress/zstd"
	"github.com/stretchr/testify/require"
	"github.com/xi2/xz"
)