Module Name:    src
Committed By:   fox
Date:           Wed Jan 16 13:54:17 UTC 2019

Modified Files:
        src/tests/sys/uvm: t_uvm_physseg.c

Log Message:
Fixed issues with uvm_page_physunload_delete_end test case.

1. "avail_start" and "start" were different, resulting in unreachable code in
uvm_page_physunload(), where the condition check "avail_start" < "end" fails.
The test has been fixed by setting "avail_start" and "start" to the same value.

2. If "start" is the address with end address being "start + 2", we can
unplug twice, the first paddr_t would be "start" and the second one would be
"start + 1". Modified the ATF_CHECK_EQ() to reflect these changes.

Reviewed by <cherry>


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/sys/uvm/t_uvm_physseg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/sys/uvm/t_uvm_physseg.c
diff -u src/tests/sys/uvm/t_uvm_physseg.c:1.7 src/tests/sys/uvm/t_uvm_physseg.c:1.8
--- src/tests/sys/uvm/t_uvm_physseg.c:1.7	Wed Jan 16 13:45:29 2019
+++ src/tests/sys/uvm/t_uvm_physseg.c	Wed Jan 16 13:54:17 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: t_uvm_physseg.c,v 1.7 2019/01/16 13:45:29 fox Exp $ */
+/* $NetBSD: t_uvm_physseg.c,v 1.8 2019/01/16 13:54:17 fox Exp $ */
 
 /*-
  * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_uvm_physseg.c,v 1.7 2019/01/16 13:45:29 fox Exp $");
+__RCSID("$NetBSD: t_uvm_physseg.c,v 1.8 2019/01/16 13:54:17 fox Exp $");
 
 /*
  * If this line is commented out tests related to uvm_physseg_get_pmseg()
@@ -2155,7 +2155,7 @@ ATF_TC_BODY(uvm_page_physunload_delete_e
 	 */
 
 	upm = uvm_page_physload(VALID_START_PFN_1, VALID_START_PFN_1 + 2,
-	    VALID_AVAIL_START_PFN_1 + 1, VALID_AVAIL_START_PFN_1 + 2,
+	    VALID_AVAIL_START_PFN_1, VALID_AVAIL_START_PFN_1 + 2,
 	    VM_FREELIST_DEFAULT);
 
 	ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
@@ -2177,11 +2177,13 @@ ATF_TC_BODY(uvm_page_physunload_delete_e
 
 	ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
 
+	ATF_CHECK_EQ(VALID_START_PFN_1, atop(p));
+
 	p = 0;
 
 	ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
 
-	ATF_CHECK_EQ(VALID_START_PFN_1 + 2, atop(p));
+	ATF_CHECK_EQ(VALID_START_PFN_1 + 1, atop(p));
 
 	ATF_CHECK_EQ(1, uvm_physseg_get_entries());
 

Reply via email to