mirror of
https://github.com/samuelncui/acp.git
synced 2026-07-21 15:02:18 +00:00
2.3 KiB
2.3 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 tests
The command 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 the command test with:
go test -run '^TestACPCommandE2E$' -v .
The library end-to-end test uses the public Go API directly with two destinations and verifies:
- the complete index, prepare, copy, cleanup, and event pipeline;
- regular, empty, and nested file contents at both destinations;
- successful report status and destination sets;
- file size and exact SHA256 values.
Run only the library test with:
go test -run '^TestACPLibraryE2E$' -v .
Run both end-to-end tests with:
go test -run '^TestACP(Command|Library)E2E$' -v .
Both tests are 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.