Skip to content

Commit c616f36

Browse files
committed
KVM: selftests: Use continue to handle all "pass" scenarios in dirty_log_test
When verifying pages in dirty_log_test, immediately continue on all "pass" scenarios to make the logic consistent in how it handles pass vs. fail. No functional change intended. Reviewed-by: Maxim Levitsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 9a91f65 commit c616f36

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tools/testing/selftests/kvm/dirty_log_test.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,18 +510,17 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
510510
}
511511

512512
if (__test_and_clear_bit_le(page, bmap)) {
513-
bool matched;
514-
515513
nr_dirty_pages++;
516514

517515
/*
518516
* If the bit is set, the value written onto
519517
* the corresponding page should be either the
520518
* previous iteration number or the current one.
521519
*/
522-
matched = (val == iteration || val == iteration - 1);
520+
if (val == iteration || val == iteration - 1)
521+
continue;
523522

524-
if (host_log_mode == LOG_MODE_DIRTY_RING && !matched) {
523+
if (host_log_mode == LOG_MODE_DIRTY_RING) {
525524
if (val == iteration - 2 && min_iter <= iteration - 2) {
526525
/*
527526
* Short answer: this case is special
@@ -567,10 +566,8 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long *bmap)
567566
}
568567
}
569568

570-
TEST_ASSERT(matched,
571-
"Set page %"PRIu64" value %"PRIu64
572-
" incorrect (iteration=%"PRIu64")",
573-
page, val, iteration);
569+
TEST_FAIL("Dirty page %lu value (%lu) != iteration (%lu)",
570+
page, val, iteration);
574571
} else {
575572
nr_clean_pages++;
576573
/*

0 commit comments

Comments
 (0)