Skip to content

Commit

Permalink
wip: add bootstrap test using pluggable transport
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Pospesel committed Jun 23, 2024
1 parent 1151781 commit 0ebf564
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/gosling/crates/tor-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ if (ENABLE_TESTS)
COMMAND env CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_system_legacy_authenticated_onion_service ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
if (ENABLE_TOR_EXPERT_BUNDLE)
set(ENV_PATH $ENV{PATH})
if (WINDOWS)
set (PATH_SEPARATOR ";")
else()
set (PATH_SEPARATOR ":")
endif()
set(TEST_PATH "${CMAKE_BINARY_DIR}/source/extern/tor-expert-bundle${PATH_SEPARATOR}${ENV_PATH}")
message("TEST_PATH: ${TEST_PATH}")
add_test(NAME tor_interface_legacy_pluggable_transport_bootstrap_cargo_test
COMMAND env PATH=${TEST_PATH} CARGO_TARGET_DIR=${CARGO_TARGET_DIR} RUSTFLAGS=${RUSTFLAGS} RUST_BACKTRACE=full cargo test test_legacy_pluggable_transport_bootstrap ${CARGO_FLAGS} ${TOR_INTERFACE_FEATURES} -- --nocapture
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
endif()

if (ENABLE_ARTI_CLIENT_TOR_PROVIDER)
Expand Down
33 changes: 33 additions & 0 deletions source/gosling/crates/tor-interface/tests/tor_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,35 @@ fn test_legacy_bootstrap() -> anyhow::Result<()> {
bootstrap_test(Box::new(LegacyTorClient::new(tor_config)?))
}

#[test]
#[serial]
#[cfg(feature = "legacy-tor-provider")]
fn test_legacy_pluggable_transport_bootstrap() -> anyhow::Result<()> {
let tor_path = which::which(format!("tor{}", std::env::consts::EXE_SUFFIX))?;
let mut data_path = std::env::temp_dir();
data_path.push("test_legacy_pluggable_transport_bootstrap");

let lyrebird_path = if let Ok(lyrebird_path) = which::which(format!("lyrebird{}", std::env::consts::EXE_SUFFIX)) {
lyrebird_path
} else {
println!("lyrebird not present in path, not running test_legacy_pluggable_transport_bootstrap");
return Ok(())
};

println!("lyrebird => {lyrebird_path:?}");

let tor_config = LegacyTorClientConfig::BundledTor{
tor_bin_path: tor_path,
data_directory: data_path,
proxy_settings: None,
allowed_ports: None,
pluggable_transports: None,
bridge_lines: None,
};

bootstrap_test(Box::new(LegacyTorClient::new(tor_config)?))
}

#[test]
#[serial]
#[cfg(feature = "legacy-tor-provider")]
Expand Down Expand Up @@ -663,6 +692,10 @@ fn test_mixed_legacy_arti_client_onion_service() -> anyhow::Result<()> {
basic_onion_service_test(server_provider, client_provider)
}

//
// Misc Utils
//

#[test]
fn test_tor_provider_target_addr() -> anyhow::Result<()> {
let valid_ip_addr: &[&str] = &[
Expand Down

0 comments on commit 0ebf564

Please sign in to comment.