From 35bab9c9bbdd4b0d11d49d84e6abf462e0c09f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Wed, 14 Aug 2024 13:23:50 +0200 Subject: [PATCH] Print more info when a file can't be read --- .github/workflows/hil.yml | 4 +++- xtask/src/lib.rs | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hil.yml b/.github/workflows/hil.yml index 7d4be02d181..eee9adee822 100644 --- a/.github/workflows/hil.yml +++ b/.github/workflows/hil.yml @@ -178,7 +178,9 @@ jobs: - name: Run Tests id: run-tests - run: ./xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }} + run: | + export PATH=$PATH:/home/espressif/.cargo/bin + ./xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }} - name: Erase Flash on Failure if: ${{ failure() && steps.run-tests.conclusion == 'failure' }} diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index d738f836d57..ee2ec036df1 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -6,7 +6,7 @@ use std::{ process::Command, }; -use anyhow::{bail, Result}; +use anyhow::{bail, Context, Result}; use cargo::CargoAction; use clap::ValueEnum; use esp_metadata::Chip; @@ -151,7 +151,8 @@ pub fn load_examples(path: &Path) -> Result> { for entry in fs::read_dir(path)? { let path = windows_safe_path(&entry?.path()); - let text = fs::read_to_string(&path)?; + let text = fs::read_to_string(&path) + .with_context(|| format!("Could not read {}", path.display()))?; let mut chips = Vec::new(); let mut features = Vec::new(); @@ -184,7 +185,7 @@ pub fn load_examples(path: &Path) -> Result> { } else if key == "FEATURES" { features = split.into(); } else { - log::warn!("Unregognized metadata key '{key}', ignoring"); + log::warn!("Unrecognized metadata key '{key}', ignoring"); } } @@ -309,7 +310,8 @@ pub fn build_package( /// Bump the version of the specified package by the specified amount. pub fn bump_version(workspace: &Path, package: Package, amount: Version) -> Result<()> { let manifest_path = workspace.join(package.to_string()).join("Cargo.toml"); - let manifest = fs::read_to_string(&manifest_path)?; + let manifest = fs::read_to_string(&manifest_path) + .with_context(|| format!("Could not read {}", manifest_path.display()))?; let mut manifest = manifest.parse::()?; @@ -528,7 +530,10 @@ pub fn package_version(workspace: &Path, package: Package) -> Result