Skip to content

Commit 65da1fd

Browse files
author
Jorge Aparicio
committed
test the generated code by compiling it
1 parent 89c716f commit 65da1fd

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

ci/run.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
set -ex
22

3-
gen() {
4-
cargo run --release -- -i /tmp/STM32F30x.svd $1 > /dev/null
3+
test_gen() {
4+
echo 'extern crate volatile_register;' > /tmp/foo/src/lib.rs
5+
cargo run --release -- -i /tmp/STM32F30x.svd $1 >> /tmp/foo/src/lib.rs
6+
cargo build --manifest-path /tmp/foo/Cargo.toml
57
}
68

79
main() {
810
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib/rustlib/${1}/lib
9-
echo $LD_LIBRARY_PATH
11+
export USER=rust
1012

1113
curl -L \
1214
https://raw.githubusercontent.com/posborne/cmsis-svd/master/data/STMicro/STM32F30x.svd \
1315
> /tmp/STM32F30x.svd
1416

17+
# test the library
1518
cargo build --release
1619

17-
gen
18-
gen dbgmcu
19-
gen gpioa
20-
gen i2c1
21-
gen rcc
22-
gen spi1
23-
gen tim6
20+
# test repository
21+
cargo new /tmp/foo
22+
echo 'volatile-register = "0.1.0"' >> /tmp/foo/Cargo.toml
23+
24+
# test generated code
25+
test_gen
26+
test_gen dbgmcu
27+
test_gen gpioa
28+
test_gen i2c1
29+
test_gen rcc
30+
test_gen spi1
31+
test_gen tim6
2432
}
2533

2634
main $1

0 commit comments

Comments
 (0)