Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Print more info when a file can't be read
  • Loading branch information
bugadani committed Aug 14, 2024
commit 3ca404b8a28439e30db7cfc9d31b77f87ab85099
4 changes: 3 additions & 1 deletion .github/workflows/hil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
15 changes: 10 additions & 5 deletions xtask/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -151,7 +151,8 @@ pub fn load_examples(path: &Path) -> Result<Vec<Metadata>> {

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();
Expand Down Expand Up @@ -184,7 +185,7 @@ pub fn load_examples(path: &Path) -> Result<Vec<Metadata>> {
} else if key == "FEATURES" {
features = split.into();
} else {
log::warn!("Unregognized metadata key '{key}', ignoring");
log::warn!("Unrecognized metadata key '{key}', ignoring");
}
}

Expand Down Expand Up @@ -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::<toml_edit::DocumentMut>()?;

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

let manifest = fs::read_to_string(workspace.join(package.to_string()).join("Cargo.toml"))?;
let path = workspace.join(package.to_string()).join("Cargo.toml");
let path = windows_safe_path(&path);
let manifest =
fs::read_to_string(&path).with_context(|| format!("Could not read {}", path.display()))?;
let manifest: Manifest = basic_toml::from_str(&manifest)?;

Ok(manifest.package.version)
Expand Down