Skip to content

Commit 7af0e8c

Browse files
committed
Added tests for ESP32
1 parent f560b3c commit 7af0e8c

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

ci/script.sh

100644100755
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,17 @@ main() {
692692
# OK
693693
test_svd M061
694694
;;
695+
696+
Espressif)
697+
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
698+
echo 'version = "0.2.0"' >> $td/Cargo.toml
699+
700+
echo '[dependencies.xtensa-lx6-rt]' >> $td/Cargo.toml
701+
echo 'git = "https://github.com/esp-rs/xtensa-lx6-rt.git"' >> $td/Cargo.toml
702+
703+
test_svd_for_target esp32 https://raw.githubusercontent.com/arjanmels/esp32/add-output-svd/svd/esp32.svd
704+
;;
705+
695706
esac
696707

697708
rm -rf $td

ci/svd2rust-regress/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ FLAGS:
6060
6161
OPTIONS:
6262
-a, --architecture <arch>
63-
Filter by architecture, case sensitive, may be combined with other filters Options are: "CortexM", "RiscV",
64-
and "Msp430"
63+
Filter by architecture, case sensitive, may be combined with other filters Options are: "CortexM", "RiscV", "Msp430" and "ESP32"
6564
-p, --svd2rust-path <bin_path>
6665
Path to an `svd2rust` binary, relative or absolute. Defaults to `target/release/svd2rust[.exe]` of this
6766
repository (which must be already built)

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ static CRATES_ALL: &[&str] = &["bare-metal = \"0.2.0\"", "vcell = \"0.1.0\""];
1010
static CRATES_MSP430: &[&str] = &["msp430 = \"0.1.0\""];
1111
static CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.5.0\"", "cortex-m-rt = \"0.5.0\""];
1212
static CRATES_RISCV: &[&str] = &["riscv = \"0.4.0\"", "riscv-rt = \"0.4.0\""];
13+
static CRATES_ESP32: &[&str] =
14+
&["xtensa-lx6-rt = {git=\"https://github.com/esp-rs/xtensa-lx6-rt\"}"];
1315
static PROFILE_ALL: &[&str] = &["[profile.dev]", "incremental = false"];
1416
static FEATURES_ALL: &[&str] = &["[features]"];
1517
static FEATURES_CORTEX_M: &[&str] =
@@ -133,6 +135,7 @@ pub fn test(
133135
CortexM => CRATES_CORTEX_M.iter(),
134136
RiscV => CRATES_RISCV.iter(),
135137
Msp430 => CRATES_MSP430.iter(),
138+
ESP32 => CRATES_ESP32.iter(),
136139
})
137140
.chain(PROFILE_ALL.iter())
138141
.chain(FEATURES_ALL.iter())
@@ -165,6 +168,7 @@ pub fn test(
165168
CortexM => "cortex-m",
166169
Msp430 => "msp430",
167170
RiscV => "riscv",
171+
ESP32 => "esp32",
168172
};
169173
let mut svd2rust_bin = Command::new(bin_path);
170174
if nightly {
@@ -180,14 +184,15 @@ pub fn test(
180184
output.capture_outputs(
181185
true,
182186
"svd2rust",
183-
Some(&lib_rs_file).filter(|_| (t.arch != CortexM) && (t.arch != Msp430)),
187+
Some(&lib_rs_file)
188+
.filter(|_| (t.arch != CortexM) && (t.arch != Msp430) && (t.arch != ESP32)),
184189
Some(&svd2rust_err_file),
185190
&[],
186191
)?;
187192
process_stderr_paths.push(svd2rust_err_file);
188193

189194
match t.arch {
190-
CortexM | Msp430 => {
195+
CortexM | Msp430 | ESP32 => {
191196
// TODO: Give error the path to stderr
192197
fs::rename(path_helper_base(&chip_dir, &["lib.rs"]), &lib_rs_file)
193198
.chain_err(|| "While moving lib.rs file")?

ci/svd2rust-regress/src/tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub enum Architecture {
77
CortexM,
88
Msp430,
99
RiscV,
10+
ESP32,
1011
}
1112

1213
#[derive(Debug)]
@@ -24,6 +25,7 @@ pub enum Manufacturer {
2425
Toshiba,
2526
SiFive,
2627
TexasInstruments,
28+
Espressif,
2729
}
2830

2931
#[derive(Debug)]
@@ -4226,4 +4228,14 @@ pub const TESTS: &[&TestCase] = &[
42264228
should_pass: true,
42274229
run_when: Always,
42284230
},
4231+
&TestCase {
4232+
arch: ESP32,
4233+
mfgr: Espressif,
4234+
chip: "esp32",
4235+
svd_url: Some(
4236+
"https://raw.githubusercontent.com/arjanmels/esp32/add-output-svd/svd/esp32.svd",
4237+
),
4238+
should_pass: true,
4239+
run_when: Always,
4240+
},
42294241
];

0 commit comments

Comments
 (0)