From 2eec55d84fc8f087ec1bd1e4b66ad436d7ad8b99 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 15:31:47 -0600 Subject: [PATCH 01/16] fwd compat from 0.4.4 integration test --- .github/workflows/test.yml | 7 + crates/lair_keystore/tests/integration.rs | 6 + .../lair_keystore/tests/{ => tests}/common.rs | 0 .../tests/tests/fwd_compat_0_4_4.rs | 221 ++++++++++++++++++ .../tests/{ => tests}/migrate_unencrypted.rs | 4 +- .../tests/{ => tests}/server_test.rs | 4 +- 6 files changed, 236 insertions(+), 6 deletions(-) create mode 100644 crates/lair_keystore/tests/integration.rs rename crates/lair_keystore/tests/{ => tests}/common.rs (100%) create mode 100644 crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs rename crates/lair_keystore/tests/{ => tests}/migrate_unencrypted.rs (95%) rename crates/lair_keystore/tests/{ => tests}/server_test.rs (99%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f75341..3624fe0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,13 @@ jobs: manifest-dir: ${{ github.workspace }}/.github/manifest github-binarycache: true + - name: Install lair-keystore-0.4.4 for fwd compat test + run: | + cargo install names + which names + cargo install --root . lair-keystore@0.4.4 + mv ./bin/lair-keystore .cargo/bin/lair-keystore-0.4.4 + - name: Make Test Windows if: matrix.os == 'windows-latest' run: |- diff --git a/crates/lair_keystore/tests/integration.rs b/crates/lair_keystore/tests/integration.rs new file mode 100644 index 0000000..8cb1237 --- /dev/null +++ b/crates/lair_keystore/tests/integration.rs @@ -0,0 +1,6 @@ +mod tests { + mod common; + mod fwd_compat_0_4_4; + mod migrate_unencrypted; + mod server_test; +} diff --git a/crates/lair_keystore/tests/common.rs b/crates/lair_keystore/tests/tests/common.rs similarity index 100% rename from crates/lair_keystore/tests/common.rs rename to crates/lair_keystore/tests/tests/common.rs diff --git a/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs b/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs new file mode 100644 index 0000000..5800d4d --- /dev/null +++ b/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs @@ -0,0 +1,221 @@ +use lair_keystore::dependencies::*; +use lair_keystore_api::prelude::*; +use std::sync::Arc; +use tokio::io::{AsyncBufReadExt, AsyncWriteExt}; + +#[cfg(not(windows))] +const NAME: &str = "lair-keystore-0.4.4"; + +#[cfg(windows)] +const NAME: &str = "lair-keystore-0.4.4.exe"; + +const PASSPHRASE: &[u8] = b"passphrase"; + +const TAG1: &str = "TAG1"; +const TAG2: &str = "TAG2"; + +#[tokio::test(flavor = "multi_thread")] +async fn fwd_compat_0_4_4() { + let tmpdir = tempdir::TempDir::new("lair_fwd_044").unwrap(); + + println!("{tmpdir:?}"); + + // -- make sure we have the correct 0.4.4 version avaliable -- // + + let mut cmd = tokio::process::Command::new(NAME); + + cmd.arg("--version"); + + eprintln!("{cmd:?}"); + + let ver = cmd + .output() + .await + .expect("please ensure above command is on the PATH"); + + assert!(ver.status.success()); + assert_eq!(b"lair_keystore 0.4.4\n", ver.stdout.as_slice()); + + // -- initialize the 0.4.4 keystore -- // + + let mut cmd = tokio::process::Command::new(NAME); + + cmd.arg("--lair-root") + .arg(tmpdir.path()) + .arg("init") + .arg("--piped") + .stdin(std::process::Stdio::piped()); + + eprintln!("{cmd:?}"); + + let mut init = cmd.spawn().unwrap(); + let mut stdin = init.stdin.take().unwrap(); + stdin.write_all(PASSPHRASE).await.unwrap(); + stdin.shutdown().await.unwrap(); + drop(stdin); + + let init = init.wait_with_output().await.unwrap(); + + assert!(init.status.success()); + println!("{}", String::from_utf8_lossy(init.stdout.as_slice())); + + // -- fetch the connection string -- // + + let mut cmd = tokio::process::Command::new(NAME); + + cmd.arg("--lair-root").arg(tmpdir.path()).arg("url"); + + eprintln!("{cmd:?}"); + + let s_url = cmd + .output() + .await + .expect("please ensure above command is on the PATH"); + + assert!(s_url.status.success()); + let s_url = String::from_utf8_lossy(s_url.stdout.as_slice()).to_string(); + let s_url = url::Url::parse(&s_url).unwrap(); + + println!("s_url: {s_url}"); + + // -- run the actual server -- // + + let mut cmd = tokio::process::Command::new(NAME); + + cmd.arg("--lair-root") + .arg(tmpdir.path()) + .arg("server") + .arg("--piped") + .stdin(std::process::Stdio::piped()) + .stdout(std::process::Stdio::piped()); + + eprintln!("{cmd:?}"); + + let mut server = cmd.spawn().unwrap(); + let mut stdin = server.stdin.take().unwrap(); + stdin.write_all(PASSPHRASE).await.unwrap(); + stdin.shutdown().await.unwrap(); + drop(stdin); + + let mut server_lines = + tokio::io::BufReader::new(server.stdout.take().unwrap()).lines(); + + tokio::time::timeout(std::time::Duration::from_secs(10), async { + loop { + let line = server_lines.next_line().await.unwrap().unwrap(); + println!("-:=:- {line}"); + if line.contains("lair-keystore running") { + break; + } + } + }) + .await + .unwrap(); + + // -- connect a client and insert data into the store -- // + + let client044 = lair_keystore_api::ipc_keystore::ipc_keystore_connect( + s_url.clone(), + PASSPHRASE, + ) + .await + .unwrap(); + + let _seed_info_ref = + client044.new_seed(TAG1.into(), None, true).await.unwrap(); + + let _wka_cert = client044.new_wka_tls_cert(TAG2.into()).await.unwrap(); + + // -- shut down the 044 client and server -- // + + client044.shutdown().await.unwrap(); + drop(client044); + server.kill().await.unwrap(); + drop(server); + + // -- run the new server using the 044 store -- // + + let mut config_path = tmpdir.path().to_owned(); + config_path.push("lair-keystore-config.yaml"); + let config = tokio::fs::read(&config_path).await.unwrap(); + + println!("{}", String::from_utf8_lossy(&config)); + + let config = LairServerConfigInner::from_bytes(&config).unwrap(); + + lair_keystore::server::StandaloneServer::new(Arc::new(config)) + .await + .unwrap() + .run(PASSPHRASE) + .await + .unwrap(); + + // -- connect a client to the new server and check functionality -- // + + let client = lair_keystore_api::ipc_keystore::ipc_keystore_connect( + s_url.clone(), + PASSPHRASE, + ) + .await + .unwrap(); + + let entry_list = client.list_entries().await.unwrap(); + + assert_eq!(2, entry_list.len()); + + for entry in entry_list { + match entry { + LairEntryInfo::Seed { tag, .. } => { + assert_eq!(TAG1, &*tag); + } + LairEntryInfo::WkaTlsCert { tag, .. } => { + assert_eq!(TAG2, &*tag); + } + oth => panic!("unexpected: {:?}", oth), + } + } + + let entry = match client.get_entry(TAG1.into()).await.unwrap() { + LairEntryInfo::Seed { seed_info, .. } => seed_info, + _ => panic!(), + }; + + let sig = client + .sign_by_pub_key( + entry.ed25519_pub_key.clone(), + None, + b"hello".to_vec().into(), + ) + .await + .unwrap(); + assert!(entry + .ed25519_pub_key + .verify_detached(sig, &b"hello"[..]) + .await + .unwrap()); + + // secretbox encrypt some data + let (nonce, cipher) = client + .secretbox_xsalsa_by_tag(TAG1.into(), None, b"hello".to_vec().into()) + .await + .unwrap(); + + // make sure we can decrypt our own message + let msg = client + .secretbox_xsalsa_open_by_tag(TAG1.into(), None, nonce, cipher) + .await + .unwrap(); + + assert_eq!(b"hello", &*msg); + + // try exporting the seed (just to ourselves) + let _ = client + .export_seed_by_tag( + TAG1.into(), + entry.x25519_pub_key.clone(), + entry.x25519_pub_key.clone(), + None, + ) + .await + .unwrap(); +} diff --git a/crates/lair_keystore/tests/migrate_unencrypted.rs b/crates/lair_keystore/tests/tests/migrate_unencrypted.rs similarity index 95% rename from crates/lair_keystore/tests/migrate_unencrypted.rs rename to crates/lair_keystore/tests/tests/migrate_unencrypted.rs index 6735f65..7ed5040 100644 --- a/crates/lair_keystore/tests/migrate_unencrypted.rs +++ b/crates/lair_keystore/tests/tests/migrate_unencrypted.rs @@ -1,8 +1,6 @@ -use common::{connect_with_config, create_config}; +use super::common::{connect_with_config, create_config}; use lair_keystore_api::dependencies::{sodoken, tokio}; -mod common; - #[cfg(not(windows))] // No encryption on Windows, ignore this test #[tokio::test(flavor = "multi_thread")] async fn migrate_unencrypted() { diff --git a/crates/lair_keystore/tests/server_test.rs b/crates/lair_keystore/tests/tests/server_test.rs similarity index 99% rename from crates/lair_keystore/tests/server_test.rs rename to crates/lair_keystore/tests/tests/server_test.rs index bae44f9..ff8c9d9 100644 --- a/crates/lair_keystore/tests/server_test.rs +++ b/crates/lair_keystore/tests/tests/server_test.rs @@ -1,9 +1,7 @@ -use common::connect; +use super::common::connect; use lair_keystore::dependencies::*; use lair_keystore_api::prelude::*; -mod common; - #[tokio::test(flavor = "multi_thread")] async fn server_test_happy_path() { let tmpdir = tempdir::TempDir::new("lair keystore test").unwrap(); From 19e8fba493042687d53d15a0b75815db40eff79c Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 15:37:11 -0600 Subject: [PATCH 02/16] ci fix --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3624fe0..b474b38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,10 +43,8 @@ jobs: - name: Install lair-keystore-0.4.4 for fwd compat test run: | - cargo install names - which names - cargo install --root . lair-keystore@0.4.4 - mv ./bin/lair-keystore .cargo/bin/lair-keystore-0.4.4 + cargo install lair_keystore@0.4.4 + mv $(which lair-keystore){,-0.4.4} - name: Make Test Windows if: matrix.os == 'windows-latest' From d59c44d98fca56daa6521e72dd0c6121e2901131 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 15:53:49 -0600 Subject: [PATCH 03/16] ci fix --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b474b38..9900817 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,8 +42,9 @@ jobs: github-binarycache: true - name: Install lair-keystore-0.4.4 for fwd compat test + shell: bash run: | - cargo install lair_keystore@0.4.4 + cargo install lair_keystore@0.4.4 --debug mv $(which lair-keystore){,-0.4.4} - name: Make Test Windows From 195789572d32bae778bb5ee1a7483c2673360ccf Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:06:47 -0600 Subject: [PATCH 04/16] ci fix --- .github/workflows/test.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9900817..86385b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,18 +41,16 @@ jobs: manifest-dir: ${{ github.workspace }}/.github/manifest github-binarycache: true + - name: Set vcpkg env + if: matrix.os == 'windows-latest' + run: echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> $GITHUB_ENV + - name: Install lair-keystore-0.4.4 for fwd compat test shell: bash run: | cargo install lair_keystore@0.4.4 --debug mv $(which lair-keystore){,-0.4.4} - - name: Make Test Windows - if: matrix.os == 'windows-latest' - run: |- - $env:SODIUM_LIB_DIR="$(pwd)\vcpkg\packages\libsodium_x64-windows-release\lib" - make test - - name: Make Test if: matrix.os != 'windows-latest' run: make test From 3fab296d5639508169a992ebbcf9321343ff1898 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:21:36 -0600 Subject: [PATCH 05/16] debug gha env setting --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86385b4..114c5e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,12 +42,17 @@ jobs: github-binarycache: true - name: Set vcpkg env + id: set-vcpkg-env if: matrix.os == 'windows-latest' - run: echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> $GITHUB_ENV + run: | + echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> $GITHUB_ENV + echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> $GITHUB_OUTPUT - name: Install lair-keystore-0.4.4 for fwd compat test shell: bash run: | + echo "FROM ENV: $SODIUM_LIB_DIR" + echo "FROM OUTPUT: ${{ steps.set-vcpkg-env.output.SODIUM_LIB_DIR }}" cargo install lair_keystore@0.4.4 --debug mv $(which lair-keystore){,-0.4.4} From eb6f3d4ce9f88372a318b5dc8516a699b451cd0f Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:24:53 -0600 Subject: [PATCH 06/16] add quotes? --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 114c5e5..b54c290 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,8 @@ jobs: id: set-vcpkg-env if: matrix.os == 'windows-latest' run: | - echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> $GITHUB_ENV - echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> $GITHUB_OUTPUT + echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" + echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_OUTPUT" - name: Install lair-keystore-0.4.4 for fwd compat test shell: bash From d4fb5178e359103d36285f733e71ac17152478f6 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:27:59 -0600 Subject: [PATCH 07/16] try bash --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b54c290..a07c2f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,7 @@ jobs: github-binarycache: true - name: Set vcpkg env + shell: bash id: set-vcpkg-env if: matrix.os == 'windows-latest' run: | From bafbc8fe7049ca06ad9a0f65593ffd924942f859 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:38:35 -0600 Subject: [PATCH 08/16] try /home/neonphog --- .github/workflows/test.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a07c2f7..06bc6f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,10 +26,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} + - name: Rust Toolchain + run: | + rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update + rustup default ${{ matrix.toolchain }} - name: Install vcpkg packages if: matrix.os == 'windows-latest' @@ -43,17 +43,12 @@ jobs: - name: Set vcpkg env shell: bash - id: set-vcpkg-env if: matrix.os == 'windows-latest' - run: | - echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - echo "SODIUM_LIB_DIR=\"$(pwd)\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_OUTPUT" + run: echo "SODIUM_LIB_DIR=\"$HOME\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test shell: bash run: | - echo "FROM ENV: $SODIUM_LIB_DIR" - echo "FROM OUTPUT: ${{ steps.set-vcpkg-env.output.SODIUM_LIB_DIR }}" cargo install lair_keystore@0.4.4 --debug mv $(which lair-keystore){,-0.4.4} From 24d977341eda6430ebc695c7b90bd3ce418260e0 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:41:44 -0600 Subject: [PATCH 09/16] github_workspace --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 06bc6f0..23942bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: - name: Set vcpkg env shell: bash if: matrix.os == 'windows-latest' - run: echo "SODIUM_LIB_DIR=\"$HOME\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" + run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test shell: bash From 75f86e1541277dd81bcb6c663c2e4b9f7b9d96b8 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:50:27 -0600 Subject: [PATCH 10/16] ci fix --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23942bd..3464f09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,11 +47,11 @@ jobs: run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test + run: cargo install lair_keystore@0.4.4 --debug + + - name: Rename lair-keystore to include version shell: bash - run: | - cargo install lair_keystore@0.4.4 --debug - mv $(which lair-keystore){,-0.4.4} + run: mv $(which lair-keystore){,-0.4.4} - name: Make Test - if: matrix.os != 'windows-latest' run: make test From a9c291838045c1f70ccfe8c1bc83022fc86da15e Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 16:58:14 -0600 Subject: [PATCH 11/16] try native sodium rust vcpgk --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3464f09..977b495 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,8 @@ jobs: - name: Set vcpkg env shell: bash if: matrix.os == 'windows-latest' - run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" + run: echo "SODIUM_USE_PKG_CONFIG=\"1\"" >> "$GITHUB_ENV" + #run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test run: cargo install lair_keystore@0.4.4 --debug From 780567d83ae380b70f2c9677f471a19e51d3e677 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 17:01:37 -0600 Subject: [PATCH 12/16] set vcpkg root --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 977b495..00811f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,9 @@ jobs: - name: Set vcpkg env shell: bash if: matrix.os == 'windows-latest' - run: echo "SODIUM_USE_PKG_CONFIG=\"1\"" >> "$GITHUB_ENV" + run: | + echo "SODIUM_USE_PKG_CONFIG=\"1\"" >> "$GITHUB_ENV" + echo "VCPKG_ROOT=\"$GITHUB_WORKSPACE\\vcpkg\"" >> "$GITHUB_ENV" #run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test From f5f488c7982ac448cc34335af0bcfdae8a093c4c Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 17:07:26 -0600 Subject: [PATCH 13/16] try installed vcpkg root --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00811f9..e96c74d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: if: matrix.os == 'windows-latest' run: | echo "SODIUM_USE_PKG_CONFIG=\"1\"" >> "$GITHUB_ENV" - echo "VCPKG_ROOT=\"$GITHUB_WORKSPACE\\vcpkg\"" >> "$GITHUB_ENV" + echo "VCPKG_ROOT=\"$GITHUB_WORKSPACE\\vcpkg\\installed\"" >> "$GITHUB_ENV" #run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test From 41e57f5d2ceae65932b2e01335f8c23f6b84a3fc Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 17:11:05 -0600 Subject: [PATCH 14/16] getting desprate --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e96c74d..798faf7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,9 @@ jobs: shell: bash if: matrix.os == 'windows-latest' run: | + touch "$GITHUB_WORKSPACE\\vcpkg\\.vcpkg-root" echo "SODIUM_USE_PKG_CONFIG=\"1\"" >> "$GITHUB_ENV" - echo "VCPKG_ROOT=\"$GITHUB_WORKSPACE\\vcpkg\\installed\"" >> "$GITHUB_ENV" + echo "VCPKG_ROOT=\"$GITHUB_WORKSPACE\\vcpkg\"" >> "$GITHUB_ENV" #run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" - name: Install lair-keystore-0.4.4 for fwd compat test From 17f040c85833df0917b7ec9152eb786724a93274 Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 12 Jun 2024 17:26:25 -0600 Subject: [PATCH 15/16] do it the lame way --- .github/workflows/test.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 798faf7..dafa333 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,21 +41,26 @@ jobs: manifest-dir: ${{ github.workspace }}/.github/manifest github-binarycache: true - - name: Set vcpkg env - shell: bash + - name: Install lair-keystore-0.4.4 for fwd compat test Windows if: matrix.os == 'windows-latest' - run: | - touch "$GITHUB_WORKSPACE\\vcpkg\\.vcpkg-root" - echo "SODIUM_USE_PKG_CONFIG=\"1\"" >> "$GITHUB_ENV" - echo "VCPKG_ROOT=\"$GITHUB_WORKSPACE\\vcpkg\"" >> "$GITHUB_ENV" - #run: echo "SODIUM_LIB_DIR=\"$GITHUB_WORKSPACE\\vcpkg\\packages\\libsodium_x64-windows-release\\lib\"" >> "$GITHUB_ENV" + run: |- + $env:SODIUM_LIB_DIR="$(pwd)\vcpkg\packages\libsodium_x64-windows-release\lib" + cargo install lair_keystore@0.4.4 --debug - name: Install lair-keystore-0.4.4 for fwd compat test + if: matrix.os != 'windows-latest' run: cargo install lair_keystore@0.4.4 --debug - name: Rename lair-keystore to include version shell: bash run: mv $(which lair-keystore){,-0.4.4} + - name: Make Test Windows + if: matrix.os == 'windows-latest' + run: |- + $env:SODIUM_LIB_DIR="$(pwd)\vcpkg\packages\libsodium_x64-windows-release\lib" + make test + - name: Make Test + if: matrix.os != 'windows-latest' run: make test From aefb3464ff37b627d8408430475fd7208ecc2b2f Mon Sep 17 00:00:00 2001 From: neonphog Date: Wed, 17 Jul 2024 16:07:22 -0600 Subject: [PATCH 16/16] maybe windows fix --- .../tests/tests/fwd_compat_0_4_4.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs b/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs index 5800d4d..3075a86 100644 --- a/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs +++ b/crates/lair_keystore/tests/tests/fwd_compat_0_4_4.rs @@ -24,7 +24,7 @@ async fn fwd_compat_0_4_4() { let mut cmd = tokio::process::Command::new(NAME); - cmd.arg("--version"); + cmd.kill_on_drop(true).arg("--version"); eprintln!("{cmd:?}"); @@ -40,7 +40,8 @@ async fn fwd_compat_0_4_4() { let mut cmd = tokio::process::Command::new(NAME); - cmd.arg("--lair-root") + cmd.kill_on_drop(true) + .arg("--lair-root") .arg(tmpdir.path()) .arg("init") .arg("--piped") @@ -63,7 +64,10 @@ async fn fwd_compat_0_4_4() { let mut cmd = tokio::process::Command::new(NAME); - cmd.arg("--lair-root").arg(tmpdir.path()).arg("url"); + cmd.kill_on_drop(true) + .arg("--lair-root") + .arg(tmpdir.path()) + .arg("url"); eprintln!("{cmd:?}"); @@ -82,7 +86,8 @@ async fn fwd_compat_0_4_4() { let mut cmd = tokio::process::Command::new(NAME); - cmd.arg("--lair-root") + cmd.kill_on_drop(true) + .arg("--lair-root") .arg(tmpdir.path()) .arg("server") .arg("--piped") @@ -130,6 +135,10 @@ async fn fwd_compat_0_4_4() { client044.shutdown().await.unwrap(); drop(client044); + + // give windows a chance to sync to disk + tokio::time::sleep(std::time::Duration::from_secs(5)).await; + server.kill().await.unwrap(); drop(server);