|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] tests/paging-mempool: Misc cleanup
commit d53ba690b0d23ebe9265aa731c0fc3586c035fc4
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon May 11 16:17:38 2026 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed May 13 16:44:34 2026 +0100
tests/paging-mempool: Misc cleanup
... ahead of extending it with a second test.
Rename run_tests() to test_paging_mempool_size() and have it return int so
the
new run_tests() can decide whether to run subsequent tests or not.
Comment the parameters to xc_domain_populate_physmap_exact() to make it
clearer what's going on, and remove the page added to the physmap when the
test is done.
No practical change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
tools/tests/paging-mempool/test-paging-mempool.c | 26 +++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/tools/tests/paging-mempool/test-paging-mempool.c
b/tools/tests/paging-mempool/test-paging-mempool.c
index 1ebc13455a..9ef8252126 100644
--- a/tools/tests/paging-mempool/test-paging-mempool.c
+++ b/tools/tests/paging-mempool/test-paging-mempool.c
@@ -15,6 +15,7 @@ static unsigned int nr_failures;
({ \
nr_failures++; \
(void)printf(fmt, ##__VA_ARGS__); \
+ -1; \
})
static xc_interface *xch;
@@ -40,7 +41,7 @@ static uint64_t default_mempool_size_bytes =
16 << 12;
#endif
-static void run_tests(void)
+static int test_paging_mempool_size(void)
{
xen_pfn_t physmap[] = { 0 };
uint64_t size_bytes, old_size_bytes;
@@ -80,7 +81,9 @@ static void run_tests(void)
return fail(" Fail: setmaxmem: : %d - %s\n",
errno, strerror(errno));
- rc = xc_domain_populate_physmap_exact(xch, domid, 1, 0, 0, physmap);
+ rc = xc_domain_populate_physmap_exact(
+ xch, domid, ARRAY_SIZE(physmap),
+ 0 /* order 4k */, 0 /* flags */, physmap);
if ( rc )
return fail(" Fail: populate physmap: %d - %s\n",
errno, strerror(errno));
@@ -98,6 +101,11 @@ static void run_tests(void)
return fail(" Fail: mempool size changed %"PRIu64" => %"PRIu64"\n",
old_size_bytes, size_bytes);
+ /* We added one 4k page. Check we can remove it. */
+ rc = xc_domain_remove_from_physmap(xch, domid, physmap[0]);
+ if ( rc )
+ return fail(" Fail: remove from physmap: %d - %s\n",
+ errno, strerror(errno));
printf("Test bad set size\n");
@@ -134,6 +142,19 @@ static void run_tests(void)
if ( size_bytes != 64 << 20 )
return fail(" Fail: expected mempool size %u, got %"PRIu64"\n",
64 << 20, size_bytes);
+
+ return 0;
+}
+
+static int run_tests(void)
+{
+ int rc;
+
+ rc = test_paging_mempool_size();
+ if ( rc )
+ return rc;
+
+ return 0;
}
int main(int argc, char **argv)
@@ -143,7 +164,6 @@ int main(int argc, char **argv)
printf("Paging mempool tests\n");
xch = xc_interface_open(NULL, NULL, 0);
-
if ( !xch )
err(1, "xc_interface_open");
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |