Skip to content

Conversation

@pizzacat83
Copy link

Summary of the PR

Fixes #215

This PR fixes compilation failures when building with --no-default-features.

The benchmark modules were unconditionally importing from the configurator module, which is only available when any(feature = "elf", feature = "pe", feature = "bzimage").

This PR adds appropriate #[cfg(...)] guards to align the benchmark modules with the feature requirements of the code they use. When no features are enabled, the benchmark function falls back to no-op.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

The benches modules were unconditionally importing from the configurator
module, which is only available when at least one of the elf, pe, or
bzimage features is enabled. This caused compilation failures when
building with --no-default-features or other feature combinations that
don't enable any loader features.

Added appropriate #[cfg(any(feature = "..."))] guards to all benchmark
modules and a no-op fallback benchmark function for when no configurator
features are enabled.

Fixes rust-vmm#215

Signed-off-by: pizzacat83 <17941141+pizzacat83@users.noreply.github.com>
@rbradford
Copy link
Collaborator

Cool - can we add this to the CI configuration so that this doesn't regress?

Add --all-targets flag to all custom build test commands to ensure
benchmarks, tests, and examples are compiled in addition to the library.

Signed-off-by: pizzacat83 <17941141+pizzacat83@users.noreply.github.com>
@pizzacat83
Copy link
Author

Sure, I added --all-targets to all build commands in custom-tests.json.

Note that #213 (updating rust-vmm-ci) changes tests like build-gnu to run cargo all-features build --release --workspace --all-targets instead of cargo build --release. So this change to the CI configuration may overlap with #213.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make cargo all-features build --all --all-targets pass

2 participants