| package kernel |
| |
| import ( |
| "context" |
| "os" |
| "testing" |
| ) |
| |
| func TestInstallCompilerToolchain(t *testing.T) { |
| downloader := FakeDownloader{} |
| ctx := context.Background() |
| targetDir := t.TempDir() |
| defer os.RemoveAll(targetDir) |
| |
| err := InstallCompilerToolchain(ctx, &downloader, targetDir) |
| if err != nil { |
| t.Errorf("failed to install compiler toolchain: %v", err) |
| } |
| if !CompilerToolchainInstalled(targetDir) { |
| t.Errorf("expected toolchain to be installed") |
| } |
| } |
| |
| func TestInstallKernelHeaders(t *testing.T) { |
| downloader := FakeDownloader{} |
| ctx := context.Background() |
| targetDir := t.TempDir() |
| defer os.RemoveAll(targetDir) |
| |
| err := InstallKernelHeaders(ctx, &downloader, targetDir) |
| if err != nil { |
| t.Errorf("failed to install kernel headers: %v", err) |
| } |
| if !KernelHeadersInstalled(targetDir) { |
| t.Errorf("expected headers to be installed") |
| } |
| } |