Skip to contentSkip to conversation

Revert "list: test: fix tests for list_cut_position()"

PATCH Applied Guenter Roeck 4 participants 4 messages Sep 22, 2024 – Oct 3, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "list: test: fix tests for list_cut_position()"

This reverts commit e620799c414a035dea1208bcb51c869744931dbb.

The commit introduces unit test failures.

     Expected cur == &entries[i], but
         cur == 0000037fffadfd80
         &entries[i] == 0000037fffadfd60
     # list_test_list_cut_position: pass:0 fail:1 skip:0 total:1
     not ok 21 list_test_list_cut_position
     # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
     Expected cur == &entries[i], but
         cur == 0000037fffa9fd70
         &entries[i] == 0000037fffa9fd60
     # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
     Expected cur == &entries[i], but
         cur == 0000037fffa9fd80
         &entries[i] == 0000037fffa9fd70

Revert it.

Fixes e620799c414a ("list: test: fix tests for list_cut_position()")
Cc I Hsin Cheng <[email protected]>
Cc David Gow <[email protected]>
Cc Andrew Morton <[email protected]>
---
 lib/list-test.c | 6 ------
 1 file changed, 6 deletions(-)
lib/list-test.c +0 -6
index 4f3dc75baec1..e207c4c98d70 100644
@@ -408,13 +408,10 @@ static void list_test_list_cut_position(struct kunit *test)
 
 	KUNIT_EXPECT_EQ(test, i, 2);
 
-	i = 0;
 	list_for_each(cur, &list1) {
 		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
 		i++;
 	}
-
-	KUNIT_EXPECT_EQ(test, i, 1);
 }
 
 static void list_test_list_cut_before(struct kunit *test)
@@ -439,13 +436,10 @@ static void list_test_list_cut_before(struct kunit *test)
 
 	KUNIT_EXPECT_EQ(test, i, 1);
 
-	i = 0;
 	list_for_each(cur, &list1) {
 		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
 		i++;
 	}
-
-	KUNIT_EXPECT_EQ(test, i, 2);
 }
 
 static void list_test_list_splice(struct kunit *test)
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Guenter Roeck

This reverts commit e620799c414a035dea1208bcb51c869744931dbb.

The commit introduces unit test failures.

     Expected cur == &entries[i], but
         cur == 0000037fffadfd80
         &entries[i] == 0000037fffadfd60
     # list_test_list_cut_position: pass:0 fail:1 skip:0 total:1
     not ok 21 list_test_list_cut_position
     # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
     Expected cur == &entries[i], but
         cur == 0000037fffa9fd70
         &entries[i] == 0000037fffa9fd60
     # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
     Expected cur == &entries[i], but
         cur == 0000037fffa9fd80
         &entries[i] == 0000037fffa9fd70
Quoted 8 lines

Revert it.

Fixes e620799c414a ("list: test: fix tests for list_cut_position()")
Cc I Hsin Cheng <[email protected]>
Cc David Gow <[email protected]>
Cc Andrew Morton <[email protected]>

---

I ran into this as well.

Quoted 22 lines
 lib/list-test.c | 6 ------
 1 file changed, 6 deletions(-)
lib/list-test.c +0 -3
index 4f3dc75baec1..e207c4c98d70 100644
@@ -408,13 +408,10 @@ static void list_test_list_cut_position(struct kunit *test)
 
 	KUNIT_EXPECT_EQ(test, i, 2);
 
-	i = 0;
 	list_for_each(cur, &list1) {
 		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
 		i++;
 	}
-
-	KUNIT_EXPECT_EQ(test, i, 1);
 }
 
 static void list_test_list_cut_before(struct kunit *test)

lib/list-test.c static void list_test_list_cut_before(struct kunit *test) · line 448

Quoted 10 lines
lib/list-test.c +0 -3
@@ -439,13 +436,10 @@ static void list_test_list_cut_before(struct kunit *test)
 
 	KUNIT_EXPECT_EQ(test, i, 1);
 
-	i = 0;
 	list_for_each(cur, &list1) {
 		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
 		i++;
 	}
-
-	KUNIT_EXPECT_EQ(test, i, 2);

This test failure was also pointed out during an earlier review of the patch..

Quoted 1 line

https://lore.kernel.org/all/CABVgOSmn=SEwq3je3+vJ-S1Rwb=cLT2a3_WKOQsHu9xZYEZhrg@mail.gmail.com/

I suspect what we really want here is an explicit check against the length of the lists.

maintainer
#2 lore raw
Quoted 30 lines · Jacob Keller
Quoted 18 lines · Guenter Roeck

This reverts commit e620799c414a035dea1208bcb51c869744931dbb.

The commit introduces unit test failures.

      Expected cur == &entries[i], but
          cur == 0000037fffadfd80
          &entries[i] == 0000037fffadfd60
      # list_test_list_cut_position: pass:0 fail:1 skip:0 total:1
      not ok 21 list_test_list_cut_position
      # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
      Expected cur == &entries[i], but
          cur == 0000037fffa9fd70
          &entries[i] == 0000037fffa9fd60
      # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
      Expected cur == &entries[i], but
          cur == 0000037fffa9fd80
          &entries[i] == 0000037fffa9fd70
Quoted 8 lines

Revert it.

Fixes e620799c414a ("list: test: fix tests for list_cut_position()")
Cc I Hsin Cheng <[email protected]>
Cc David Gow <[email protected]>
Cc Andrew Morton <[email protected]>

---

Quoted 4 lines

I ran into this as well.

Please take a look and let me know if you are okay with this patch.

thanks,
-- Shuah

#3 lore raw
Quoted 32 lines · Shuah Khan
Quoted 30 lines · Jacob Keller
Quoted 26 lines · Guenter Roeck

This reverts commit e620799c414a035dea1208bcb51c869744931dbb.

The commit introduces unit test failures.

      Expected cur == &entries[i], but
          cur == 0000037fffadfd80
          &entries[i] == 0000037fffadfd60
      # list_test_list_cut_position: pass:0 fail:1 skip:0 total:1
      not ok 21 list_test_list_cut_position
      # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
      Expected cur == &entries[i], but
          cur == 0000037fffa9fd70
          &entries[i] == 0000037fffa9fd60
      # list_test_list_cut_before: EXPECTATION FAILED at lib/list-test.c:444
      Expected cur == &entries[i], but
          cur == 0000037fffa9fd80
          &entries[i] == 0000037fffa9fd70

Revert it.

Fixes e620799c414a ("list: test: fix tests for list_cut_position()")
Cc I Hsin Cheng <[email protected]>
Cc David Gow <[email protected]>
Cc Andrew Morton <[email protected]>

---

Quoted 6 lines
Quoted 4 lines

I ran into this as well.

Please take a look and let me know if you are okay with this patch.

This (and the original patch which was reverted) were both picked up via another tree and have already been applied to torvalds/master.

A re-work of the original patch is in
https://lore.kernel.org/linux-kselftest/[email protected]/
-- it looks fine to me (modulo the description being a bit confusing) and should be applied as a new patch, ignoring this and the previous version.

-- David