Bump minimum Bazel version and add C++/Rust usage examples - #34
Open
Subramanian-K812 wants to merge 3 commits into
Open
Subramanian-K812 wants to merge 3 commits into
Subramanian-K812 wants to merge 3 commits into
Conversation
PiotrKorkus
reviewed
Sep 18, 2026
|
|
||
| ```bash | ||
| bazel run //examples:cpp_basic -- --list-scenarios | ||
| bazel run //examples:cpp_basic -- --name version.parse --input 8.6.0 |
Contributor
There was a problem hiding this comment.
combining bazel version as example is confusing for user. Do something unrelated to env, even simple enumeration would be good
|
|
||
| fn run(&self, input: &str) -> Result<(), String> { | ||
| let (major, minor, patch) = parse_version(input)?; | ||
| println!("major={major} minor={minor} patch={patch}"); |
Contributor
There was a problem hiding this comment.
the whole point of scenarios is to use logging that comes with monotonic clock, same for cpp
Comment on lines
+22
to
+33
| fn parse_version(input: &str) -> Result<(u32, u32, u32), String> { | ||
| let parts: Vec<&str> = input.split('.').collect(); | ||
| let err = || format!("'{input}' is not a valid major.minor.patch version"); | ||
| if parts.len() != 3 { | ||
| return Err(err()); | ||
| } | ||
| let mut numbers = [0u32; 3]; | ||
| for (i, part) in parts.iter().enumerate() { | ||
| numbers[i] = part.parse::<u32>().map_err(|_| err())?; | ||
| } | ||
| Ok((numbers[0], numbers[1], numbers[2])) | ||
| } |
Contributor
There was a problem hiding this comment.
create a struct with Serialize/Deserialize, create a custom type instance by parsing input json. take a look at kyron tests implementation
Subramanian-K812
force-pushed
the
Subramanian-K812_add_cpp_rust_examples
branch
from
September 18, 2026 13:58
af0f2e2 to
3ec7773
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add C++/Rust usage examples and bump minimum Bazel version to 8.6.0
Adds a runnable "getting started" example for
test_scenarios_cpp/test_scenarios_rust, andbumps the repo's minimum Bazel version.
What this PR does
.bazelversionfrom8.4.2to8.6.0score/test_scenarios_cpp/examples/basic.cpp, wired as a newcc_binarytarget (
:basic) inscore/test_scenarios_cpp/BUILD.score/test_scenarios_rust/examples/basic.rs, wired as a newrust_binarytarget (:basic) inscore/test_scenarios_rust/BUILD.Scenarios (version.parse,version.satisfies_minimum)grouped under a nested
versionScenarioGroup, demonstratingScenario/ScenarioGroupImpl/TestContext/run_cli_append to end.version.satisfies_minimumchecks its input against this repo's own real minimum Bazelversion (
8.6.0), so success/failure is a genuine, real consequence of the input rather thanscripted output.
examples/BUILDaliases both (//examples:cpp_basic,//examples:rust_basic) andexamples/README.mddocuments them, following the sameexamples/layout used bykyronandscore_orchestrator.Files
.bazelversion—8.4.2→8.6.0score/test_scenarios_cpp/examples/basic.cpp— new, C++ examplescore/test_scenarios_cpp/BUILD— adds thebasiccc_binarytargetscore/test_scenarios_rust/examples/basic.rs— new, Rust examplescore/test_scenarios_rust/BUILD— adds thebasicrust_binarytargetexamples/BUILD— new, root-level aliases (cpp_basic,rust_basic)examples/README.md— new, documents both examplesVerification
bazel build //.../bazel test //... --config=x86_64-linuxunder Bazel 8.6.0 — unaffected,still pass (10 targets, 2/2 tests)
bazel test --config=clang-tidy //score/test_scenarios_cpp:clang_tidy— passes (scopeunchanged; doesn't cover
examples/, same astests/)cargo clippy --locked --all-targets -- -D warningsat pinned1.92.0— clean, 0 warnings(covers the new Rust example via
--all-targets)ruff check . --exclude scripts/internal— all checks passedbazel test //:requirements_test— passes--list-scenarios,--name version.parse --input 8.6.0,--name version.satisfies_minimum --input 8.6.0(success),
--name version.satisfies_minimum --input 8.4.2(genuine failure, exit 1),--name version.parse --input garbage(genuine parse failure, exit 1) — identicaloutput/exit codes between C++ and Rust
Known limitations
check_direct_dependenciesnow warns (non-fatal) forbazel_skylib,rules_cc, andbuildifier_prebuilt, whose declared versions inMODULE.bazelare older than what'sactually resolved — pre-existing drift surfaced by Bazel 8.6's stricter checking, not
introduced by this change.
clang_tidy_test(that target'ssrcsonly include thetest_scenarios_cpplibrary, matching howtests/*.cppis already excluded).