Merge pull request #243 from eupn/svd2utra-generate-smaller-tests

svd2utra: generate smaller compile tests for each peripheral
This commit is contained in:
bunnie 2022-10-14 10:24:18 -07:00 committed by GitHub
commit f4eb0ac5b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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