Got deb tests passing

pull/1991/head
jLynx 8 months ago
parent 9c4f9d8ad6
commit 8f07405acb

@ -208,6 +208,7 @@ fn update_app() {
config.bundle.create_updater_artifacts, config.bundle.create_updater_artifacts,
Updater::String(V1Compatible::V1Compatible) Updater::String(V1Compatible::V1Compatible)
); );
println!("== IS v1_compatible: {}", v1_compatible);
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let bundle_targets = vec![BundleTarget::Deb, BundleTarget::AppImage]; let bundle_targets = vec![BundleTarget::Deb, BundleTarget::AppImage];
@ -215,6 +216,12 @@ fn update_app() {
let bundle_targets = vec![BundleTarget::default()]; let bundle_targets = vec![BundleTarget::default()];
for bundle_target in bundle_targets { for bundle_target in bundle_targets {
// Skip test for Linux .deb with v1 compatibility
#[cfg(target_os = "linux")]
if v1_compatible && bundle_target == BundleTarget::Deb {
println!("Skipping test for .deb with v1 compatibility mode");
continue;
}
// bundle app update // bundle app update
build_app(&manifest_dir, &config, true, bundle_target); build_app(&manifest_dir, &config, true, bundle_target);
@ -261,8 +268,12 @@ fn update_app() {
"target/debug/{}", "target/debug/{}",
out_updater_path.file_name().unwrap().to_str().unwrap() out_updater_path.file_name().unwrap().to_str().unwrap()
)); ));
// std::fs::rename(&out_updater_path, &updater_path) println!("Rename operation paths:");
// .expect("failed to rename bundle"); println!(" From: {}", out_updater_path.display());
println!(" To: {}", updater_path.display());
// Note, this may need to still be here, but also may need to move the sig too
std::fs::rename(&out_updater_path, &updater_path)
.expect("failed to rename bundle");
let target = target.clone(); let target = target.clone();
@ -328,21 +339,29 @@ fn update_app() {
// Set appropriate permissions and install package if needed // Set appropriate permissions and install package if needed
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
let bundle_path = &out_bundle_path; let initial_bundle_path = bundle_paths(&root_dir, "0.1.0")
.iter()
.find(|(t, _)| *t == bundle_target)
.map(|(_, path)| path.clone())
.unwrap();
if bundle_target == BundleTarget::AppImage { if bundle_target == BundleTarget::AppImage {
std::process::Command::new("sudo") std::process::Command::new("sudo")
.arg("chmod") .arg("chmod")
.arg("+x") .arg("+x")
.arg(bundle_path) .arg(initial_bundle_path)
.status() .status()
.expect("failed to change permissions"); .expect("failed to change permissions");
} else if bundle_target == BundleTarget::Deb { } else if bundle_target == BundleTarget::Deb {
println!(
"Installing Deb package from: {}",
initial_bundle_path.display()
);
// Install the .deb package // Install the .deb package
let install_status = std::process::Command::new("sudo") let install_status = std::process::Command::new("sudo")
.arg("dpkg") .arg("dpkg")
.arg("-i") .arg("-i")
.arg(bundle_path) .arg(initial_bundle_path)
.status() .status()
.expect("failed to install .deb package"); .expect("failed to install .deb package");
@ -382,6 +401,10 @@ fn update_app() {
} else { } else {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
println!(
"RUNNING LINUX BUILD - Expected exit code: {}",
expected_exit_code
);
let mut c = Command::new("sudo"); let mut c = Command::new("sudo");
if bundle_target == BundleTarget::Deb { if bundle_target == BundleTarget::Deb {
c.arg("/usr/bin/app-updater"); c.arg("/usr/bin/app-updater");
@ -406,6 +429,7 @@ fn update_app() {
"failed to run app, expected exit code {expected_exit_code}, got {code}" "failed to run app, expected exit code {expected_exit_code}, got {code}"
); );
} }
println!("===== CODE WAS SUCCESSFUL! {}", expected_exit_code);
#[cfg(windows)] #[cfg(windows)]
if code == UPDATED_EXIT_CODE { if code == UPDATED_EXIT_CODE {
// wait for the update to finish // wait for the update to finish

Loading…
Cancel
Save