From bb7b760706344504f7d1e84ddbea5c39442f727b Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Tue, 14 Mar 2023 15:11:22 +0100 Subject: [PATCH] integration-test-macros: Use absolute path to `IntegrationTest` Macros shouldn't require importing additional symbols which are used in their generated code. They should use the absolute paths instead. --- test/integration-test-macros/src/lib.rs | 2 +- test/integration-test/src/tests/elf.rs | 2 +- test/integration-test/src/tests/load.rs | 2 +- test/integration-test/src/tests/rbpf.rs | 2 +- test/integration-test/src/tests/relocations.rs | 2 +- test/integration-test/src/tests/smoke.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/integration-test-macros/src/lib.rs b/test/integration-test-macros/src/lib.rs index 6f69b486..837a7823 100644 --- a/test/integration-test-macros/src/lib.rs +++ b/test/integration-test-macros/src/lib.rs @@ -10,7 +10,7 @@ pub fn integration_test(_attr: TokenStream, item: TokenStream) -> TokenStream { let expanded = quote! { #item - inventory::submit!(IntegrationTest { + inventory::submit!(crate::tests::IntegrationTest { name: concat!(module_path!(), "::", #name_str), test_fn: #name, }); diff --git a/test/integration-test/src/tests/elf.rs b/test/integration-test/src/tests/elf.rs index 9522672d..60e9a2b7 100644 --- a/test/integration-test/src/tests/elf.rs +++ b/test/integration-test/src/tests/elf.rs @@ -1,4 +1,4 @@ -use super::{integration_test, IntegrationTest}; +use super::integration_test; use aya::include_bytes_aligned; use object::{Object, ObjectSymbol}; diff --git a/test/integration-test/src/tests/load.rs b/test/integration-test/src/tests/load.rs index 8bb9dd0e..e879bbb4 100644 --- a/test/integration-test/src/tests/load.rs +++ b/test/integration-test/src/tests/load.rs @@ -13,7 +13,7 @@ use log::warn; use crate::tests::kernel_version; -use super::{integration_test, IntegrationTest}; +use super::integration_test; const MAX_RETRIES: u32 = 100; const RETRY_DURATION_MS: u64 = 10; diff --git a/test/integration-test/src/tests/rbpf.rs b/test/integration-test/src/tests/rbpf.rs index 92dfac74..5bd61a14 100644 --- a/test/integration-test/src/tests/rbpf.rs +++ b/test/integration-test/src/tests/rbpf.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use aya::include_bytes_aligned; use aya_obj::{generated::bpf_insn, Object, ProgramSection}; -use super::{integration_test, IntegrationTest}; +use super::integration_test; #[integration_test] fn run_with_rbpf() { diff --git a/test/integration-test/src/tests/relocations.rs b/test/integration-test/src/tests/relocations.rs index 53de8b5d..85291ef4 100644 --- a/test/integration-test/src/tests/relocations.rs +++ b/test/integration-test/src/tests/relocations.rs @@ -4,7 +4,7 @@ use tempfile::TempDir; use aya::{maps::Array, programs::TracePoint, BpfLoader, Btf, Endianness}; -use super::{integration_test, IntegrationTest}; +use super::integration_test; // In the tests below we often use values like 0xAAAAAAAA or -0x7AAAAAAA. Those values have no // special meaning, they just have "nice" bit patterns that can be helpful while debugging. diff --git a/test/integration-test/src/tests/smoke.rs b/test/integration-test/src/tests/smoke.rs index a7450064..af6619d1 100644 --- a/test/integration-test/src/tests/smoke.rs +++ b/test/integration-test/src/tests/smoke.rs @@ -5,7 +5,7 @@ use aya::{ }; use log::info; -use super::{integration_test, kernel_version, IntegrationTest}; +use super::{integration_test, kernel_version}; #[integration_test] fn xdp() {