Skip to content

Commit

Permalink
workflows, tor-interface: stubbed out/enabled tests exercising ArtiTo…
Browse files Browse the repository at this point in the history
…rClient
  • Loading branch information
morganava committed Nov 30, 2024
1 parent 30385ea commit f706fc4
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 16 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}}
23 changes: 21 additions & 2 deletions source/gosling/crates/tor-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
Expand All @@ -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
Expand Down
56 changes: 51 additions & 5 deletions source/gosling/crates/tor-interface/tests/tor_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,7 @@ fn test_arti_bootstrap() -> anyhow::Result<()> {
}

//

//
// Mixed Arti/Legacy TorProvider tests
// Mixed Arti-Client/Legacy TorProvider tests
//

#[test]
Expand Down Expand Up @@ -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<runtime::Runtime> = 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<runtime::Runtime> = 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<runtime::Runtime> = 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)
// }

0 comments on commit f706fc4

Please sign in to comment.