mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[spv-out] Add initial Rosetta test (#181)
* [spv-out] Add initial Rosetta test For now just check that spv-out succeeds * [spv-out] Check spv output has len > 0
This commit is contained in:
@@ -9,6 +9,9 @@ mod test_framework;
|
||||
#[cfg(test)]
|
||||
mod layout_tests;
|
||||
|
||||
#[cfg(all(test, feature = "deserialize"))]
|
||||
mod rosetta_tests;
|
||||
|
||||
pub use writer::Writer;
|
||||
|
||||
use spirv::*;
|
||||
|
||||
17
src/back/spv/rosetta_tests.rs
Normal file
17
src/back/spv/rosetta_tests.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use std::{fs, path::Path};
|
||||
|
||||
const TEST_PATH: &str = "test-data";
|
||||
|
||||
fn rosetta_test(file_name: &str) {
|
||||
let test_dir = Path::new(TEST_PATH);
|
||||
let input = fs::read_to_string(test_dir.join(file_name)).unwrap();
|
||||
let module: crate::Module = ron::de::from_str(&input).unwrap();
|
||||
|
||||
let spv = super::Writer::new(&module.header, super::WriterFlags::NONE).write(&module);
|
||||
assert!(spv.len() > 0, "spv.len() > 0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simple() {
|
||||
rosetta_test("simple/simple.expected.ron")
|
||||
}
|
||||
Reference in New Issue
Block a user