Skip to content

Commit

Permalink
Do not use --all-features on libafl_qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcondiro committed Sep 10, 2024
1 parent 6703e2f commit 0e3c7e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libafl_qemu/libafl_qemu_sys/build_linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ macro_rules! assert_unique_feature {
() => {};
($first:tt $(,$rest:tt)*) => {
$(
#[cfg(all(not(any(docsrs, feature="clippy" )), feature = $first, feature = $rest))]
#[cfg(all(not(any(docsrs, feature = "clippy")), feature = $first, feature = $rest))]
compile_error!(concat!("features \"", $first, "\" and \"", $rest, "\" cannot be used together"));
)*
assert_unique_feature!($($rest),*);
Expand Down
15 changes: 13 additions & 2 deletions scripts/clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ set -e
# Function to run Clippy on a single directory
run_clippy() {
local dir="$1"
local all_features="$2"
echo "All features: $all_features"
echo "Running Clippy on $dir"
pushd "$dir" || return 1

RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --no-deps --tests --examples --benches -- -Z macro-backtrace \
RUST_BACKTRACE=full cargo +nightly clippy --all ${all_features:+"$all_features"} --no-deps --tests --examples --benches -- -Z macro-backtrace \
-D clippy::all \
-D clippy::pedantic \
-W clippy::similar_names \
Expand Down Expand Up @@ -43,6 +45,11 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
)
fi

# Do not use --all-features for the following projects
NO_ALL_FEATURES=(
"libafl_qemu"
)

if [ "$#" -eq 0 ]; then
# No arguments provided, run on all projects
PROJECTS=("${ALL_PROJECTS[@]}")
Expand Down Expand Up @@ -72,8 +79,12 @@ RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --no-deps --tests
for project in "${PROJECTS[@]}"; do
# Trim leading and trailing whitespace
project=$(echo "$project" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
all_features="--all-features"
if [[ " ${NO_ALL_FEATURES[*]} " =~ ${project} ]]; then
all_features=""
fi
if [ -d "$project" ]; then
run_clippy "$project"
run_clippy "$project" $all_features
else
echo "Warning: Directory $project does not exist. Skipping."
fi
Expand Down

0 comments on commit 0e3c7e4

Please sign in to comment.