Skip to content

Commit

Permalink
fix: disable runtest_homebrew for lies
Browse files Browse the repository at this point in the history
hashes don't match github
  • Loading branch information
Gankra committed Mar 14, 2024
1 parent 80d426c commit 62c009c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cargo-dist/tests/gallery/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ impl Default for Tools {

pub struct DistResult {
test_name: String,
// Only used in some cfgs
trust_hashes: bool,
shell_installer_path: Option<Utf8PathBuf>,
homebrew_installer_path: Option<Utf8PathBuf>,
powershell_installer_path: Option<Utf8PathBuf>,
Expand Down Expand Up @@ -151,7 +153,7 @@ impl<'a> TestContext<'a, Tools> {
.arg("--output-format=json")
})?;

let build = self.load_dist_results(test_name)?;
let build = self.load_dist_results(test_name, false)?;

let raw_json = String::from_utf8(output.stdout).expect("plan wasn't utf8!?");
let plan = PlanResult {
Expand Down Expand Up @@ -197,7 +199,7 @@ impl<'a> TestContext<'a, Tools> {
.cargo_dist
.output_checked(|cmd| cmd.arg("dist").arg("build").arg("-aglobal"))?;

self.load_dist_results(test_name)
self.load_dist_results(test_name, true)
}

/// Run 'cargo dist generate' and return paths to various files that were generated
Expand Down Expand Up @@ -235,7 +237,7 @@ impl<'a> TestContext<'a, Tools> {
})
}

fn load_dist_results(&self, test_name: &str) -> Result<DistResult> {
fn load_dist_results(&self, test_name: &str, trust_hashes: bool) -> Result<DistResult> {
// read/analyze installers
eprintln!("loading results...");
let app_name = &self.repo.app_name;
Expand All @@ -248,6 +250,7 @@ impl<'a> TestContext<'a, Tools> {

Ok(DistResult {
test_name: test_name.to_owned(),
trust_hashes,
shell_installer_path: sh_installer.exists().then_some(sh_installer),
powershell_installer_path: ps_installer.exists().then_some(ps_installer),
homebrew_installer_path: homebrew_installer,
Expand Down Expand Up @@ -563,6 +566,11 @@ impl DistResult {
// Runs the installer script in the system's Homebrew installation
#[allow(unused_variables)]
pub fn runtest_homebrew_installer(&self, ctx: &TestContext<Tools>) -> Result<()> {
// Only do this if we trust hashes (outside cfg so the compiler knows we use this)
if !self.trust_hashes {
return Ok(());
}

// Only do this on macOS, and only do it if RUIN_MY_COMPUTER_WITH_INSTALLERS is set
#[cfg(target_os = "macos")]
if std::env::var(ENV_RUIN_ME)
Expand Down

0 comments on commit 62c009c

Please sign in to comment.