From 10f5c0f07af61dccd51f22180beadade3341861a Mon Sep 17 00:00:00 2001 From: Vincent Date: Sun, 4 Sep 2022 16:34:26 +0900 Subject: [PATCH] Fix cargo doc on windows (#762) * add doc cfg * fix nostd docs * ignore CommandConfigurator doc test execution on non-unix platform * add cargo doc step pipeline on windows platform --- .github/workflows/build_and_test.yml | 2 ++ libafl/src/executors/command.rs | 5 +++-- libafl/src/executors/mod.rs | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 50ebe44ee5..95d7019b92 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -213,6 +213,8 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy + - name: Build docs + run: cargo doc - name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd with: diff --git a/libafl/src/executors/command.rs b/libafl/src/executors/command.rs index d3662dcb49..8b88e84352 100644 --- a/libafl/src/executors/command.rs +++ b/libafl/src/executors/command.rs @@ -593,7 +593,8 @@ impl CommandExecutorBuilder { /// A `CommandConfigurator` takes care of creating and spawning a [`std::process::Command`] for the [`CommandExecutor`]. /// # Example -/// ``` +#[cfg_attr(all(feature = "std", unix), doc = " ```")] +#[cfg_attr(not(all(feature = "std", unix)), doc = " ```ignore")] /// use std::{io::Write, process::{Stdio, Command, Child}}; /// use libafl::{Error, bolts::AsSlice, inputs::{Input, HasTargetBytes}, executors::{Executor, command::CommandConfigurator}}; /// #[derive(Debug)] @@ -621,7 +622,7 @@ impl CommandExecutorBuilder { /// MyExecutor.into_executor(()) /// } /// ``` -#[cfg(all(feature = "std", unix))] +#[cfg(all(feature = "std", any(unix, doc)))] pub trait CommandConfigurator: Sized + Debug { /// Spawns a new process with the given configuration. fn spawn_child(&mut self, input: &I) -> Result diff --git a/libafl/src/executors/mod.rs b/libafl/src/executors/mod.rs index 37dcf74d37..382623c14e 100644 --- a/libafl/src/executors/mod.rs +++ b/libafl/src/executors/mod.rs @@ -29,11 +29,11 @@ pub use shadow::ShadowExecutor; pub mod with_observers; pub use with_observers::WithObservers; -#[cfg(all(feature = "std", unix))] +#[cfg(all(feature = "std", any(unix, doc)))] pub mod command; use core::fmt::Debug; -#[cfg(all(feature = "std", unix))] +#[cfg(all(feature = "std", any(unix, doc)))] pub use command::CommandExecutor; use serde::{Deserialize, Serialize};