Skip to content

fixup: Avoid host build of SBPF program test crates (#1711)#2145

Merged
illia-bobyr merged 1 commit intoanza-xyz:masterfrom
illia-bobyr:pr/programs-sbf-no-unused-warnings-for-tests
Jul 16, 2024
Merged

fixup: Avoid host build of SBPF program test crates (#1711)#2145
illia-bobyr merged 1 commit intoanza-xyz:masterfrom
illia-bobyr:pr/programs-sbf-no-unused-warnings-for-tests

Conversation

@illia-bobyr
Copy link
Copy Markdown

Problem

In

commit da6f7f2
Author: Alexander Meißner AlexanderMeissner@gmx.net
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.

Summary of Changes

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.

In

  commit da6f7f2
  Author: Alexander Meißner <AlexanderMeissner@gmx.net>
  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.
@illia-bobyr illia-bobyr requested a review from Lichtso July 16, 2024 06:15
@illia-bobyr illia-bobyr merged commit 62a1827 into anza-xyz:master Jul 16, 2024
@illia-bobyr illia-bobyr deleted the pr/programs-sbf-no-unused-warnings-for-tests branch July 16, 2024 19:47
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.

2 participants