-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(test): simplify macOS testing with automatic cross-compilation #9585
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
Open
mlwelles
wants to merge
25
commits into
main
Choose a base branch
from
test-env-setup-tweaks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On non-Linux systems, `make install` now automatically builds both: - Native binary at $GOPATH/bin/dgraph - Linux binary at $GOPATH/linux_<arch>/dgraph This eliminates the manual cross-compilation steps previously required for macOS users to run Docker-based integration tests. Introduces GOPATH_LINUX_BIN env var to locate the Linux binary.
- t/Makefile now uses GOPATH_LINUX_BIN for binary verification - t/t.go automatically sets GOPATH_LINUX_BIN based on runtime.GOOS - Add modular dependency check scripts in t/scripts/ The test runner now seamlessly works on macOS without manual environment variable setup.
Update all systest docker-compose.yml files to mount the dgraph binary from GOPATH_LINUX_BIN instead of hardcoded GOPATH/bin path. This enables Docker-based tests to find the correct Linux binary on both Linux and macOS systems.
- Add TESTING.md as comprehensive testing guide (renamed from TESTING_GUIDE.md) - Update CONTRIBUTING.md to link to TESTING.md with quick start examples - Simplify t/README.md macOS section to reflect automated build system - Add cross-references between documentation files The macOS testing instructions are now much simpler since the build system handles cross-compilation automatically.
Restore the witty ~~complex~~ sophisticated strikethrough and tighten prose while preserving voice. Move TESTING.md reference to end of section as a natural "learn more" exit ramp.
Add note explaining that manual installation isn't required since AUTO_INSTALL=true make check/test handles dependencies automatically.
- Add language specifier to code block (MD040) - Rename duplicate "How to Run" headings (MD024) - Remove trailing colons from anti-pattern headings (MD026)
Shorter, clearer name for the environment variable that specifies where Linux binaries are stored for Docker tests.
Add design document for unified `make test` entry point that supports: - Environment variables (TAGS, SUITE, PKG, TEST, FUZZ, FUZZTIME) - Helper targets (test-unit, test-integration2, etc.) - Auto-generated help from ## comments - Auto-discovery of fuzz test packages
Add three-way routing to the test target based on environment variables: - TAGS: bypass t/ runner, run go test directly with build tags - FUZZ: auto-discover and run fuzz tests in packages - SUITE (default): delegate to existing t/ runner Precedence: TAGS > FUZZ > SUITE The TAGS path is for integration2/upgrade tests that don't need the t/ runner's Docker Compose orchestration. The FUZZ path discovers packages containing Fuzz* functions and runs each with configurable FUZZTIME (default 300s).
- Change help output to use conventional Make syntax (make test VAR=value) - Add benchmark example showing PKG variable with test-benchmark - Update TESTING.md with all 11 test shortcuts and new syntax - Update CONTRIBUTING.md testing section with new examples - Align all documentation with current make help output
- Extract SUITE values from t/t.go's allowed list - Discover TAGS values by scanning test files for //go:build directives - Display both in make help output for better discoverability
…-all - Change i.e. examples to put vars after 'make test' (more intuitive) - Add test-all target for SUITE=all (completes helper target coverage) - Update TESTING.md to match new help output format - All SUITE and TAGS values now have corresponding helper targets
Contributor
|
Found 1 test failure on Blacksmith runners: Failure
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/documentation
Documentation related issues.
area/testing
Testing related issues
go
Pull requests that update Go code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR eliminates manual setup for running integration tests on macOS and introduces a unified test interface via Make.
Key Features
1. Automatic Cross-Compilation (macOS)
Previously, macOS developers had to manually cross-compile a Linux binary and juggle environment variables. Now,
make installhandles everything automatically.2. Unified Test Interface
A single
make testentry point that routes to the appropriate test runner based on variables:3. Convenient Shortcuts
Every SUITE and TAGS value has a corresponding helper target:
4. Dynamic Discovery
make helpdynamically discovers available SUITE values fromt/t.goand TAGS values from test file build directives.Changes
make installauto-detects the OS and builds both native and Linux binaries on non-Linux systemsmake testroutes to t/ runner orgo testbased onSUITE,TAGS,FUZZvariablestest-*targetmake helpshows available SUITE/TAGS values discovered from the codebaseLINUX_GOBINto specify where Linux binaries are stored for Docker tests${LINUX_GOBIN:-$GOPATH/bin}for binary mountingBefore (macOS)
After (macOS or Linux)
make install make test SUITE=systest PKG=systest/exportmake helpOutputTest plan
make installon macOS and verify both binaries are createdmake checkint/directorymake test-unitroutes to t/ runner with--suite=unitmake test TAGS=integration2 PKG=typesruns go test directlymake test FUZZ=1 PKG=dql FUZZTIME=5sruns fuzz testsmake test-benchmark PKG=typesruns benchmarksmake helpshows all targets, variables, and discovered SUITE/TAGS valuestest-*targettest-*target