Skip to content

Commit

Permalink
Add more rc values to vmmpagetest
Browse files Browse the repository at this point in the history
Adds a little more ffdc to some testcases

Change-Id: If6a69506c0c88e1c3c3d3affc764cad72ff3418a
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/87576
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Corey V Swenson <cswenson@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
  • Loading branch information
dcrowell77 authored and Nicholas E Bofferding committed Jan 13, 2020
1 parent f704546 commit 14a51c8
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/usr/testcore/kernel/vmmpagetest.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* COPYRIGHT International Business Machines Corp. 2011,2014 */
/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
Expand Down Expand Up @@ -50,13 +52,13 @@ class vmmpagetest: public CxxTest::TestSuite
rc = mm_alloc_block(iv_mq,reinterpret_cast<void*>(iv_va),iv_size);
if (rc != 0)
{
TS_FAIL("Unable to allocate block.\n");
TS_FAIL("Unable to allocate block - rc=%d.\n",rc);
}
rc = mm_set_permission(reinterpret_cast<void*>(iv_va),iv_size,
initPerm);
if (rc != 0)
{
TS_FAIL("Failed to set block permissions to READ_ONLY.\n");
TS_FAIL("Failed to set block permissions to READ_ONLY - rc=%d.\n",rc);
}
task_create(testDaemon, NULL);
}
Expand All @@ -76,7 +78,7 @@ class vmmpagetest: public CxxTest::TestSuite
reinterpret_cast<void*>(iv_va),iv_size);
if (rc != 0)
{
TS_FAIL("Failed to release read pages\n");
TS_FAIL("Failed to release read pages - rc=%d.\n",rc);
}
}

Expand All @@ -86,7 +88,7 @@ class vmmpagetest: public CxxTest::TestSuite
if (rc != 0)
{
TS_FAIL(
"Failed to set WRITE_TRACKED permissions on first page.\n");
"Failed to set WRITE_TRACKED permissions on first page - rc=%d.\n",rc);
}

(*(volatile uint64_t *)iv_va) = 0x12345678; sync();
Expand All @@ -99,13 +101,13 @@ class vmmpagetest: public CxxTest::TestSuite
if (rc != 0)
{
TS_FAIL(
"Failed to set WRITE_TRACKED permissions on second page.\n");
"Failed to set WRITE_TRACKED permissions on second page - rc=%d.\n",rc);
}
rc = mm_remove_pages(FLUSH,
reinterpret_cast<void*>(iv_va),iv_size);
if (rc != 0)
{
TS_FAIL("Failed to flush write tracked pages\n");
TS_FAIL("Failed to flush write tracked pages - rc=%d.\n",rc);
}
}

Expand All @@ -115,7 +117,7 @@ class vmmpagetest: public CxxTest::TestSuite
if (rc != 0)
{
TS_FAIL(
"Failed to set WRITE_TRACKED permissions on first page.\n");
"Failed to set WRITE_TRACKED permissions on first page - rc=%d.\n",rc);
}

(*(volatile uint64_t *)(iv_va+2*PAGESIZE)) = 0x33333333; sync();
Expand All @@ -126,14 +128,14 @@ class vmmpagetest: public CxxTest::TestSuite
if (rc != 0)
{
TS_FAIL(
"Failed to set WRITE_TRACKED permissions on first page.\n");
"Failed to set WRITE_TRACKED permissions on first page - rc=%d.\n",rc);
}

rc = mm_remove_pages(RELEASE,
reinterpret_cast<void*>(iv_va),iv_size);
if (rc != 0)
{
TS_FAIL("Failed to release write track pages\n");
TS_FAIL("Failed to release write track pages - rc=%d.\n",rc);
}
}

Expand All @@ -143,7 +145,7 @@ class vmmpagetest: public CxxTest::TestSuite
rc = mm_set_permission(reinterpret_cast<void*>(iv_va+4*PAGESIZE), 3*PAGESIZE, READ_ONLY);
if (rc != 0)
{
TS_FAIL(" 1 Failed to Update permissions.\n");
TS_FAIL(" 1 Failed to Update permissions - rc=%d.\n",rc);
}

// try to write to a read_only page
Expand All @@ -153,13 +155,13 @@ class vmmpagetest: public CxxTest::TestSuite
if ((child != task_wait_tid(child, &status, NULL)) ||
(status != TASK_STATUS_CRASHED))
{
TS_FAIL("ERROR! Write to READ_ONLY address not caught.");
TS_FAIL("ERROR! Write to READ_ONLY address not caught - status=%d.",status);
}

rc = mm_set_permission(reinterpret_cast<void*>(iv_va+4*PAGESIZE), 3*PAGESIZE, EXECUTABLE);
if (rc != 0)
{
TS_FAIL("2 Failed to Update permissions.\n");
TS_FAIL("2 Failed to Update permissions - rc=%d.\n",rc);
}

// try to write to an executable page
Expand All @@ -168,13 +170,13 @@ class vmmpagetest: public CxxTest::TestSuite
if ((child != task_wait_tid(child, &status, NULL)) ||
(status != TASK_STATUS_CRASHED))
{
TS_FAIL("ERROR! Write to EXECUTABLE address not caught.");
TS_FAIL("ERROR! Write to EXECUTABLE address not caught - status=%d",status);
}

rc = mm_set_permission(reinterpret_cast<void*>(iv_va+4*PAGESIZE), 3*PAGESIZE, NO_ACCESS);
if (rc != 0)
{
TS_FAIL("3 Failed to Update permissions.\n");
TS_FAIL("3 Failed to Update permissions - rc=%d.\n",rc);
}

// try to write to a no access page
Expand All @@ -183,21 +185,21 @@ class vmmpagetest: public CxxTest::TestSuite
if ((child != task_wait_tid(child, &status, NULL)) ||
(status != TASK_STATUS_CRASHED))
{
TS_FAIL("ERROR! write to a NO_ACCESS addr not caught.\n");
TS_FAIL("ERROR! write to a NO_ACCESS addr not caught - status=%d",status);
}

// test that you cannot set WRITABLE and EXECUTABLE permissions
rc = mm_set_permission(reinterpret_cast<void*>(iv_va+4*PAGESIZE), 3*PAGESIZE, WRITABLE|EXECUTABLE);
if (rc == 0)
{
printk("Error .. invalid combination that did not get detected\n");
TS_FAIL(" ERROR..Failed to detect a bad parm condition.\n");
TS_FAIL(" ERROR..Failed to detect a bad parm condition - rc=%d.\n",rc);
}

rc = mm_set_permission(reinterpret_cast<void*>(iv_va+4*PAGESIZE), 3*PAGESIZE, WRITABLE);
if (rc != 0)
{
TS_FAIL(" 4 Failed to detect a bad parm condition.\n");
TS_FAIL(" 4 Failed to detect a bad parm condition - rc=%d.\n",rc);
}


Expand Down

0 comments on commit 14a51c8

Please sign in to comment.