Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package-dir to "Could not find app" error #6694

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
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
12 changes: 7 additions & 5 deletions test/test-manager/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ fn find_app(
app.make_ascii_lowercase();

let current_dir = std::env::current_dir().expect("Unable to get current directory");
let packages_dir = package_dir.unwrap_or(&current_dir);
std::fs::create_dir_all(packages_dir)?;
let dir = std::fs::read_dir(packages_dir.clone()).context("Failed to list packages")?;
let package_dir = package_dir.unwrap_or(&current_dir);
std::fs::create_dir_all(package_dir)?;
let dir = std::fs::read_dir(package_dir.clone()).context("Failed to list packages")?;

dir
.filter_map(|entry| entry.ok())
Expand All @@ -129,12 +129,14 @@ fn find_app(
}) // Skip file if it doesn't match the architecture
.sorted_unstable_by_key(|(_path, u8_path)| u8_path.len())
.find(|(_path, u8_path)| u8_path.contains(&app)) // Find match
.map(|(path, _)| path).context(if e2e_bin {
.map(|(path, _)| path)
.with_context(|| format!("Directory searched: {}", package_dir.display()))
.with_context(|| if e2e_bin {
format!(
"Could not find UI/e2e test for package: {app}.\n\
Expecting a binary named like `app-e2e-tests-{app}_ARCH` to exist in {package_dir}/\n\
Example ARCH: `amd64-unknown-linux-gnu`, `x86_64-unknown-linux-gnu`",
package_dir = packages_dir.display()
package_dir = package_dir.display()
)
} else {
format!("Could not find package for app: {app}")
Expand Down
Loading