Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions rust/cargo_fuzztest/tests/e2e_cli_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ fn test_cargo_fuzztest_e2e_replay_corpus() {
expect_true!(output.status.success());
expect_true!(
stderr_str.contains(
"Replaying __fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 2s"
"Replaying sample_fuzz_crate.__fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 2s"
) || stdout_str.contains(
"Replaying __fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 2s"
"Replaying sample_fuzz_crate.__fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 2s"
)
);
}
Expand Down Expand Up @@ -384,9 +384,9 @@ fn test_cargo_fuzztest_e2e_replay_corpus_total_budget() {
expect_true!(output.status.success());
expect_true!(
stderr_str.contains(
"Replaying __fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 1.5s"
"Replaying sample_fuzz_crate.__fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 1.5s"
) || stdout_str.contains(
"Replaying __fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 1.5s"
"Replaying sample_fuzz_crate.__fuzztest_mod__sample_fuzztest_target.sample_fuzztest_target for 1.5s"
)
);
}
Expand Down
16 changes: 8 additions & 8 deletions rust/e2e_tests/standalone_mode_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ fn standalone_mode_replay_corpus_per_test_budget(fixture: &EnvVars) {
// Create corpus dirs for tests
let test1_dir = corpus_db
.join(identifier_relative)
.join("__fuzztest_mod__standalone_validation_test.standalone_validation_test")
.join("standalone_fuzz_tests_bin.__fuzztest_mod__standalone_validation_test.standalone_validation_test")
.join("coverage");
let test2_dir = corpus_db
.join(identifier_relative)
.join("__fuzztest_mod__second_validation_test.second_validation_test")
.join("standalone_fuzz_tests_bin.__fuzztest_mod__second_validation_test.second_validation_test")
.join("coverage");

std::fs::create_dir_all(&test1_dir).unwrap();
Expand Down Expand Up @@ -224,12 +224,12 @@ fn standalone_mode_replay_corpus_per_test_budget(fixture: &EnvVars) {
// Verify logs for per-test
expect_that!(
stderr_per_test,
matchers::contains_substring("Replaying __fuzztest_mod__standalone_validation_test.standalone_validation_test for 3s")
matchers::contains_substring("Replaying standalone_fuzz_tests_bin.__fuzztest_mod__standalone_validation_test.standalone_validation_test for 3s")
);
expect_that!(
stderr_per_test,
matchers::contains_substring(
"Replaying __fuzztest_mod__second_validation_test.second_validation_test for 3s"
"Replaying standalone_fuzz_tests_bin.__fuzztest_mod__second_validation_test.second_validation_test for 3s"
)
);

Expand Down Expand Up @@ -271,11 +271,11 @@ fn standalone_mode_replay_corpus_total_budget(fixture: &EnvVars) {
// Create corpus dirs for tests
let test1_dir = corpus_db
.join(identifier_relative)
.join("__fuzztest_mod__standalone_validation_test.standalone_validation_test")
.join("standalone_fuzz_tests_bin.__fuzztest_mod__standalone_validation_test.standalone_validation_test")
.join("coverage");
let test2_dir = corpus_db
.join(identifier_relative)
.join("__fuzztest_mod__second_validation_test.second_validation_test")
.join("standalone_fuzz_tests_bin.__fuzztest_mod__second_validation_test.second_validation_test")
.join("coverage");

std::fs::create_dir_all(&test1_dir).unwrap();
Expand Down Expand Up @@ -315,12 +315,12 @@ fn standalone_mode_replay_corpus_total_budget(fixture: &EnvVars) {
// Verify logs for total -> should be 1s
expect_that!(
stderr_total,
matchers::contains_substring("Replaying __fuzztest_mod__standalone_validation_test.standalone_validation_test for 1s")
matchers::contains_substring("Replaying standalone_fuzz_tests_bin.__fuzztest_mod__standalone_validation_test.standalone_validation_test for 1s")
);
expect_that!(
stderr_total,
matchers::contains_substring(
"Replaying __fuzztest_mod__second_validation_test.second_validation_test for 1s"
"Replaying standalone_fuzz_tests_bin.__fuzztest_mod__second_validation_test.second_validation_test for 1s"
)
);

Expand Down
4 changes: 2 additions & 2 deletions rust/e2e_tests/worker_with_centipede_sanitizer_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn ensure_use_after_free_signature_with_asan(fixture: &EnvVars) {
&format!("--binary={}", fixture.target_binary_path.display()),
&format!("--workdir={}", work_dir.display()),
"--exit_on_crash",
"--test_name=__fuzztest_mod__use_after_free_asan_death_test.use_after_free_asan_death_test",
"--test_name=fuzztest_main.__fuzztest_mod__use_after_free_asan_death_test.use_after_free_asan_death_test",
];

let stderr = test_utils::run_centipede_with_args_expect_termination(fixture, &args);
Expand Down Expand Up @@ -64,7 +64,7 @@ fn ensure_sanitizer_crash_signature_with_msan(fixture: &EnvVars) {
&format!("--binary={}", fixture.target_binary_path.display()),
&format!("--workdir={}", work_dir.display()),
"--exit_on_crash",
"--test_name=__fuzztest_mod__msan_death_test.msan_death_test",
"--test_name=fuzztest_main.__fuzztest_mod__msan_death_test.msan_death_test",
];

let stderr = test_utils::run_centipede_with_args_expect_termination(fixture, &args);
Expand Down
2 changes: 1 addition & 1 deletion rust/e2e_tests/worker_with_centipede_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn run_centipede_test<'a>(
rust_test_name
),
format!("--workdir={}", work_dir.display()),
format!("--test_name={}", test_name),
format!("--test_name=fuzztest_main.{}", test_name),
];
args.extend(extra_args.into_iter().map(|s| s.to_string()));

Expand Down
15 changes: 2 additions & 13 deletions rust/fuzztest_macro/src/helpers/test_registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,7 @@ impl<'a> FuzzTestRegistrationCtx<'a> {
let tokens = quote!(
#[::googletest::prelude::gtest]
fn #gtest_name() {
// Note: In this setup, `module_path!()` returns a path that starts with the crate name
// (e.g., `crate_name::module::path`). We want to strip this prefix to make the
// test name similar to standard `libtest` paths.
let full_test_name = concat!(module_path!(), "::", #test_fn_name);
let test_name = full_test_name
.split_once("::")
.expect("Crate name is always the first path segment")
.1;
let test_name = concat!(module_path!(), "::", #test_fn_name);
let manager = #crate_name::worker::RustFuzzTestAdapterManager {
test_name,
fuzz_test_factory: #fuzz_test_factory,
Expand Down Expand Up @@ -391,11 +384,7 @@ mod tests {
gtest_tokens.to_string(),
matchers::contains_substring(
quote! {
let full_test_name = concat!(module_path!(), "::", "test_fuzz");
let test_name = full_test_name
.split_once("::")
.expect("Crate name is always the first path segment")
.1;
let test_name = concat!(module_path!(), "::", "test_fuzz");
}
.to_string()
)
Expand Down
Loading
Loading