From 8ed3b25dbd54ca651ffacacd9acdbdb807438571 Mon Sep 17 00:00:00 2001 From: Stefan Kroboth Date: Thu, 18 Jan 2024 12:38:35 +0100 Subject: [PATCH] Fixed file checkpointing tests and added crate tests to CI --- .github/workflows/ci.yml | 9 +++++++++ argmin/src/core/executor.rs | 1 - checkpointing/file/Cargo.toml | 3 +++ checkpointing/file/checkpoints/solver.arg | Bin 0 -> 127 bytes checkpointing/file/src/lib.rs | 11 ++++------- 5 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 checkpointing/file/checkpoints/solver.arg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 206241cd2..1fbffb461 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,15 @@ jobs: - name: Test run: cargo test -p argmin-observer-paramwriter + tests-argmin-checkpointing-file: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: dtolnay/rust-toolchain@stable + - name: Test + run: cargo test -p argmin-checkpointing-file + tests-argmin-observer-spectator: runs-on: ubuntu-latest steps: diff --git a/argmin/src/core/executor.rs b/argmin/src/core/executor.rs index a796f2c4d..ee3b9ea91 100644 --- a/argmin/src/core/executor.rs +++ b/argmin/src/core/executor.rs @@ -570,7 +570,6 @@ mod tests { /// The solver's `init` should not be called when started from a checkpoint. /// See https://github.com/argmin-rs/argmin/issues/199. - // #[cfg(feature = "serde1")] #[test] #[cfg(feature = "serde1")] fn test_checkpointing_solver_initialization() { diff --git a/checkpointing/file/Cargo.toml b/checkpointing/file/Cargo.toml index 6f5c0d706..b94fab1d9 100644 --- a/checkpointing/file/Cargo.toml +++ b/checkpointing/file/Cargo.toml @@ -17,3 +17,6 @@ exclude = [] argmin = { version = "0.9.0", path = "../../argmin", default-features = false } bincode = "1.3.3" serde = "1.0.195" + +[dev-dependencies] +argmin = { version = "0.9.0", path = "../../argmin", features = ["serde1"] } diff --git a/checkpointing/file/checkpoints/solver.arg b/checkpointing/file/checkpoints/solver.arg new file mode 100644 index 0000000000000000000000000000000000000000..250f43e79a9a371172d04b5ba38296c0fb3a6d1a GIT binary patch literal 127 ncmZQ%Vn7BT?2&n3_J?|i5Kj6(h8DQMe<*+nFv1uh8pHtrwG|N9 literal 0 HcmV?d00001 diff --git a/checkpointing/file/src/lib.rs b/checkpointing/file/src/lib.rs index 5218910fd..fd064a9e4 100644 --- a/checkpointing/file/src/lib.rs +++ b/checkpointing/file/src/lib.rs @@ -32,7 +32,7 @@ impl Default for FileCheckpoint { /// # Example /// /// ``` - /// use argmin::core::checkpointing::FileCheckpoint; + /// use argmin_checkpointing_file::FileCheckpoint; /// # use argmin::core::checkpointing::CheckpointingFrequency; /// # use std::path::PathBuf; /// @@ -56,8 +56,7 @@ impl FileCheckpoint { /// # Example /// /// ``` - /// use argmin::core::checkpointing::CheckpointingFrequency; - /// use argmin_checkpointing_file::FileCheckpoint; + /// use argmin_checkpointing_file::{FileCheckpoint, CheckpointingFrequency}; /// # use std::path::PathBuf; /// /// let directory = "checkpoints"; @@ -93,8 +92,7 @@ where /// # Example /// /// ``` - /// use argmin::core::checkpointing::CheckpointingFrequency; - /// use argmin_checkpointing_file::FileCheckpoint; + /// use argmin_checkpointing_file::{FileCheckpoint, CheckpointingFrequency, Checkpoint}; /// /// # use std::fs::File; /// # use std::io::BufReader; @@ -129,8 +127,7 @@ where /// # Example /// /// ``` - /// use argmin::core::checkpointing::CheckpointingFrequency; - /// use argmin_checkpointing_file::FileCheckpoint + /// use argmin_checkpointing_file::{FileCheckpoint, CheckpointingFrequency, Checkpoint}; /// # use argmin::core::Error; /// /// # use std::fs::File;