mirror of
https://github.com/samuelncui/acp.git
synced 2026-07-26 01:02:37 +00:00
1.8 KiB
1.8 KiB
Testing
Run all commands from the repository root.
Prerequisites
- Go 1.18 or newer.
- Enough free space under the system temporary directory for test files and compiled binaries.
- A host file system that supports the operations exercised by the selected tests.
Standard checks
Run the complete test suite:
go test ./...
Run static analysis:
go vet ./...
Run the suite with the race detector:
go test -race ./...
End-to-end test
The end-to-end test builds the acp command, copies a directory tree through the CLI, and verifies:
- regular and empty file contents;
- nested destination paths;
- successful job status and destinations;
- JSON report decoding;
- SHA256 generation for every copied file.
Run only this test with:
go test -run '^TestACPCopyE2E$' -v .
The test is skipped when go test is run with -short.
Focused tests
Run cache concurrency tests:
go test -race -run '^TestCache' -count=20 .
Run path and mountpoint tests:
go test -run '^(TestComparePath|TestSourceRoot|TestFindMountpoint)$' .
Run acp-rewrite tests:
go test ./cmd/acp-rewrite
Cross-platform checks
Build all packages for Linux and Windows:
GOOS=linux GOARCH=amd64 go build ./...
GOOS=windows GOARCH=amd64 go build ./...
Compile the Windows-specific root package tests without running them:
GOOS=windows GOARCH=amd64 go test -c -o /tmp/acp-windows.test .
Change checklist
Before submitting a change:
- Run
gofmton modified Go files. - Run
go test ./.... - Run
go test -race ./...for concurrency, cache, pipeline, or event changes. - Run
go vet ./.... - Cross-build when changing paths, system calls, memory mapping, or file metadata.
- Confirm that source files, comments, tests, and documentation contain only English text.