This is really annoying, since we can't use cfg(test) for doctests.
test-c-from-rust = [
"crypto/test-c-from-rust",
]
+
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
# execute with `cargo test`. Due to numerous linker issues (#25386), this is
# currently disabled by default.
test-c-from-rust = []
+
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
path = "lib.rs"
crate_type = ["rlib", "staticlib"]
+[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
name = "protover"
[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
[dependencies]
libc = "=0.2.39"
name = "protover"
path = "lib.rs"
crate_type = ["rlib", "staticlib"]
-
use std::string::String;
use external::c_tor_version_as_new_as;
-use external::c_tor_is_using_nss;
use errors::ProtoverError;
use protoset::ProtoSet;
}
}
+#[cfg(feature="test_linking_hack")]
+fn have_linkauth_v1() -> bool {
+ true
+}
+
+#[cfg(not(feature="test_linking_hack"))]
+fn have_linkauth_v1() -> bool {
+ use external::c_tor_is_using_nss;
+ ! c_tor_is_using_nss()
+}
+
/// Get a CStr representation of current supported protocols, for
/// passing to C, or for converting to a `&str` for Rust.
///
///
// C_RUST_COUPLED: protover.c `protover_get_supported_protocols`
pub(crate) fn get_supported_protocols_cstr() -> &'static CStr {
- if c_tor_is_using_nss() {
+ if ! have_linkauth_v1() {
cstr!("Cons=1-2 \
Desc=1-2 \
DirCache=1-2 \
path = "lib.rs"
crate_type = ["rlib", "staticlib"]
+[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
path = "lib.rs"
crate_type = ["rlib", "staticlib"]
+[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
crate_type = ["rlib", "staticlib"]
[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
[dependencies]
libc = "0.2.39"
[dependencies.protover]
path = "../protover"
+[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
[dependencies]
libc = "=0.2.39"
+[features]
+# We have to define a feature here because doctests don't get cfg(test),
+# and we need to disable some C dependencies when running the doctests
+# because of the various linker issues. See
+# https://github.com/rust-lang/rust/issues/45599
+test_linking_hack = []
cd "${abs_top_builddir:-../../..}/src/rust" && \
CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" \
"${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} \
+ --features "test_linking_hack" \
${EXTRA_CARGO_OPTIONS} \
--manifest-path "${cargo_toml_dir}/Cargo.toml" || exitcode=1
fi