From f706fc421b18bd63522ae5eceac41fc9edf11101 Mon Sep 17 00:00:00 2001 From: Morgan Date: Fri, 29 Nov 2024 04:32:01 +0000 Subject: [PATCH] workflows, tor-interface: stubbed out/enabled tests exercising ArtiTorClient --- .github/workflows/test.yml | 42 +++++++++++--- .../crates/tor-interface/CMakeLists.txt | 23 +++++++- .../tor-interface/tests/tor_provider.rs | 56 +++++++++++++++++-- 3 files changed, 105 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a92127ec..e58990df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: - tor_interface_mock_authenticated_onion_service_cargo_test - tor_interface_mock_bootstrap_cargo_test - tor_interface_mock_onion_service_cargo_test + - tor_interface_arti_bootstrap_cargo_test - tor_interface_arti_client_authenticated_onion_service_cargo_test - tor_interface_arti_client_bootstrap_cargo_test - tor_interface_arti_client_onion_service_cargo_test @@ -24,9 +25,13 @@ jobs: - tor_interface_system_legacy_authenticated_onion_service_cargo_test - tor_interface_system_legacy_onion_service_cargo_test - tor_interface_mixed_arti_client_legacy_authenticated_onion_service_cargo_test - - tor_interface_mixed_arti_client_legacy_bootstrap_cargo_test + - tor_interface_mixed_arti_client_legacy_onion_service_cargo_test - tor_interface_mixed_legacy_arti_client_authenticated_onion_service_cargo_test - - tor_interface_mixed_legacy_arti_client_bootstrap_cargo_test + - tor_interface_mixed_legacy_arti_client_onion_service_cargo_test + # - tor_interface_mixed_arti_legacy_onion_service_cargo_test + - tor_interface_mixed_legacy_arti_onion_service_cargo_test + # - tor_interface_mixed_arti_legacy_authenticated_onion_service_cargo_test + # - tor_interface_mixed_legacy_arti_authenticated_onion_service_cargo_test - gosling_cargo_test - cgosling_cargo_test - gosling_cpp_bindings_test @@ -41,10 +46,13 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libboost-all-dev tor libsqlite3-dev + - name: Install arti + run: | + cargo install arti --features experimental - name: Test run: | mkdir build - cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_ARTI_CLIENT_TOR_PROVIDER=ON -DENABLE_TOR_EXPERT_BUNDLE=ON -DBUILD_JAVA_BINDINGS=ON + cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_ARTI_CLIENT_TOR_PROVIDER=ON -DENABLE_ARTI_TOR_PROVIDER=ON -DENABLE_TOR_EXPERT_BUNDLE=ON -DBUILD_JAVA_BINDINGS=ON cd build ctest --verbose -R ^${{matrix.test}} windows: @@ -58,6 +66,7 @@ jobs: - tor_interface_mock_authenticated_onion_service_cargo_test - tor_interface_mock_bootstrap_cargo_test - tor_interface_mock_onion_service_cargo_test + - tor_interface_arti_bootstrap_cargo_test - tor_interface_arti_client_authenticated_onion_service_cargo_test - tor_interface_arti_client_bootstrap_cargo_test - tor_interface_arti_client_onion_service_cargo_test @@ -68,9 +77,13 @@ jobs: - tor_interface_system_legacy_authenticated_onion_service_cargo_test - tor_interface_system_legacy_onion_service_cargo_test - tor_interface_mixed_arti_client_legacy_authenticated_onion_service_cargo_test - - tor_interface_mixed_arti_client_legacy_bootstrap_cargo_test + - tor_interface_mixed_arti_client_legacy_onion_service_cargo_test - tor_interface_mixed_legacy_arti_client_authenticated_onion_service_cargo_test - - tor_interface_mixed_legacy_arti_client_bootstrap_cargo_test + - tor_interface_mixed_legacy_arti_client_onion_service_cargo_test + # - tor_interface_mixed_arti_legacy_onion_service_cargo_test + # - tor_interface_mixed_legacy_arti_onion_service_cargo_test + # - tor_interface_mixed_arti_legacy_authenticated_onion_service_cargo_test + # - tor_interface_mixed_legacy_arti_authenticated_onion_service_cargo_test - gosling_cargo_test - cgosling_cargo_test - gosling_cpp_bindings_test @@ -103,13 +116,16 @@ jobs: distribution: 'zulu' java-version: '17' architecture: x86_64 + # - name: Install arti + # run: | + # cargo install arti --features experimental - name: Test env: CC: clang run: | export PATH=$(cygpath -u ${JAVA_HOME})/bin:$PATH mkdir build - cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_ARTI_CLIENT_TOR_PROVIDER=ON -DENABLE_TOR_EXPERT_BUNDLE=ON -DBUILD_JAVA_BINDINGS=ON + cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_ARTI_CLIENT_TOR_PROVIDER=ON -DENABLE_ARTI_TOR_PROVIDER=OFF -DENABLE_TOR_EXPERT_BUNDLE=ON -DBUILD_JAVA_BINDINGS=ON cd build ctest --verbose -R ^${{matrix.test}} macos: @@ -123,6 +139,7 @@ jobs: - tor_interface_mock_authenticated_onion_service_cargo_test - tor_interface_mock_bootstrap_cargo_test - tor_interface_mock_onion_service_cargo_test + - tor_interface_arti_bootstrap_cargo_test - tor_interface_arti_client_authenticated_onion_service_cargo_test - tor_interface_arti_client_bootstrap_cargo_test - tor_interface_arti_client_onion_service_cargo_test @@ -133,9 +150,13 @@ jobs: - tor_interface_system_legacy_authenticated_onion_service_cargo_test - tor_interface_system_legacy_onion_service_cargo_test - tor_interface_mixed_arti_client_legacy_authenticated_onion_service_cargo_test - - tor_interface_mixed_arti_client_legacy_bootstrap_cargo_test + - tor_interface_mixed_arti_client_legacy_onion_service_cargo_test - tor_interface_mixed_legacy_arti_client_authenticated_onion_service_cargo_test - - tor_interface_mixed_legacy_arti_client_bootstrap_cargo_test + - tor_interface_mixed_legacy_arti_client_onion_service_cargo_test + # - tor_interface_mixed_arti_legacy_onion_service_cargo_test + - tor_interface_mixed_legacy_arti_onion_service_cargo_test + # - tor_interface_mixed_arti_legacy_authenticated_onion_service_cargo_test + # - tor_interface_mixed_legacy_arti_authenticated_onion_service_cargo_test - gosling_cargo_test - cgosling_cargo_test - gosling_cpp_bindings_test @@ -149,9 +170,12 @@ jobs: - name: Install Dependencies run: | brew install boost tor sqlite3 + - name: Install arti + run: | + cargo install arti --features experimental - name: Test run: | mkdir build - cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_ARTI_CLIENT_TOR_PROVIDER=ON -DENABLE_TOR_EXPERT_BUNDLE=ON -DBUILD_JAVA_BINDINGS=ON + cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_ARTI_CLIENT_TOR_PROVIDER=ON -DENABLE_ARTI_TOR_PROVIDER=ON -DENABLE_TOR_EXPERT_BUNDLE=ON -DBUILD_JAVA_BINDINGS=ON cd build ctest --verbose -R ^${{matrix.test}} diff --git a/source/gosling/crates/tor-interface/CMakeLists.txt b/source/gosling/crates/tor-interface/CMakeLists.txt index e7aad06b..aa7ade6e 100644 --- a/source/gosling/crates/tor-interface/CMakeLists.txt +++ b/source/gosling/crates/tor-interface/CMakeLists.txt @@ -126,11 +126,11 @@ if (ENABLE_TESTS) endif() if (ENABLE_LEGACY_TOR_PROVIDER AND ENABLE_ARTI_CLIENT_TOR_PROVIDER) - add_test(NAME tor_interface_mixed_arti_client_legacy_bootstrap_cargo_test + add_test(NAME tor_interface_mixed_arti_client_legacy_onion_service_cargo_test COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_mixed_arti_client_legacy_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - add_test(NAME tor_interface_mixed_legacy_arti_client_bootstrap_cargo_test + add_test(NAME tor_interface_mixed_legacy_arti_client_onion_service_cargo_test COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_mixed_legacy_arti_client_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) @@ -144,6 +144,25 @@ if (ENABLE_TESTS) ) endif() + if (ENABLE_LEGACY_TOR_PROVIDER AND ENABLE_ARTI_TOR_PROVIDER) + # add_test(NAME tor_interface_mixed_arti_legacy_onion_service_cargo_test + # COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_mixed_arti_legacy_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture + # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + # ) + add_test(NAME tor_interface_mixed_legacy_arti_onion_service_cargo_test + COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_mixed_legacy_arti_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + # add_test(NAME tor_interface_mixed_arti_legacy_authenticated_onion_service_cargo_test + # COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_mixed_arti_legacy_authenticated_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture + # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + # ) + # add_test(NAME tor_interface_mixed_legacy_arti_authenticated_onion_service_cargo_test + # COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_mixed_legacy_arti_authenticated_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture + # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + # ) + endif() + # cryptography add_test(NAME tor_interface_crypto_cargo_test COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_crypto_ ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture diff --git a/source/gosling/crates/tor-interface/tests/tor_provider.rs b/source/gosling/crates/tor-interface/tests/tor_provider.rs index adba014a..c9b3c45b 100644 --- a/source/gosling/crates/tor-interface/tests/tor_provider.rs +++ b/source/gosling/crates/tor-interface/tests/tor_provider.rs @@ -699,9 +699,7 @@ fn test_arti_bootstrap() -> anyhow::Result<()> { } // - -// -// Mixed Arti/Legacy TorProvider tests +// Mixed Arti-Client/Legacy TorProvider tests // #[test] @@ -746,8 +744,56 @@ fn test_mixed_arti_client_legacy_authenticated_onion_service() -> anyhow::Result fn test_mixed_legacy_arti_client_authenticated_onion_service() -> anyhow::Result<()> { let runtime: Arc = Arc::new(runtime::Runtime::new().unwrap()); - let server_provider = build_arti_client_tor_provider(runtime, "test_mixed_legacy_arti_client_authenticated_onion_service_server")?; - let client_provider = build_bundled_legacy_tor_provider("test_mixed_legacy_arti_client_authenticated_onion_service_client")?; + let server_provider = build_bundled_legacy_tor_provider("test_mixed_legacy_arti_client_authenticated_onion_service_server")?; + let client_provider = build_arti_client_tor_provider(runtime, "test_mixed_legacy_arti_client_authenticated_onion_service_client")?; authenticated_onion_service_test(server_provider, client_provider) } + +// +// Mixed Arti/Legacy TorProvider tests +// + +// #[test] +// #[serial] +// #[cfg(all(feature = "arti-tor-provider", feature = "legacy-tor-provider"))] +// fn test_mixed_arti_legacy_onion_service() -> anyhow::Result<()> { +// let server_provider = build_arti_tor_provider("test_mixed_arti_legacy_onion_service_server")?; +// let client_provider = build_bundled_legacy_tor_provider("test_mixed_arti_legacy_onion_service_client")?; + +// basic_onion_service_test(server_provider, client_provider) +// } + +#[test] +#[serial] +#[cfg(all(feature = "arti-tor-provider", feature = "legacy-tor-provider"))] +fn test_mixed_legacy_arti_onion_service() -> anyhow::Result<()> { + let server_provider = build_bundled_legacy_tor_provider("test_mixed_legacy_arti_onion_service_server")?; + let client_provider = build_arti_tor_provider("test_mixed_legacy_arti_onion_service_client")?; + + basic_onion_service_test(server_provider, client_provider) +} + +// #[test] +// #[serial] +// #[cfg(all(feature = "arti-tor-provider", feature = "legacy-tor-provider"))] +// fn test_mixed_arti_legacy_authenticated_onion_service() -> anyhow::Result<()> { +// let runtime: Arc = Arc::new(runtime::Runtime::new().unwrap()); + +// let server_provider = build_arti_tor_provider("test_mixed_arti_legacy_authenticated_onion_service_server")?; +// let client_provider = build_bundled_legacy_tor_provider("test_mixed_arti_legacy_authenticated_onion_service_client")?; + +// authenticated_onion_service_test(server_provider, client_provider) +// } + +// #[test] +// #[serial] +// #[cfg(all(feature = "arti-tor-provider", feature = "legacy-tor-provider"))] +// fn test_mixed_legacy_arti_authenticated_onion_service() -> anyhow::Result<()> { +// let runtime: Arc = Arc::new(runtime::Runtime::new().unwrap()); + +// let server_provider = build_bundled_legacy_tor_provider("test_mixed_legacy_arti_authenticated_onion_service_server")?; +// let client_provider = build_arti_tor_provider("test_mixed_legacy_arti_authenticated_onion_service_client")?; + +// authenticated_onion_service_test(server_provider, client_provider) +// }