summaryrefslogtreecommitdiffstats
path: root/src/usr/testcore
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-10-28 17:02:22 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-11-01 15:15:33 -0500
commit0d03f507d4952bc2f2c746ee60dcd155ba4ea507 (patch)
treea14221562bdd4b2bcd1281eae1ca9ab18e968f1d /src/usr/testcore
parent308c993928937070e462c027f7e6b183e7858a2a (diff)
downloadtalos-hostboot-0d03f507d4952bc2f2c746ee60dcd155ba4ea507.tar.gz
talos-hostboot-0d03f507d4952bc2f2c746ee60dcd155ba4ea507.zip
Assert on crash of a parent-less task.
- Assert whenever a parent-less task crashes. - Clean up task structures for parent-less tasks. Change-Id: Idf613cbbd51e6ec87e5c1455c30b3051096ed807 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/468 Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com> Reviewed-by: Melissa J. Connell <missyc@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/testcore')
-rw-r--r--src/usr/testcore/kernel/taskwaittest.H2
-rw-r--r--src/usr/testcore/kernel/vmmbasetest.H47
-rw-r--r--src/usr/testcore/kernel/vmmpagetest.H31
3 files changed, 30 insertions, 50 deletions
diff --git a/src/usr/testcore/kernel/taskwaittest.H b/src/usr/testcore/kernel/taskwaittest.H
index 00ec0990f..8c59aedc7 100644
--- a/src/usr/testcore/kernel/taskwaittest.H
+++ b/src/usr/testcore/kernel/taskwaittest.H
@@ -171,7 +171,7 @@ class TaskWaitTest : public CxxTest::TestSuite
static void TaskThatCrashes(void* unused)
{
- printk("Test case: Expect to see uncaught exception!");
+ printk("Test case: Expect to see uncaught exception! ");
*(int64_t*)(0) = 0xDEADC0DE;
}
};
diff --git a/src/usr/testcore/kernel/vmmbasetest.H b/src/usr/testcore/kernel/vmmbasetest.H
index cd2f20ff1..52802fee7 100644
--- a/src/usr/testcore/kernel/vmmbasetest.H
+++ b/src/usr/testcore/kernel/vmmbasetest.H
@@ -37,27 +37,25 @@
class VmmBaseTest : public CxxTest::TestSuite
{
public:
- static volatile int rc;
static msg_q_t iv_mq;
void testNullAccess()
{
- rc = 0; sync();
+ int status;
+
printk("Test case: Expect to see uncaught exception! ");
- task_create(readFromNULL, NULL);
- while (rc == 0) task_yield();
- task_yield();
- if (rc == -1)
+ tid_t child = task_create(readFromNULL, NULL);
+
+ if ((child != task_wait_tid(child, &status, NULL)) ||
+ (status != TASK_STATUS_CRASHED))
{
TS_FAIL("Write to NULL not caught.");
}
- rc = 0; sync();
printk("Test case: Expect to see uncaught exception! ");
- task_create(writeToNULL, NULL);
- while (rc == 0) task_yield();
- task_yield();
- if (rc == -1)
+ child = task_create(writeToNULL, NULL);
+ if ((child != task_wait_tid(child, &status, NULL)) ||
+ (status != TASK_STATUS_CRASHED))
{
TS_FAIL("Write to NULL not caught.");
}
@@ -65,12 +63,12 @@ class VmmBaseTest : public CxxTest::TestSuite
void testWriteToKernelCode()
{
- rc = 0; sync();
+ int status;
+
printk("Test case: Expect to see uncaught exception! ");
- task_create(writeToKernelCode, NULL);
- while (rc == 0) task_yield();
- task_yield();
- if (rc == -1)
+ tid_t child = task_create(writeToKernelCode, NULL);
+ if ((child != task_wait_tid(child, &status, NULL)) ||
+ (status != TASK_STATUS_CRASHED))
{
TS_FAIL("Write to kernel code not caught.");
}
@@ -97,7 +95,7 @@ class VmmBaseTest : public CxxTest::TestSuite
uint64_t l_testSize = VMM_SIZE_RMVPAGE_TEST;
uint64_t vaddr = l_testAddr+l_testSize;
uint64_t vsize = PageManager::availPages()*PAGESIZE;
- rc = mm_alloc_block(iv_mq,reinterpret_cast<void*>(vaddr),vsize);
+ int rc = mm_alloc_block(iv_mq,reinterpret_cast<void*>(vaddr),vsize);
if (rc != 0)
{
TS_FAIL("Unable to allocate block.\n");
@@ -128,25 +126,19 @@ class VmmBaseTest : public CxxTest::TestSuite
static void readFromNULL(void* unused)
{
- rc = 1; sync();
- printk("%lx", (*(uint64_t*)NULL)); sync();
- rc = -1; sync();
+ printk("%lx", (*(uint64_t*)NULL));
task_end();
}
static void writeToNULL(void* unused)
{
- rc = 1; sync();
- (*(uint64_t*)NULL) = 0x12345678; sync();
- rc = -1; sync();
+ (*(uint64_t*)NULL) = 0x12345678;
task_end();
}
static void writeToKernelCode(void* unused)
{
- rc = 1; sync();
- (*(*(uint64_t**)&printk)) = 0x12345678; sync();
- rc = -1; sync();
+ (*(*(uint64_t**)&printk)) = 0x12345678;
task_end();
}
@@ -163,13 +155,12 @@ class VmmBaseTest : public CxxTest::TestSuite
/*printkd("Effective Addr: 0x%lX, %s\n",ea,
message->type==MSG_MM_RP_READ?"READ":"WRITE");*/
message->data[1] = 0;
- rc = msg_respond(iv_mq, message);
+ msg_respond(iv_mq, message);
}
}
}
};
-volatile int VmmBaseTest::rc = 0;
msg_q_t VmmBaseTest::iv_mq = msg_q_create();
#endif
diff --git a/src/usr/testcore/kernel/vmmpagetest.H b/src/usr/testcore/kernel/vmmpagetest.H
index 3559fd3cb..0edbd78f3 100644
--- a/src/usr/testcore/kernel/vmmpagetest.H
+++ b/src/usr/testcore/kernel/vmmpagetest.H
@@ -39,7 +39,6 @@ class vmmpagetest: public CxxTest::TestSuite
public:
static volatile int rc;
- static volatile int iv_rc;
//Testing page removal variables
static msg_q_t iv_mq;
static uint64_t iv_va;
@@ -148,12 +147,11 @@ class vmmpagetest: public CxxTest::TestSuite
}
// try to write to a read_only page
- iv_rc = 0; sync();
+ int status;
printk("\nTest case1: Expect to see uncaught exception! ");
- task_create(writeAddrWithNoPerm, NULL);
- while (iv_rc == 0) task_yield();
- task_yield();
- if (iv_rc == -1)
+ tid_t child = task_create(writeAddrWithNoPerm, NULL);
+ if ((child != task_wait_tid(child, &status, NULL)) ||
+ (status != TASK_STATUS_CRASHED))
{
TS_FAIL("ERROR! Write to READ_ONLY address not caught.");
}
@@ -165,12 +163,10 @@ class vmmpagetest: public CxxTest::TestSuite
}
// try to write to an executable page
- iv_rc = 0; sync();
printk("\nTest case2: Expect to see uncaught exception! ");
- task_create(writeAddrWithNoPerm2, NULL);
- while (iv_rc == 0) task_yield();
- task_yield();
- if (iv_rc == -1)
+ child = task_create(writeAddrWithNoPerm2, NULL);
+ if ((child != task_wait_tid(child, &status, NULL)) ||
+ (status != TASK_STATUS_CRASHED))
{
TS_FAIL("ERROR! Write to EXECUTABLE address not caught.");
}
@@ -182,12 +178,10 @@ class vmmpagetest: public CxxTest::TestSuite
}
// try to write to a no access page
- iv_rc = 0; sync();
printk("\nTest case3: Expect to see uncaught exception! ");
- task_create(writeAddrWithNoPerm, NULL);
- while (iv_rc == 0) task_yield();
- task_yield();
- if (iv_rc == -1)
+ child = task_create(writeAddrWithNoPerm, NULL);
+ if ((child != task_wait_tid(child, &status, NULL)) ||
+ (status != TASK_STATUS_CRASHED))
{
TS_FAIL("ERROR! write to a NO_ACCESS addr not caught.\n");
}
@@ -238,24 +232,19 @@ class vmmpagetest: public CxxTest::TestSuite
static void writeAddrWithNoPerm(void* unused)
{
- iv_rc = 1; sync();
(*(volatile uint64_t *)(iv_va+4*PAGESIZE)) = 0x11111111; sync();
- iv_rc = -1; sync();
task_end();
}
static void writeAddrWithNoPerm2(void* unused)
{
- iv_rc = 1; sync();
(*(volatile uint64_t *)(iv_va+4*PAGESIZE+2*PAGESIZE)) = 0x22222222; sync();
- iv_rc = -1; sync();
task_end();
}
};
volatile int vmmpagetest::rc = 0;
-volatile int vmmpagetest::iv_rc = 0;
msg_q_t vmmpagetest::iv_mq = msg_q_create();
uint64_t vmmpagetest::iv_va = VMM_VADDR_RMVPAGE_TEST;
uint64_t vmmpagetest::iv_size = VMM_SIZE_RMVPAGE_TEST;
OpenPOWER on IntegriCloud