From ad1205ce67d4c3416e1cabbf69422e8ed191c1f5 Mon Sep 17 00:00:00 2001 From: amy null Date: Tue, 2 Jul 2024 13:19:02 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20tests=20(mostly)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 22 ++++++++++++---------- Cargo.toml | 2 +- src/artifact/tarball.rs | 8 +++++++- src/util/mod.rs | 6 ++++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a8cfdf..b725c90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1200,9 +1200,9 @@ dependencies = [ [[package]] name = "flop" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2091b06ad394088b74fd28e3cb5a1ec6d0e6295b6046a7422a39db269a76f31" +checksum = "6c874a3d7091f873a1776dc18431569efe5fd6ccc9174538b4659cc04edae8bf" dependencies = [ "ar", "async-recursion", @@ -1221,7 +1221,7 @@ dependencies = [ "smoosh", "test-log", "tokio", - "tokio-tar-up2date", + "tokio-tar", "tracing", "tracing-subscriber", ] @@ -2537,9 +2537,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ "bitflags 1.3.2", ] @@ -3148,15 +3148,15 @@ dependencies = [ ] [[package]] -name = "tokio-tar-up2date" +name = "tokio-tar" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a369da119ec3d348f44e6cb191191872e1ce0eef282ac7c87f18d857a85dc2d5" +checksum = "9d5714c010ca3e5c27114c1cdeb9d14641ace49874aa5626d7149e47aedace75" dependencies = [ "filetime", "futures-core", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "tokio", "tokio-stream", "xattr", @@ -3676,11 +3676,13 @@ dependencies = [ [[package]] name = "xattr" -version = "0.2.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e77089b..3b3efe6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ ctor = "0.2.7" disk-drive = "0.1.10" eyre = "0.6.12" flail = "0.3.0" -flop = "0.2.4" +flop = "0.2.7" floppy-disk = "0.2.6" futures-util = "0.3.30" hyper = { version = "0.14.27", features = ["stream"] } diff --git a/src/artifact/tarball.rs b/src/artifact/tarball.rs index 7257495..b77a17e 100644 --- a/src/artifact/tarball.rs +++ b/src/artifact/tarball.rs @@ -8,6 +8,7 @@ use floppy_disk::tokio_fs::TokioFloppyDisk; use floppy_disk::FloppyDisk; use smoosh::CompressionType; use tokio::fs::File; +use tokio::fs::OpenOptions; use tracing::*; use crate::fs::MemFS; @@ -150,7 +151,12 @@ impl ArtifactProducer for TarballProducer { )); path }; - let mut compressed_tarball = File::open(&compressed_path).await?; + let mut compressed_tarball = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&compressed_path) + .await?; smoosh::recompress( &mut built_tarball, &mut compressed_tarball, diff --git a/src/util/mod.rs b/src/util/mod.rs index b61422e..f3d1192 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -28,8 +28,10 @@ pub fn test_init() { let subscriber = tracing_subscriber::FmtSubscriber::builder() .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .finish(); - tracing::subscriber::set_global_default(subscriber) - .expect("setting default subscriber failed"); + match tracing::subscriber::set_global_default(subscriber) { + Ok(_) => println!("set global tracing subscriber"), + Err(_) => println!("failed to set global tracing subscriber (already set?)"), + } }); }