add sy6: locktest2
This commit is contained in:
parent
92fbcef5af
commit
c1216b66b3
@ -59,6 +59,7 @@ int threadtest2(int, char **);
|
|||||||
int threadtest3(int, char **);
|
int threadtest3(int, char **);
|
||||||
int semtest(int, char **);
|
int semtest(int, char **);
|
||||||
int locktest(int, char **);
|
int locktest(int, char **);
|
||||||
|
int locktest2(int, char **);
|
||||||
int cvtest(int, char **);
|
int cvtest(int, char **);
|
||||||
int cvtest2(int, char **);
|
int cvtest2(int, char **);
|
||||||
int rwtest(int, char **);
|
int rwtest(int, char **);
|
||||||
|
@ -480,6 +480,7 @@ static const char *testmenu[] = {
|
|||||||
"[sy3] CV test (1) ",
|
"[sy3] CV test (1) ",
|
||||||
"[sy4] CV test #2 (1) ",
|
"[sy4] CV test #2 (1) ",
|
||||||
"[sy5] RW lock test (1) ",
|
"[sy5] RW lock test (1) ",
|
||||||
|
"[sy6] Lock test #2 (1) ",
|
||||||
#if OPT_SYNCHPROBS
|
#if OPT_SYNCHPROBS
|
||||||
"[sp1] Whalemating test (1) ",
|
"[sp1] Whalemating test (1) ",
|
||||||
"[sp2] Stoplight test (1) ",
|
"[sp2] Stoplight test (1) ",
|
||||||
@ -614,6 +615,7 @@ static struct {
|
|||||||
{ "sy3", cvtest },
|
{ "sy3", cvtest },
|
||||||
{ "sy4", cvtest2 },
|
{ "sy4", cvtest2 },
|
||||||
{ "sy5", rwtest },
|
{ "sy5", rwtest },
|
||||||
|
{ "sy6", locktest2 },
|
||||||
#if OPT_SYNCHPROBS
|
#if OPT_SYNCHPROBS
|
||||||
{ "sp1", whalemating },
|
{ "sp1", whalemating },
|
||||||
{ "sp2", stoplight },
|
{ "sp2", stoplight },
|
||||||
|
@ -228,6 +228,26 @@ locktestthread(void *junk, unsigned long num)
|
|||||||
V(donesem);
|
V(donesem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void
|
||||||
|
locktestthread2(void *junk, unsigned long num)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
(void)junk;
|
||||||
|
(void)num;
|
||||||
|
for (i=0; i<NLOCKLOOPS; i++) {
|
||||||
|
lock_acquire(testlock);
|
||||||
|
|
||||||
|
if (!lock_do_i_hold(testlock)) {
|
||||||
|
test_status = FAIL;
|
||||||
|
}
|
||||||
|
random_yielder(4);
|
||||||
|
|
||||||
|
lock_release(testlock);
|
||||||
|
}
|
||||||
|
V(donesem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
locktest(int nargs, char **args)
|
locktest(int nargs, char **args)
|
||||||
@ -257,6 +277,35 @@ locktest(int nargs, char **args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
locktest2(int nargs, char **args)
|
||||||
|
{
|
||||||
|
int i, result;
|
||||||
|
|
||||||
|
(void)nargs;
|
||||||
|
(void)args;
|
||||||
|
|
||||||
|
inititems();
|
||||||
|
test_status = SUCCESS;
|
||||||
|
kprintf_n("Starting lock test 2...\n");
|
||||||
|
|
||||||
|
for (i=0; i<NTHREADS; i++) {
|
||||||
|
result = thread_fork("synchtest", NULL, locktestthread2, NULL, i);
|
||||||
|
if (result) {
|
||||||
|
panic("locktest: thread_fork failed: %s\n", strerror(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i=0; i<NTHREADS; i++) {
|
||||||
|
P(donesem);
|
||||||
|
}
|
||||||
|
|
||||||
|
kprintf_n("Lock test 2 done.\n");
|
||||||
|
success(test_status, SECRET, "sy2");
|
||||||
|
lock_release(testlock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
cvtestthread(void *junk, unsigned long num)
|
cvtestthread(void *junk, unsigned long num)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user