[PATCH 2/3] tools: test vmi.index would be restored on merge failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add an assertion on restoring the correct index on failure.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
CC: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
---
 tools/testing/vma/vma.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c
index c53f220eb6cc..46e8989a90ae 100644
--- a/tools/testing/vma/vma.c
+++ b/tools/testing/vma/vma.c
@@ -243,6 +243,12 @@ static bool test_simple_merge(void)
 	ASSERT_FALSE(vma_link(&mm, vma_left));
 	ASSERT_FALSE(vma_link(&mm, vma_right));
 
+	fail_prealloc = true;
+	vma = merge_new(&vmg);
+	ASSERT_EQ(vma, NULL);
+	ASSERT_EQ(vmi.mas.index, 0x1000);
+
+	fail_prealloc = false;
 	vma = merge_new(&vmg);
 	ASSERT_NE(vma, NULL);
 
-- 
2.34.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux