Skip to content

Feature/auto discover good commit#17

Open
coiby wants to merge 18 commits intomainfrom
feature/auto-discover-good-commit
Open

Feature/auto discover good commit#17
coiby wants to merge 18 commits intomainfrom
feature/auto-discover-good-commit

Conversation

@coiby
Copy link
Copy Markdown
Member

@coiby coiby commented Apr 6, 2026

No description provided.

coiby and others added 16 commits April 6, 2026 10:37
Github Action will run basic tests including format-check, static-analysis
and unit-tests. And testing farm will run integration tests.
Instead of comparing hardcoded /boot paths, use ORIGINAL_KERNEL_RELEASE
to verify if the kernel being removed is the original one. This allows
proper identification even if kernels are installed to unusual paths like
/boot/boot/ (e.g. when using guestmount, chroot and dnf install).
If the program aborts after the running test kernel get removed, the
program can fail to build the kernel next time because "make
localmodconfig" will fail. So always reboot to the original kernel.

And add a trap so when the program aborts it will be rebooted to the
original kernel.
When GOOD_COMMIT is omitted, the tool will use exponential search
(doubling steps backwards through history) to find a good commit
automatically, in both git source and RPM modes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Six tasks covering: _rpm_releases array, find_good_commit() function,
tests for all modes, initialize() integration, verify skip, and docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Populates an ordered array of kernel releases during RPM list
processing, needed for index-based traversal in auto-discovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Walks backward through history with doubling steps to auto-discover
a good commit when GOOD_COMMIT is not specified. Supports both git
and RPM modes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add test for git mode when no good commit is found (aborts with error)
- Add tests for RPM mode: success case and BAD_COMMIT validation
- Fix exponential search to test index 0/root commit as final fallback
  when the exponential steps skip over the earliest commit
- Add *.swp to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When GOOD_COMMIT is not specified, initialize() now only validates
BAD_COMMIT in RPM mode and leaves GOOD_REF empty. The auto-discovery
happens later in verify_intial_commits().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reorders verify_intial_commits() to check the bad commit first.
If it's not actually bad, there's no point searching for a good
commit. When GOOD_REF is empty, calls find_good_commit() after
verifying bad. When GOOD_REF is set, verifies it normally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated bisect.conf to clarify that GOOD_COMMIT is optional and describe
the auto-discovery behavior using exponential search backward through history.

Updated README.md to mark GOOD_COMMIT as optional in both Git Mode and RPM
Mode configuration tables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
So the feature that users only need to specify GOOD_COMMIT can be
tested.
… without crashkernel

When the to-be-tested kernel is already installed but doesn't have the
kernel crashkernel set up, the ssh_auto test plan will fail. Because
kdump-utils will only set up crashkernel parameter when a kernel is
freshly installed. Thus it won't work for already installed kernel. Call
"kdumpctl reset-crashkernel --kernel=ALL" unconditionally to address
this corner case.

Also optimize the code that enables kdump.serive.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

🤖 Hi @coiby, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

📋 Review Summary

This Pull Request introduces a significant new feature: auto-discovery of the good commit. The implementation is well-designed, robust, and includes comprehensive test coverage for both git and RPM modes, as well as various edge cases. The changes are well-integrated into the existing codebase, and documentation (README, bisect.conf) has been updated to reflect the new optional GOOD_COMMIT parameter.

🔍 General Feedback

  • The addition of the trap SIGINT in kab.sh is an excellent safety improvement.
  • The refactoring of do_abort and setup_kdump functions improves maintainability and clarity.
  • Thorough test coverage for the new feature in spec/find_good_commit_spec.sh is commendable.


- name: Unit Tests
run: |
dnf install git -yq
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 This change is good to ensure git is available for unit tests, especially with the new features relying on git operations. It clarifies the environment setup for the CI/CD pipeline.

Comment on lines 21 to +23
log "Failed to run 'make localmodconfig, will try $ORIGINAL_KERNEL_CONFIG"
# The test kernel may be removed. As a result "make localconfig" won't work
# The test kernel may be removed. As a result, "make localmodconfig"
# may not work. "make localmodconfig" will need to find a base config
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 The updated comment provides much better context on why make localmodconfig might fail and what the fallback mechanism entails. This greatly improves the maintainability and debuggability of the script.

@@ -49,8 +51,8 @@ remove_test_kernel() {
if [[ -z "$kernel_to_remove" ]]; then return; fi

# Safety check: never remove the original kernel
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 This change makes the safety check for remove_test_kernel more robust and direct by comparing the kernel release strings. It's a good improvement to prevent accidental removal of the original kernel.

#
# shellcheck source=lib.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 Adding a trap for SIGINT to call reboot_to_origin_kernel is an excellent safety enhancement. It ensures that the system returns to a known good state even if the bisection process is interrupted, which is crucial for reliability.

@@ -102,6 +102,7 @@ signal_checkpoint() {
}

declare -A release_commit_map
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Declaring _rpm_releases=() here is a good and necessary step for the new RPM mode auto-discovery feature. It ensures the array is properly initialized before use.

@@ -349,22 +429,23 @@ setup_kdump() {
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Updating the RPM initialization logic to treat GOOD_COMMIT as optional and only abort if BAD_COMMIT or a provided GOOD_COMMIT is not found, correctly integrates the auto-discovery feature. This ensures flexibility for the user while maintaining necessary checks.

do_abort "KERNEL_RPM_LIST file not found."
fi
# kexec reboot by default inherit /proc/cmdline. So make sure
# crashkernel exists in /proc/cmdline
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 The integration of find_good_commit into initialize() when GOOD_REF is empty is the core of the new auto-discovery feature. This ensures that a good commit is automatically identified when the user doesn't provide one, streamlining the bisection process.

@@ -0,0 +1,211 @@
#!/bin/bash
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 The addition of spec/find_good_commit_spec.sh provides excellent test coverage for the new auto-discovery feature. The test cases cover both git and RPM modes, including success scenarios, failure conditions, and edge cases like root commit fallback, demonstrating a thorough approach to testing.

@@ -44,23 +45,19 @@ Describe 'remove_test_kernel'
End

Describe "safety check"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 The updated and new test cases for remove_test_kernel significantly improve the testing for the safety check. This ensures that the original kernel is not accidentally removed, even under various conditions, which is critical for system stability.

@@ -54,7 +54,6 @@ INSTALL_STRATEGY="rpm"
TEST_STRATEGY="panic"
REBOOT_STRATEGY=
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Removing the explicit GOOD_COMMIT=$GOOD_COMMIT from the test configurations is correct, as GOOD_COMMIT is now optional and can be auto-discovered. This aligns the tests with the new feature's behavior.

@coiby coiby force-pushed the feature/auto-discover-good-commit branch 2 times, most recently from b018685 to 7fcdea6 Compare April 6, 2026 06:51
@coiby coiby force-pushed the feature/auto-discover-good-commit branch from 7fcdea6 to 7c1a398 Compare April 6, 2026 06:59
Testing harm reject hardcoded provision method 'virtual.testcloud',
    Suitable provision method 'virtual.testcloud' disallowed by configuration
@coiby coiby force-pushed the main branch 4 times, most recently from 75b8caa to 77a9584 Compare April 7, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant