Skip to content

Commit

Permalink
fixup: Avoid host build of SBPF program test crates (anza-xyz#1711)
Browse files Browse the repository at this point in the history
In

  commit da6f7f2
  Author: Alexander Meißner <[email protected]>
  Date:   Tue Jun 18 23:10:40 2024 +0200

      Refactor - Avoid host build of SBPF program test crates (anza-xyz#1711)

we changed the test selection process slightly, switching from the
`test-bpf` feature to `sbf_rust` feature, and marking individual tests,
rather then the whole module.  The problem is that now when I run

    cd program/sbf
   ../../cargo check --bins --tests

I see unused warnings for all the modules imported by the `simulation`
and `sysvar` modules.  At the later are, effectively, empty when
`sbf_rust` is not set.

Moving the config flag back to the module level seems to do the intended
thing and removes the warnings.  Alternatively, we could mark the `use`
statement with an explicit `#[cfg(feature = "sbf_rust")]`, but it seems
that all the tests are designed to be run only when `sbf_rust` is set.
  • Loading branch information
ilya-bobyr committed Jul 16, 2024
1 parent ede4a1c commit e3c2b84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions programs/sbf/tests/simulation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "sbf_rust")]

use {
agave_validator::test_validator::*,
solana_runtime::{
Expand All @@ -17,7 +19,6 @@ use {
};

#[test]
#[cfg(feature = "sbf_rust")]
fn test_no_panic_banks_client() {
solana_logger::setup();

Expand Down Expand Up @@ -55,7 +56,6 @@ fn test_no_panic_banks_client() {
}

#[test]
#[cfg(feature = "sbf_rust")]
fn test_no_panic_rpc_client() {
solana_logger::setup();

Expand Down
3 changes: 2 additions & 1 deletion programs/sbf/tests/sysvar.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "sbf_rust")]

use {
solana_runtime::{
bank::Bank,
Expand All @@ -20,7 +22,6 @@ use {
};

#[test]
#[cfg(feature = "sbf_rust")]
fn test_sysvar_syscalls() {
solana_logger::setup();

Expand Down

0 comments on commit e3c2b84

Please sign in to comment.