From 959322dc38d81a564ee9c869dfbf90a4411ff1b2 Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 26 Oct 2026 18:23:35 +0000 Subject: [PATCH] refactor(gpu): move loose test files to src/tests/ --- crates/gpu/src/lib.rs | 56 ------------------- crates/gpu/src/tests.rs | 30 ++++++++++ .../src/{tests_adjust.rs => tests/adjust.rs} | 0 .../src/{tests_adv3d.rs => tests/adv3d.rs} | 0 .../{tests_deferred.rs => tests/deferred.rs} | 0 .../deferred_jobs.rs} | 8 +-- .../{tests_fx_color.rs => tests/fx_color.rs} | 0 .../{tests_fx_depth.rs => tests/fx_depth.rs} | 0 .../fx_distort.rs} | 0 .../{tests_fx_extra.rs => tests/fx_extra.rs} | 0 .../{tests_fx_gen2.rs => tests/fx_gen2.rs} | 2 +- .../fx_generate.rs} | 0 .../src/{tests_fx_key.rs => tests/fx_key.rs} | 0 .../{tests_fx_light.rs => tests/fx_light.rs} | 0 .../src/{tests_fx_lut.rs => tests/fx_lut.rs} | 0 .../{tests_fx_noise.rs => tests/fx_noise.rs} | 0 .../fx_particles.rs} | 2 +- .../fx_pixel2.rs} | 0 .../src/{tests_fx_sim.rs => tests/fx_sim.rs} | 0 .../fx_stylize.rs} | 0 .../{tests_fx_text.rs => tests/fx_text.rs} | 0 .../{tests_fx_time.rs => tests/fx_time.rs} | 0 .../{tests_fx_tone.rs => tests/fx_tone.rs} | 0 .../fx_transition.rs} | 0 .../src/{tests_fx_vr.rs => tests/fx_vr.rs} | 0 .../{tests_fx_warp.rs => tests/fx_warp.rs} | 0 .../gpu/src/{tests_init.rs => tests/init.rs} | 0 .../particles.rs} | 0 .../gpu/src/{tests_3d.rs => tests/three_d.rs} | 0 .../wgsl_grammar.rs} | 0 30 files changed, 36 insertions(+), 62 deletions(-) rename crates/gpu/src/{tests_adjust.rs => tests/adjust.rs} (100%) rename crates/gpu/src/{tests_adv3d.rs => tests/adv3d.rs} (100%) rename crates/gpu/src/{tests_deferred.rs => tests/deferred.rs} (100%) rename crates/gpu/src/{tests_deferred_jobs.rs => tests/deferred_jobs.rs} (95%) rename crates/gpu/src/{tests_fx_color.rs => tests/fx_color.rs} (100%) rename crates/gpu/src/{tests_fx_depth.rs => tests/fx_depth.rs} (100%) rename crates/gpu/src/{tests_fx_distort.rs => tests/fx_distort.rs} (100%) rename crates/gpu/src/{tests_fx_extra.rs => tests/fx_extra.rs} (100%) rename crates/gpu/src/{tests_fx_gen2.rs => tests/fx_gen2.rs} (99%) rename crates/gpu/src/{tests_fx_generate.rs => tests/fx_generate.rs} (100%) rename crates/gpu/src/{tests_fx_key.rs => tests/fx_key.rs} (100%) rename crates/gpu/src/{tests_fx_light.rs => tests/fx_light.rs} (100%) rename crates/gpu/src/{tests_fx_lut.rs => tests/fx_lut.rs} (100%) rename crates/gpu/src/{tests_fx_noise.rs => tests/fx_noise.rs} (100%) rename crates/gpu/src/{tests_fx_particles.rs => tests/fx_particles.rs} (99%) rename crates/gpu/src/{tests_fx_pixel2.rs => tests/fx_pixel2.rs} (100%) rename crates/gpu/src/{tests_fx_sim.rs => tests/fx_sim.rs} (100%) rename crates/gpu/src/{tests_fx_stylize.rs => tests/fx_stylize.rs} (100%) rename crates/gpu/src/{tests_fx_text.rs => tests/fx_text.rs} (100%) rename crates/gpu/src/{tests_fx_time.rs => tests/fx_time.rs} (100%) rename crates/gpu/src/{tests_fx_tone.rs => tests/fx_tone.rs} (100%) rename crates/gpu/src/{tests_fx_transition.rs => tests/fx_transition.rs} (100%) rename crates/gpu/src/{tests_fx_vr.rs => tests/fx_vr.rs} (100%) rename crates/gpu/src/{tests_fx_warp.rs => tests/fx_warp.rs} (100%) rename crates/gpu/src/{tests_init.rs => tests/init.rs} (100%) rename crates/gpu/src/{tests_particles.rs => tests/particles.rs} (100%) rename crates/gpu/src/{tests_3d.rs => tests/three_d.rs} (100%) rename crates/gpu/src/{tests_wgsl_grammar.rs => tests/wgsl_grammar.rs} (100%) diff --git a/crates/gpu/src/lib.rs b/crates/gpu/src/lib.rs index 1064a216..d0407bee 100644 --- a/crates/gpu/src/lib.rs +++ b/crates/gpu/src/lib.rs @@ -407,59 +407,3 @@ impl effectcraft_effects::psim::ParticleSim for Gpu { #[cfg(test)] mod tests; -#[cfg(test)] -mod tests_3d; -#[cfg(test)] -mod tests_adjust; -#[cfg(test)] -mod tests_adv3d; -#[cfg(test)] -mod tests_deferred; -#[cfg(test)] -mod tests_deferred_jobs; -#[cfg(test)] -mod tests_fx_color; -#[cfg(test)] -mod tests_fx_depth; -#[cfg(test)] -mod tests_fx_distort; -#[cfg(test)] -mod tests_fx_extra; -#[cfg(test)] -mod tests_fx_gen2; -#[cfg(test)] -mod tests_fx_generate; -#[cfg(test)] -mod tests_fx_key; -#[cfg(test)] -mod tests_fx_light; -#[cfg(test)] -mod tests_fx_lut; -#[cfg(test)] -mod tests_fx_noise; -#[cfg(test)] -mod tests_fx_particles; -#[cfg(test)] -mod tests_fx_pixel2; -#[cfg(test)] -mod tests_fx_sim; -#[cfg(test)] -mod tests_fx_stylize; -#[cfg(test)] -mod tests_fx_text; -#[cfg(test)] -mod tests_fx_time; -#[cfg(test)] -mod tests_fx_tone; -#[cfg(test)] -mod tests_fx_transition; -#[cfg(test)] -mod tests_fx_vr; -#[cfg(test)] -mod tests_fx_warp; -#[cfg(all(test, not(target_arch = "wasm32")))] -mod tests_init; -#[cfg(test)] -mod tests_particles; -#[cfg(test)] -mod tests_wgsl_grammar; diff --git a/crates/gpu/src/tests.rs b/crates/gpu/src/tests.rs index 6c7b3ffb..e1221941 100644 --- a/crates/gpu/src/tests.rs +++ b/crates/gpu/src/tests.rs @@ -26,6 +26,36 @@ use effectcraft_time::{FrameRate, Tick}; use crate::Gpu; +mod three_d; +mod adjust; +mod adv3d; +mod deferred; +mod deferred_jobs; +mod fx_color; +mod fx_depth; +mod fx_distort; +mod fx_extra; +mod fx_gen2; +mod fx_generate; +mod fx_key; +mod fx_light; +mod fx_lut; +mod fx_noise; +mod fx_particles; +mod fx_pixel2; +mod fx_sim; +mod fx_stylize; +mod fx_text; +mod fx_time; +mod fx_tone; +mod fx_transition; +mod fx_vr; +mod fx_warp; +#[cfg(all(test, not(target_arch = "wasm32")))] +mod init; +mod particles; +mod wgsl_grammar; + /// One GPU test at a time in this process: the calling test thread holds a process-wide lock /// until it exits (libtest runs every test on a thread of its own). wgpu's OpenGL backend (Mesa /// llvmpipe on FreeBSD, Linux without Vulkan) has one context lock per adapter and panics when a diff --git a/crates/gpu/src/tests_adjust.rs b/crates/gpu/src/tests/adjust.rs similarity index 100% rename from crates/gpu/src/tests_adjust.rs rename to crates/gpu/src/tests/adjust.rs diff --git a/crates/gpu/src/tests_adv3d.rs b/crates/gpu/src/tests/adv3d.rs similarity index 100% rename from crates/gpu/src/tests_adv3d.rs rename to crates/gpu/src/tests/adv3d.rs diff --git a/crates/gpu/src/tests_deferred.rs b/crates/gpu/src/tests/deferred.rs similarity index 100% rename from crates/gpu/src/tests_deferred.rs rename to crates/gpu/src/tests/deferred.rs diff --git a/crates/gpu/src/tests_deferred_jobs.rs b/crates/gpu/src/tests/deferred_jobs.rs similarity index 95% rename from crates/gpu/src/tests_deferred_jobs.rs rename to crates/gpu/src/tests/deferred_jobs.rs index 7f10f53d..aa885b1d 100644 --- a/crates/gpu/src/tests_deferred_jobs.rs +++ b/crates/gpu/src/tests/deferred_jobs.rs @@ -9,9 +9,9 @@ use effectcraft_render::{Accelerator, Backend, LayerCache, NoFootage, RenderOpts use effectcraft_time::Tick; use crate::tests::{Pattern, diff, n, tolerance}; -use crate::tests_adv3d::{off_share, run_of, scene, scene_project}; -use crate::tests_deferred::{deferred_gpu, render_passes}; -use crate::tests_particles::{Host, agree, params}; +use crate::tests::adv3d::{off_share, run_of, scene, scene_project}; +use crate::tests::deferred::{deferred_gpu, render_passes}; +use crate::tests::particles::{Host, agree, params}; /// The device's readbacks have landed (the browser's event loop; natively a poll). fn settle(g: &crate::Gpu) { @@ -87,7 +87,7 @@ fn advanced_3d_resolves_in_passes() { #[test] fn job_frames_render_in_passes() { let Some((g, _lock)) = deferred_gpu() else { return }; - let s = crate::tests_deferred::scene(); + let s = crate::tests::deferred::scene(); let t = Tick::from_seconds_f64(0.5); let cache = LayerCache::default(); cache.set_gate(g.miss_gate()); diff --git a/crates/gpu/src/tests_fx_color.rs b/crates/gpu/src/tests/fx_color.rs similarity index 100% rename from crates/gpu/src/tests_fx_color.rs rename to crates/gpu/src/tests/fx_color.rs diff --git a/crates/gpu/src/tests_fx_depth.rs b/crates/gpu/src/tests/fx_depth.rs similarity index 100% rename from crates/gpu/src/tests_fx_depth.rs rename to crates/gpu/src/tests/fx_depth.rs diff --git a/crates/gpu/src/tests_fx_distort.rs b/crates/gpu/src/tests/fx_distort.rs similarity index 100% rename from crates/gpu/src/tests_fx_distort.rs rename to crates/gpu/src/tests/fx_distort.rs diff --git a/crates/gpu/src/tests_fx_extra.rs b/crates/gpu/src/tests/fx_extra.rs similarity index 100% rename from crates/gpu/src/tests_fx_extra.rs rename to crates/gpu/src/tests/fx_extra.rs diff --git a/crates/gpu/src/tests_fx_gen2.rs b/crates/gpu/src/tests/fx_gen2.rs similarity index 99% rename from crates/gpu/src/tests_fx_gen2.rs rename to crates/gpu/src/tests/fx_gen2.rs index 8eba75c8..c82aba8d 100644 --- a/crates/gpu/src/tests_fx_gen2.rs +++ b/crates/gpu/src/tests/fx_gen2.rs @@ -8,7 +8,7 @@ use effectcraft_keyframe::Value; use effectcraft_time::Tick; use crate::tests::{c, n}; -use crate::tests_fx_pixel2::{e, env_case, env_case_allow, env_case_at, off, on, pt}; +use crate::tests::fx_pixel2::{e, env_case, env_case_allow, env_case_at, off, on, pt}; fn layer(id: u64) -> Value { Value::Layer(Some(id)) diff --git a/crates/gpu/src/tests_fx_generate.rs b/crates/gpu/src/tests/fx_generate.rs similarity index 100% rename from crates/gpu/src/tests_fx_generate.rs rename to crates/gpu/src/tests/fx_generate.rs diff --git a/crates/gpu/src/tests_fx_key.rs b/crates/gpu/src/tests/fx_key.rs similarity index 100% rename from crates/gpu/src/tests_fx_key.rs rename to crates/gpu/src/tests/fx_key.rs diff --git a/crates/gpu/src/tests_fx_light.rs b/crates/gpu/src/tests/fx_light.rs similarity index 100% rename from crates/gpu/src/tests_fx_light.rs rename to crates/gpu/src/tests/fx_light.rs diff --git a/crates/gpu/src/tests_fx_lut.rs b/crates/gpu/src/tests/fx_lut.rs similarity index 100% rename from crates/gpu/src/tests_fx_lut.rs rename to crates/gpu/src/tests/fx_lut.rs diff --git a/crates/gpu/src/tests_fx_noise.rs b/crates/gpu/src/tests/fx_noise.rs similarity index 100% rename from crates/gpu/src/tests_fx_noise.rs rename to crates/gpu/src/tests/fx_noise.rs diff --git a/crates/gpu/src/tests_fx_particles.rs b/crates/gpu/src/tests/fx_particles.rs similarity index 99% rename from crates/gpu/src/tests_fx_particles.rs rename to crates/gpu/src/tests/fx_particles.rs index b67df9a4..139363b7 100644 --- a/crates/gpu/src/tests_fx_particles.rs +++ b/crates/gpu/src/tests/fx_particles.rs @@ -8,7 +8,7 @@ use effectcraft_render::RenderOpts; use effectcraft_time::Tick; use crate::tests::{Scene, check, compare_at, n, opts, set}; -use crate::tests_fx_sim::{case, composited, e, off, on}; +use crate::tests::fx_sim::{case, composited, e, off, on}; fn v2(x: f64, y: f64) -> Value { Value::Vec2([x, y]) diff --git a/crates/gpu/src/tests_fx_pixel2.rs b/crates/gpu/src/tests/fx_pixel2.rs similarity index 100% rename from crates/gpu/src/tests_fx_pixel2.rs rename to crates/gpu/src/tests/fx_pixel2.rs diff --git a/crates/gpu/src/tests_fx_sim.rs b/crates/gpu/src/tests/fx_sim.rs similarity index 100% rename from crates/gpu/src/tests_fx_sim.rs rename to crates/gpu/src/tests/fx_sim.rs diff --git a/crates/gpu/src/tests_fx_stylize.rs b/crates/gpu/src/tests/fx_stylize.rs similarity index 100% rename from crates/gpu/src/tests_fx_stylize.rs rename to crates/gpu/src/tests/fx_stylize.rs diff --git a/crates/gpu/src/tests_fx_text.rs b/crates/gpu/src/tests/fx_text.rs similarity index 100% rename from crates/gpu/src/tests_fx_text.rs rename to crates/gpu/src/tests/fx_text.rs diff --git a/crates/gpu/src/tests_fx_time.rs b/crates/gpu/src/tests/fx_time.rs similarity index 100% rename from crates/gpu/src/tests_fx_time.rs rename to crates/gpu/src/tests/fx_time.rs diff --git a/crates/gpu/src/tests_fx_tone.rs b/crates/gpu/src/tests/fx_tone.rs similarity index 100% rename from crates/gpu/src/tests_fx_tone.rs rename to crates/gpu/src/tests/fx_tone.rs diff --git a/crates/gpu/src/tests_fx_transition.rs b/crates/gpu/src/tests/fx_transition.rs similarity index 100% rename from crates/gpu/src/tests_fx_transition.rs rename to crates/gpu/src/tests/fx_transition.rs diff --git a/crates/gpu/src/tests_fx_vr.rs b/crates/gpu/src/tests/fx_vr.rs similarity index 100% rename from crates/gpu/src/tests_fx_vr.rs rename to crates/gpu/src/tests/fx_vr.rs diff --git a/crates/gpu/src/tests_fx_warp.rs b/crates/gpu/src/tests/fx_warp.rs similarity index 100% rename from crates/gpu/src/tests_fx_warp.rs rename to crates/gpu/src/tests/fx_warp.rs diff --git a/crates/gpu/src/tests_init.rs b/crates/gpu/src/tests/init.rs similarity index 100% rename from crates/gpu/src/tests_init.rs rename to crates/gpu/src/tests/init.rs diff --git a/crates/gpu/src/tests_particles.rs b/crates/gpu/src/tests/particles.rs similarity index 100% rename from crates/gpu/src/tests_particles.rs rename to crates/gpu/src/tests/particles.rs diff --git a/crates/gpu/src/tests_3d.rs b/crates/gpu/src/tests/three_d.rs similarity index 100% rename from crates/gpu/src/tests_3d.rs rename to crates/gpu/src/tests/three_d.rs diff --git a/crates/gpu/src/tests_wgsl_grammar.rs b/crates/gpu/src/tests/wgsl_grammar.rs similarity index 100% rename from crates/gpu/src/tests_wgsl_grammar.rs rename to crates/gpu/src/tests/wgsl_grammar.rs