Skip to content

Commit 3ca404b

Browse files
committed
Print more info when a file can't be read
1 parent 7264c5f commit 3ca404b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/hil.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ jobs:
178178

179179
- name: Run Tests
180180
id: run-tests
181-
run: ./xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }}
181+
run: |
182+
export PATH=$PATH:/home/espressif/.cargo/bin
183+
./xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }}
182184
183185
- name: Erase Flash on Failure
184186
if: ${{ failure() && steps.run-tests.conclusion == 'failure' }}

xtask/src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
process::Command,
77
};
88

9-
use anyhow::{bail, Result};
9+
use anyhow::{bail, Context, Result};
1010
use cargo::CargoAction;
1111
use clap::ValueEnum;
1212
use esp_metadata::Chip;
@@ -151,7 +151,8 @@ pub fn load_examples(path: &Path) -> Result<Vec<Metadata>> {
151151

152152
for entry in fs::read_dir(path)? {
153153
let path = windows_safe_path(&entry?.path());
154-
let text = fs::read_to_string(&path)?;
154+
let text = fs::read_to_string(&path)
155+
.with_context(|| format!("Could not read {}", path.display()))?;
155156

156157
let mut chips = Vec::new();
157158
let mut features = Vec::new();
@@ -184,7 +185,7 @@ pub fn load_examples(path: &Path) -> Result<Vec<Metadata>> {
184185
} else if key == "FEATURES" {
185186
features = split.into();
186187
} else {
187-
log::warn!("Unregognized metadata key '{key}', ignoring");
188+
log::warn!("Unrecognized metadata key '{key}', ignoring");
188189
}
189190
}
190191

@@ -309,7 +310,8 @@ pub fn build_package(
309310
/// Bump the version of the specified package by the specified amount.
310311
pub fn bump_version(workspace: &Path, package: Package, amount: Version) -> Result<()> {
311312
let manifest_path = workspace.join(package.to_string()).join("Cargo.toml");
312-
let manifest = fs::read_to_string(&manifest_path)?;
313+
let manifest = fs::read_to_string(&manifest_path)
314+
.with_context(|| format!("Could not read {}", manifest_path.display()))?;
313315

314316
let mut manifest = manifest.parse::<toml_edit::DocumentMut>()?;
315317

@@ -528,7 +530,10 @@ pub fn package_version(workspace: &Path, package: Package) -> Result<semver::Ver
528530
version: semver::Version,
529531
}
530532

531-
let manifest = fs::read_to_string(workspace.join(package.to_string()).join("Cargo.toml"))?;
533+
let path = workspace.join(package.to_string()).join("Cargo.toml");
534+
let path = windows_safe_path(&path);
535+
let manifest =
536+
fs::read_to_string(&path).with_context(|| format!("Could not read {}", path.display()))?;
532537
let manifest: Manifest = basic_toml::from_str(&manifest)?;
533538

534539
Ok(manifest.package.version)

0 commit comments

Comments
 (0)