From e3c2b84b1b953f86614963b7239ff3c372bbf18c Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 15 Jul 2024 23:10:37 -0700 Subject: [PATCH] fixup: Avoid host build of SBPF program test crates (#1711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit da6f7f2d317ed978701b08c3cc3e8d62756e565a Author: Alexander Meißner Date: Tue Jun 18 23:10:40 2024 +0200 Refactor - Avoid host build of SBPF program test crates (#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. --- programs/sbf/tests/simulation.rs | 4 ++-- programs/sbf/tests/sysvar.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/programs/sbf/tests/simulation.rs b/programs/sbf/tests/simulation.rs index 6b799c05690c0b..a1a9f6a6ce8ab0 100644 --- a/programs/sbf/tests/simulation.rs +++ b/programs/sbf/tests/simulation.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "sbf_rust")] + use { agave_validator::test_validator::*, solana_runtime::{ @@ -17,7 +19,6 @@ use { }; #[test] -#[cfg(feature = "sbf_rust")] fn test_no_panic_banks_client() { solana_logger::setup(); @@ -55,7 +56,6 @@ fn test_no_panic_banks_client() { } #[test] -#[cfg(feature = "sbf_rust")] fn test_no_panic_rpc_client() { solana_logger::setup(); diff --git a/programs/sbf/tests/sysvar.rs b/programs/sbf/tests/sysvar.rs index 4e9dcc566dde63..92213bb36d33bb 100644 --- a/programs/sbf/tests/sysvar.rs +++ b/programs/sbf/tests/sysvar.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "sbf_rust")] + use { solana_runtime::{ bank::Bank, @@ -20,7 +22,6 @@ use { }; #[test] -#[cfg(feature = "sbf_rust")] fn test_sysvar_syscalls() { solana_logger::setup();