Skip to content

Commit fe456d5

Browse files
committed
Restore integration and doctest support in CI
This commit adds an unstable `ci` feature which reverts back the previous non-compliant opening method because it enables tests to run in CI without needing to painstakingly extract the test binary names from `cargo build --tests --message-format json` and spawn each one in `renderdoccmd capture $NAME`. Besides, this strategy is impossible anyway because doctests compiled on-the-fly by `rustdoc` and do not have external binaries with which to launch with RenderDoc. We also cannot make the `RTLD_NOLOAD` conditional, i.e. `#[cfg(any(test, doctest))]` and `#[cfg(not(any(test, doctest)))]`, due to: rust-lang/rust#67295 As such, this internal crate feature will have to do.
1 parent 9252ae6 commit fe456d5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ all-features = true
1919
[badges]
2020
circle-ci = { repository = "ebkalderon/renderdoc-rs" }
2121

22+
[features]
23+
default = []
24+
25+
# Private feature only intended for doctests in CI
26+
ci = []
27+
2228
[dependencies]
2329
bitflags = "1.0"
2430
float-cmp = "0.9"

src/version.rs

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub trait Version {
6161
let lib_path = "libVkLayer_GLES_RenderDoc.so";
6262

6363
unsafe {
64+
#[cfg(not(feature = "ci"))]
6465
#[cfg(unix)]
6566
let lib = LIBRARY
6667
.get_or_try_init(|| {
@@ -72,13 +73,19 @@ pub trait Version {
7273
})
7374
.map_err(Error::library)?;
7475

76+
#[cfg(not(feature = "ci"))]
7577
#[cfg(windows)]
7678
let lib = LIBRARY
7779
.get_or_try_init(|| {
7880
libloading::os::windows::Library::open_already_loaded(lib_path).map(Into::into)
7981
})
8082
.map_err(Error::library)?;
8183

84+
#[cfg(feature = "ci")]
85+
let lib = LIBRARY
86+
.get_or_try_init(|| Library::new(lib_path))
87+
.map_err(Error::library)?;
88+
8289
let get_api: Symbol<GetApiFn> =
8390
lib.get(b"RENDERDOC_GetAPI\0").map_err(Error::symbol)?;
8491

0 commit comments

Comments
 (0)