Skip to content

Add check to Lockbud CI job #6898

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 4 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ jobs:
- name: Install dependencies
run: apt update && apt install -y cmake libclang-dev
- name: Check for deadlocks
run: |
cargo lockbud -k deadlock -b -l tokio_util
run: ./scripts/ci/check-lockbud.sh

target-branch-check:
name: target-branch-check
Expand Down
17 changes: 17 additions & 0 deletions scripts/ci/check-lockbud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Run lockbud to check for deadlocks and capture the output
output=$(cargo lockbud -k deadlock -b -l tokio_util 2>&1)

# Check if lockbud returned any issues
if echo "$output" | grep -q '"bug_kind"'; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this may produce false negatives if cargo lockbud failed for other reasons e.g.

  1. compilation error
  2. lockbud internal issues

Although i think this is already better than before! Given that (1) compilation errors should fail other jobs as well, and we haven't seen (2) happened before (it may be very unlikely), I think we can go ahead and merge this.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.
This script was only intended to be a quick fix.

I do suggest we

  • centralize this script as currently its copy pasta between anchor and LH.
  • ultimately improve the lockbud cli so it can return and error code with the result.

# Print the JSON payload
echo "Lockbud detected issues:"
echo "$output"

# Exit with a non-zero status to indicate an error
exit 1
else
echo "No issues detected by Lockbud."
exit 0
fi