svd2utra: generate smaller compile tests for each peripheral

This commit is contained in:
eupn 2022-10-14 21:03:53 +04:00
parent f2ae008c25
commit 722e8a1187
No known key found for this signature in database
GPG key ID: 0BBE77FB42014014

View file

@ -900,16 +900,20 @@ fn print_tests<U: Write>(peripherals: &[Peripheral], out: &mut U) -> std::io::Re
let test_header = r####" let test_header = r####"
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test]
#[ignore]
fn compile_check() {
use super::*;
"#### "####
.as_bytes(); .as_bytes();
out.write_all(test_header)?; out.write_all(test_header)?;
for peripheral in peripherals { for peripheral in peripherals {
let mod_name = peripheral.name.to_lowercase(); let mod_name = peripheral.name.to_lowercase();
let per_name = peripheral.name.to_lowercase() + "_csr"; let per_name = peripheral.name.to_lowercase() + "_csr";
write!(out, r####"
#[test]
#[ignore]
fn compile_check_{}() {{
use super::*;"####, per_name)?;
writeln!( writeln!(
out, out,
" let mut {} = CSR::new(HW_{}_BASE as *mut u32);", " let mut {} = CSR::new(HW_{}_BASE as *mut u32);",
@ -958,9 +962,11 @@ mod tests {
)?; )?;
} }
} }
writeln!(out, " }}")?;
} }
writeln!(out, " }}")?;
writeln!(out, "}}")?; writeln!(out, "}}")?;
Ok(()) Ok(())
} }