Open
Description
There are lots of config knobs in bootstrap, and it is hard to understand how they interact. Consider two recent examples off the top of my head:
- Make the
c
feature forcompiler-builtins
an explicit opt-in #101833 (comment)- Broke the flag
is_rust_llvm
- Broke the flag
- bootstrap: Add llvm-has-rust-patches target option #101072 (comment)
- Implemented the aforementioned flag
- (Nearly) broke the flag
llvm_from_ci
- Caught in review by someone who knew the implementation details of that flag
We should really catch these issues in tests, not review, and avoid relying too much on specific reviewers who know parts of the code.
Since bootstrap does I/O and interacts with external tooling, it is inherently difficult to test. The strategy I know involves mocking out the build environment (enough to make tests run in <~1s). From there you can record what the implementation does and take two approaches for the test:
- Assert on specific conditions, like "the flag
-D FOO
was passed to LLVM cmake" or "foo/bar/baz was moved to foo/bar/quux". - Record everything in a golden file for some "representative" set of configurations. You can update these with
--bless
. This helps guard against unexpected behavior changes.
I think both are helpful. In fact, combining the two is exactly what we do in ui tests.