Skip to content

makefile: add step to update rust binaries #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ INTEGRATION_TEST_BIN := ${BUILD_DIR}/cassandra-integration-tests
clean:
rm -rf "${BUILD_DIR}"

update-repo-cache-if-needed:
update-apt-cache-if-needed:
@{\
@sudo find /var/cache/apt -type f -mtime -1 2>/dev/null | grep -c "" 2>/dev/null | grep 0 >/dev/null 2>&1 || (\
echo "Apt cache is outdated, update it.";\
sudo apt-get update || true;\
)\
}

install-cargo-if-missing: update-repo-cache-if-needed
install-cargo-if-missing: update-apt-cache-if-needed
@cargo --version >/dev/null 2>&1 || (\
echo "Cargo not found in the system, install it.";\
sudo apt-get install -y cargo;\
)

install-valgrind-if-missing: update-repo-cache-if-needed
install-valgrind-if-missing: update-apt-cache-if-needed
@valgrind --version >/dev/null 2>&1 || (\
echo "Valgrind not found in the system, install it.";\
sudo snap install valgrind --classic;\
Expand All @@ -103,10 +103,10 @@ install-java8-if-missing:
sudo apt install -y openjdk-8-jre;\
}

install-build-dependencies: update-repo-cache-if-needed
install-build-dependencies: update-apt-cache-if-needed
@sudo apt-get install -y libssl1.1 libuv1-dev libkrb5-dev libc6-dbg

install-bin-dependencies: update-repo-cache-if-needed
install-bin-dependencies: update-apt-cache-if-needed
@sudo apt-get install -y libssl1.1 libuv1-dev libkrb5-dev libc6-dbg

build-integration-test-bin:
Expand All @@ -126,29 +126,39 @@ build-integration-test-bin-if-missing:
cmake -DCASS_BUILD_INTEGRATION_TESTS=ON .. && (make -j 4 || make);\
}

check-cargo: install-cargo-if-missing
_update-rust-tooling:
@echo "Run rustup update"
@rustup update

check-cargo: install-cargo-if-missing _update-rust-tooling
@echo "Running \"cargo check\" in ./scylla-rust-wrapper"
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo check

fix-cargo:
@echo "Running \"cargo fix --verbose --all\" in ./scylla-rust-wrapper"
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo fix --verbose --all

check-cargo-clippy: install-cargo-if-missing
check-cargo-clippy: install-cargo-if-missing _update-rust-tooling
@echo "Running \"cargo clippy --verbose --all-targets -- -D warnings -Aclippy::uninlined_format_args\" in ./scylla-rust-wrapper"
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo clippy --verbose --all-targets -- -D warnings -Aclippy::uninlined_format_args

fix-cargo-clippy: install-cargo-if-missing
fix-cargo-clippy: install-cargo-if-missing _update-rust-tooling
@echo "Running \"cargo clippy --verbose --all-targets --fix -- -D warnings -Aclippy::uninlined_format_args\" in ./scylla-rust-wrapper"
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo clippy --verbose --all-targets --fix -- -D warnings -Aclippy::uninlined_format_args

check-cargo-fmt: install-cargo-if-missing
check-cargo-fmt: install-cargo-if-missing _update-rust-tooling
@echo "Running \"cargo fmt --verbose --all -- --check\" in ./scylla-rust-wrapper"
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo fmt --verbose --all -- --check

fix-cargo-fmt: install-cargo-if-missing
fix-cargo-fmt: install-cargo-if-missing _update-rust-tooling
@echo "Running \"cargo fmt --verbose --all\" in ./scylla-rust-wrapper"
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo fmt --verbose --all

check: check-cargo check-cargo-clippy check-cargo-fmt

fix: fix-cargo fix-cargo-clippy fix-cargo-fmt

prepare-integration-test: update-repo-cache-if-needed install-valgrind-if-missing
prepare-integration-test: update-apt-cache-if-needed install-valgrind-if-missing install-cargo-if-missing _update-rust-tooling
@sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr"
@dpkg -l libc6-dbg >/dev/null 2>&1 || sudo apt-get install -y libc6-dbg

Expand Down Expand Up @@ -184,5 +194,5 @@ endif
@echo "Running integration tests on cassandra ${CASSANDRA_VERSION}"
valgrind --error-exitcode=123 --leak-check=full --errors-for-leak-kinds=definite build/cassandra-integration-tests --version=${CASSANDRA_VERSION} --category=CASSANDRA --verbose=ccm --gtest_filter="${CASSANDRA_TEST_FILTER}"

run-test-unit: install-cargo-if-missing
run-test-unit: install-cargo-if-missing _update-rust-tooling
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo test