Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fat32 tests expected data auto-generated #253

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GOENV ?= GO111MODULE=on CGO_ENABLED=0
GO_FILES ?= $(shell $(GOENV) go list ./...)
GOBIN ?= $(shell go env GOPATH)/bin
LINTER ?= $(GOBIN)/golangci-lint
LINTER_VERSION ?= v1.55.2
LINTER_VERSION ?= v1.59.0

# BUILDARCH is the host architecture
# ARCH is the target architecture
Expand Down
22 changes: 18 additions & 4 deletions disk/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"crypto/rand"
"fmt"
"os"
"os/exec"
"path"
"strings"
"testing"

Expand Down Expand Up @@ -57,11 +59,11 @@ func tmpDisk(source string) (*os.File, error) {

func TestGetPartitionTable(t *testing.T) {
// this just calls partition.Read, so no need to do much more than a single test and see that it exercises it
path := "../partition/mbr/testdata/mbr.img"
imgPath := "../partition/mbr/testdata/mbr.img"
tableType := "mbr"
f, err := os.Open(path)
f, err := os.Open(imgPath)
if err != nil {
t.Errorf("Failed to open file %s :%v", path, err)
t.Errorf("Failed to open file %s :%v", imgPath, err)
}

// be sure to close the file
Expand Down Expand Up @@ -577,7 +579,19 @@ func TestGetFilesystem(t *testing.T) {
}
})
t.Run("whole disk", func(t *testing.T) {
f, err := tmpDisk("../filesystem/fat32/testdata/fat32.img")
tmpDir := t.TempDir()
// Run the genartifacts.sh script
cmd := exec.Command("sh", "mkfat32.sh", tmpDir)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = "../filesystem/fat32/testdata"

// Execute the command
if err := cmd.Run(); err != nil {
t.Fatalf("error generating fat32 test artifact for disk test: %v", err)
}

f, err := tmpDisk(path.Join(tmpDir, "dist", "fat32.img"))
if err != nil {
t.Fatalf("error creating new temporary disk: %v", err)
}
Expand Down
3 changes: 0 additions & 3 deletions filesystem/fat32/common_internal_test.go

This file was deleted.

Loading
Loading