@@ -19,6 +19,21 @@ test_svd() {
1919 cargo check --manifest-path $td /Cargo.toml
2020}
2121
22+ test_svd_for_target () {
23+ curl -L --output $td /input.svd $2
24+
25+ # NOTE we care about errors in svd2rust, but not about errors / warnings in rustfmt
26+ local cwd=$( pwd)
27+ pushd $td
28+ RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target $1 -i input.svd
29+
30+ mv lib.rs src/lib.rs
31+
32+ popd
33+
34+ cargo check --manifest-path $td /Cargo.toml
35+ }
36+
2237main () {
2338 # Ensure that `cargo test` works to avoid surprising people, though it
2439 # doesn't help with our actual coverage.
@@ -423,52 +438,12 @@ main() {
423438 echo ' [dependencies.riscv-rt]' >> $td /Cargo.toml
424439 echo ' version = "0.6.0"' >> $td /Cargo.toml
425440
426- (
427- cd $td &&
428- curl -LO \
429- https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd
430- cd $td &&
431- curl -LO \
432- https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
433- cd $td &&
434- curl -LO \
435- https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd
436- )
437-
438- local cwd=$( pwd)
439-
440441 # Test MSP430
441- pushd $td
442-
443- RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target msp430 -i $td /msp430g2553.svd
444- mv $td /lib.rs $td /src/lib.rs
445- rustfmt $td /src/lib.rs || true
446-
447- popd
448-
449- cargo check --manifest-path $td /Cargo.toml
450-
451- # Test RISC-V FE310
452- pushd $td
453-
454- RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target riscv -i $td /e310x.svd
455- mv $td /lib.rs $td /src/lib.rs
456- rustfmt $td /src/lib.rs || true
457-
458- popd
459-
460- cargo check --manifest-path $td /Cargo.toml
461-
462- # Test RISC-V K210
463- pushd $td
464-
465- RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target riscv -i $td /k210.svd
466- mv $td /lib.rs $td /src/lib.rs
467- rustfmt $td /src/lib.rs || true
468-
469- popd
442+ test_svd_for_target msp430 https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd
470443
471- cargo check --manifest-path $td /Cargo.toml
444+ # Test RISC-V chips
445+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
446+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd
472447 ;;
473448
474449 Nordic)
0 commit comments