qa: various fix to tests
This commit is contained in:
parent
93dde48355
commit
1c4a04cd30
@ -78,6 +78,7 @@ main(void)
|
|||||||
print("FAIL: rendezvous\n");
|
print("FAIL: rendezvous\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
forgivewkp(wkup);
|
||||||
|
|
||||||
/* verify that sleeps are NOT interrupted */
|
/* verify that sleeps are NOT interrupted */
|
||||||
fprint(2, "verify that sleeps are NOT interrupted\n", elapsed);
|
fprint(2, "verify that sleeps are NOT interrupted\n", elapsed);
|
||||||
@ -91,6 +92,7 @@ main(void)
|
|||||||
print("FAIL: sleep\n");
|
print("FAIL: sleep\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
forgivewkp(wkup);
|
||||||
|
|
||||||
/* verify that semacquires are interrupted */
|
/* verify that semacquires are interrupted */
|
||||||
fprint(2, "verify that semacquires are interrupted\n", elapsed);
|
fprint(2, "verify that semacquires are interrupted\n", elapsed);
|
||||||
@ -107,6 +109,7 @@ main(void)
|
|||||||
print("FAIL: semacquire\n");
|
print("FAIL: semacquire\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
forgivewkp(wkup);
|
||||||
|
|
||||||
/* verify that tsemacquire are NOT interrupted */
|
/* verify that tsemacquire are NOT interrupted */
|
||||||
fprint(2, "verify that tsemacquire are NOT interrupted\n", elapsed);
|
fprint(2, "verify that tsemacquire are NOT interrupted\n", elapsed);
|
||||||
@ -120,6 +123,7 @@ main(void)
|
|||||||
print("FAIL: tsemacquire\n");
|
print("FAIL: tsemacquire\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
forgivewkp(wkup);
|
||||||
|
|
||||||
/* verify that reads are interrupted */
|
/* verify that reads are interrupted */
|
||||||
fprint(2, "verify that reads are interrupted\n", elapsed);
|
fprint(2, "verify that reads are interrupted\n", elapsed);
|
||||||
@ -137,6 +141,7 @@ main(void)
|
|||||||
print("FAIL: read\n");
|
print("FAIL: read\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
forgivewkp(wkup);
|
||||||
|
|
||||||
/* verify that writes are interrupted */
|
/* verify that writes are interrupted */
|
||||||
fprint(2, "verify that writes are interrupted\n", elapsed);
|
fprint(2, "verify that writes are interrupted\n", elapsed);
|
||||||
@ -154,6 +159,7 @@ main(void)
|
|||||||
print("FAIL: write\n");
|
print("FAIL: write\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
forgivewkp(wkup);
|
||||||
|
|
||||||
/* do not forgivewkp the awake(100000): the kernel must handle it */
|
/* do not forgivewkp the awake(100000): the kernel must handle it */
|
||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
|
@ -28,6 +28,7 @@ handler(void *v, char *s)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits(nil);
|
exits(nil);
|
||||||
}
|
}
|
||||||
|
forgivewkp(wakeup);
|
||||||
print("FAIL in note handler\n");
|
print("FAIL in note handler\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
"cp *.rc $JEHANNE/arch/$ARCH/qa/kern/",
|
"cp *.rc $JEHANNE/arch/$ARCH/qa/kern/",
|
||||||
"cp *.runner $JEHANNE/arch/$ARCH/qa/kern/"
|
"cp *.runner $JEHANNE/arch/$ARCH/qa/kern/"
|
||||||
],
|
],
|
||||||
"Disabled": [
|
|
||||||
"fork_chain.c"
|
|
||||||
],
|
|
||||||
"SourceFilesCmd": [
|
"SourceFilesCmd": [
|
||||||
"alarm.c",
|
"alarm.c",
|
||||||
"args.c",
|
"args.c",
|
||||||
@ -21,6 +18,7 @@
|
|||||||
"execl.c",
|
"execl.c",
|
||||||
"float.c",
|
"float.c",
|
||||||
"fork.c",
|
"fork.c",
|
||||||
|
"fork_chain.c",
|
||||||
"frexp.c",
|
"frexp.c",
|
||||||
"getmainpid.c",
|
"getmainpid.c",
|
||||||
"getpid.c",
|
"getpid.c",
|
||||||
|
@ -27,6 +27,7 @@ handler(void *v, char *s)
|
|||||||
int i;
|
int i;
|
||||||
if(strcmp(s, "stop") == 0){
|
if(strcmp(s, "stop") == 0){
|
||||||
done = 1;
|
done = 1;
|
||||||
|
print("stop note received; done = %d\n", done);
|
||||||
}else{
|
}else{
|
||||||
print("waiting after %s", s);
|
print("waiting after %s", s);
|
||||||
for(i = 0; i < 1000*1000; ++i)
|
for(i = 0; i < 1000*1000; ++i)
|
||||||
@ -62,6 +63,6 @@ main(int argc, char**argv)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("%d notes received\n");
|
print("%d notes received\n", waited);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"rsleept1.c",
|
"rsleept1.c",
|
||||||
"rsleept2.c",
|
"rsleept2.c",
|
||||||
"rwakeup0.c",
|
"rwakeup0.c",
|
||||||
|
"rwakeup1.c",
|
||||||
"sleep.c",
|
"sleep.c",
|
||||||
"sqrt.c",
|
"sqrt.c",
|
||||||
"sysfatal.c",
|
"sysfatal.c",
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <lib9.h>
|
#include <lib9.h>
|
||||||
|
|
||||||
|
// from kernel's mem.h
|
||||||
|
#define MiB (1024*1024)
|
||||||
|
#define TSTKTOP (0x00007ffffffff000ull)
|
||||||
|
#define USTKSIZE (16*MiB) /* size of user stack */
|
||||||
|
#define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Njmps = 10000
|
Njmps = 10000
|
||||||
};
|
};
|
||||||
@ -23,16 +29,26 @@ main(void)
|
|||||||
fprint(2, "label[%d] = %p\n", i, label[i]);
|
fprint(2, "label[%d] = %p\n", i, label[i]);
|
||||||
fprint(2, "main: %p foo: %p\n", main, foo);
|
fprint(2, "main: %p foo: %p\n", main, foo);
|
||||||
|
|
||||||
if(njmp != Njmps)
|
if(njmp != Njmps){
|
||||||
|
print("error: njmp = %d\n", njmp);
|
||||||
fail++;
|
fail++;
|
||||||
if(label[JMPBUFPC] < (uintptr_t)main)
|
}
|
||||||
|
if(label[JMPBUFPC] < (uintptr_t)main){
|
||||||
|
print("error: label[JMPBUFPC] = %#p\n", label[JMPBUFPC]);
|
||||||
fail++;
|
fail++;
|
||||||
if(label[JMPBUFPC] > (uintptr_t)foo)
|
}
|
||||||
|
if(label[JMPBUFPC] > (uintptr_t)foo){
|
||||||
|
print("error: label[JMPBUFPC] = %#p\n", label[JMPBUFPC]);
|
||||||
fail++;
|
fail++;
|
||||||
if(label[JMPBUFSP] > (uintptr_t)&label[nelem(label)])
|
}
|
||||||
|
if(label[JMPBUFSP] > (uintptr_t)&label[nelem(label)]){
|
||||||
|
print("error: label[JMPBUFSP] (%#p) is greater then &label[nelem(label)] (%#p) \n", label[JMPBUFPC], &label[nelem(label)]);
|
||||||
fail++;
|
fail++;
|
||||||
if(label[JMPBUFSP] < 0x7fffffd00000)
|
}
|
||||||
|
if(label[JMPBUFSP] < USTKTOP-USTKSIZE){
|
||||||
|
print("error: label[JMPBUFSP] (%#p) is lower then USTKTOP-USTKSIZE \n", label[JMPBUFSP]);
|
||||||
fail++;
|
fail++;
|
||||||
|
}
|
||||||
|
|
||||||
if(fail == 0){
|
if(fail == 0){
|
||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
|
@ -149,11 +149,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -212,6 +215,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -220,6 +220,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,11 +150,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -205,11 +208,11 @@ main(void)
|
|||||||
}
|
}
|
||||||
average = average / NPROC / (1000 * 1000);
|
average = average / NPROC / (1000 * 1000);
|
||||||
|
|
||||||
if(average < 100) /* we asked for 1ms... we are dumb, after all */
|
if(average < 300) /* we asked for 1ms... we are dumb, after all */
|
||||||
{
|
{
|
||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,11 +150,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -212,6 +215,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -154,11 +154,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average, end;
|
int64_t average, end;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -222,6 +225,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -126,15 +126,17 @@ waiter(int index)
|
|||||||
return end != start ? nil : "FAIL";
|
return end != start ? nil : "FAIL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lastspawn;
|
||||||
void
|
void
|
||||||
spawnWaiter(int index)
|
spawnWaiter(int index)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid, ls = lastspawn;
|
||||||
char * res;
|
char * res;
|
||||||
|
|
||||||
switch((pid = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
switch((pid = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
++lastspawn;
|
||||||
res = waiter(index);
|
res = waiter(index);
|
||||||
exits(res);
|
exits(res);
|
||||||
break;
|
break;
|
||||||
@ -143,6 +145,8 @@ spawnWaiter(int index)
|
|||||||
exits("rfork fails");
|
exits("rfork fails");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
while(ls == lastspawn)
|
||||||
|
;
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("spawn reader %d\n", pid);
|
print("spawn reader %d\n", pid);
|
||||||
break;
|
break;
|
||||||
@ -150,11 +154,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -207,11 +214,11 @@ main(void)
|
|||||||
}
|
}
|
||||||
average = average / NPROC / (1000 * 1000);
|
average = average / NPROC / (1000 * 1000);
|
||||||
|
|
||||||
if(average < 100) /* we asked for 1ms... we are dumb, after all */
|
if(average < 300) /* we asked for 1ms... we are dumb, after all */
|
||||||
{
|
{
|
||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -152,11 +152,14 @@ spawnsleeper(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -211,6 +214,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -156,11 +156,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i, awakened;
|
int i, awakened;
|
||||||
int64_t average, end;
|
int64_t average, end;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -225,6 +228,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
// printdebugrendezvouslogs();
|
// printdebugrendezvouslogs();
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
@ -130,15 +130,17 @@ sleeper(int index)
|
|||||||
return end != start ? nil : "FAIL";
|
return end != start ? nil : "FAIL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lastspawn;
|
||||||
void
|
void
|
||||||
spawnsleeper(int index)
|
spawnsleeper(int index)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid, ls = lastspawn;
|
||||||
char * res;
|
char * res;
|
||||||
|
|
||||||
switch((pid = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
switch((pid = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
++lastspawn;
|
||||||
res = sleeper(index);
|
res = sleeper(index);
|
||||||
exits(res);
|
exits(res);
|
||||||
break;
|
break;
|
||||||
@ -147,6 +149,8 @@ spawnsleeper(int index)
|
|||||||
exits("rfork fails");
|
exits("rfork fails");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
while(ls == lastspawn)
|
||||||
|
;
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("spawn sleeper %d\n", pid);
|
print("spawn sleeper %d\n", pid);
|
||||||
break;
|
break;
|
||||||
@ -154,11 +158,14 @@ spawnsleeper(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -213,6 +220,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -71,11 +71,14 @@ stopAllAfter(int seconds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int s, w;
|
int s, w;
|
||||||
|
|
||||||
rfork(RFNOTEG);
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
|
rfork(RFNOTEG|RFREND);
|
||||||
if (!atnotify(handletimeout, 1)){
|
if (!atnotify(handletimeout, 1)){
|
||||||
fprint(2, "%r\n");
|
fprint(2, "%r\n");
|
||||||
exits("atnotify fails");
|
exits("atnotify fails");
|
||||||
@ -88,8 +91,8 @@ main(void)
|
|||||||
switch((s = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
switch((s = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ready = 1;
|
|
||||||
qlock(&l);
|
qlock(&l);
|
||||||
|
ready = 1;
|
||||||
rsleep(&r);
|
rsleep(&r);
|
||||||
qunlock(&l);
|
qunlock(&l);
|
||||||
exits(nil);
|
exits(nil);
|
||||||
@ -109,8 +112,8 @@ main(void)
|
|||||||
case 0:
|
case 0:
|
||||||
qlock(&l);
|
qlock(&l);
|
||||||
rwakeup(&r);
|
rwakeup(&r);
|
||||||
ready = 2;
|
|
||||||
qunlock(&l);
|
qunlock(&l);
|
||||||
|
ready = 2;
|
||||||
exits(nil);
|
exits(nil);
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
@ -137,6 +140,6 @@ main(void)
|
|||||||
write(s, "kill", 5);
|
write(s, "kill", 5);
|
||||||
close(s);
|
close(s);
|
||||||
}
|
}
|
||||||
print("FAIL");
|
print("FAIL\n");
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
126
qa/lib/c/rwakeup1.c
Normal file
126
qa/lib/c/rwakeup1.c
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Jehanne.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
|
||||||
|
*
|
||||||
|
* Jehanne is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 2 of the License.
|
||||||
|
*
|
||||||
|
* Jehanne is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <u.h>
|
||||||
|
#include <lib9.h>
|
||||||
|
|
||||||
|
/* verify that rwakeup returns 0 on Rendez that was timedout */
|
||||||
|
|
||||||
|
Rendez r;
|
||||||
|
QLock l;
|
||||||
|
int ready;
|
||||||
|
int verbose = 0;
|
||||||
|
|
||||||
|
int killerProc; /* pid, will kill the other processes if starved */
|
||||||
|
|
||||||
|
int
|
||||||
|
handletimeout(void *v, char *s)
|
||||||
|
{
|
||||||
|
/* just not exit, please */
|
||||||
|
if(strcmp(s, "timedout") == 0){
|
||||||
|
if(verbose)
|
||||||
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
|
print("FAIL: %s timedout\n", argv0);
|
||||||
|
exits("FAIL");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
killKiller(void)
|
||||||
|
{
|
||||||
|
postnote(PNPROC, killerProc, "interrupt");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stopAllAfter(int seconds)
|
||||||
|
{
|
||||||
|
int pid;
|
||||||
|
|
||||||
|
switch((pid = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if(verbose)
|
||||||
|
print("killer proc started: pid %d\n", getpid());
|
||||||
|
sleep(seconds * 1000);
|
||||||
|
postnote(PNGROUP, killerProc, "timedout");
|
||||||
|
if(verbose)
|
||||||
|
print("killer proc timedout: pid %d\n", getpid());
|
||||||
|
exits("FAIL");
|
||||||
|
case -1:
|
||||||
|
fprint(2, "%r\n");
|
||||||
|
exits("rfork fails");
|
||||||
|
default:
|
||||||
|
killerProc = pid;
|
||||||
|
atexit(killKiller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
int s, w;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
|
rfork(RFNOTEG|RFREND);
|
||||||
|
if (!atnotify(handletimeout, 1)){
|
||||||
|
fprint(2, "%r\n");
|
||||||
|
exits("atnotify fails");
|
||||||
|
}
|
||||||
|
|
||||||
|
r.l = &l;
|
||||||
|
|
||||||
|
stopAllAfter(30);
|
||||||
|
/* one process to sleep for 100ms */
|
||||||
|
switch((s = rfork(RFMEM|RFPROC|RFNOWAIT)))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
qlock(&l);
|
||||||
|
rsleept(&r, 100);
|
||||||
|
qunlock(&l);
|
||||||
|
ready = 1;
|
||||||
|
exits(nil);
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
print("rfork: %r\n");
|
||||||
|
exits("rfork fails");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
while(ready == 0)
|
||||||
|
;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* now, we try to wakeup a free Rendez */
|
||||||
|
qlock(&l);
|
||||||
|
if(rwakeup(&r) == 0){
|
||||||
|
qunlock(&l);
|
||||||
|
print("PASS\n");
|
||||||
|
exits("PASS");
|
||||||
|
}
|
||||||
|
if((s = open(smprint("/proc/%d/ctl", s), OWRITE)) >= 0){
|
||||||
|
write(s, "kill", 5);
|
||||||
|
close(s);
|
||||||
|
}
|
||||||
|
if((w = open(smprint("/proc/%d/ctl", w), OWRITE)) >= 0){
|
||||||
|
write(s, "kill", 5);
|
||||||
|
close(s);
|
||||||
|
}
|
||||||
|
print("FAIL\n");
|
||||||
|
exits("FAIL");
|
||||||
|
}
|
@ -71,7 +71,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,11 +150,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -212,6 +215,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -154,11 +154,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average, end;
|
int64_t average, end;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -222,6 +225,6 @@ main(void)
|
|||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ handletimeout(void *v, char *s)
|
|||||||
if(strcmp(s, "timedout") == 0){
|
if(strcmp(s, "timedout") == 0){
|
||||||
if(verbose)
|
if(verbose)
|
||||||
print("%d: noted: %s\n", getpid(), s);
|
print("%d: noted: %s\n", getpid(), s);
|
||||||
print("FAIL: timedout\n");
|
print("FAIL: %s timedout\n", argv0);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,11 +150,14 @@ spawnWaiter(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(void)
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t average;
|
int64_t average;
|
||||||
|
|
||||||
|
ARGBEGIN{
|
||||||
|
}ARGEND;
|
||||||
|
|
||||||
rfork(RFNOTEG|RFREND);
|
rfork(RFNOTEG|RFREND);
|
||||||
rStart.l = &rl;
|
rStart.l = &rl;
|
||||||
rCompleted.l = &rl;
|
rCompleted.l = &rl;
|
||||||
@ -207,11 +210,11 @@ main(void)
|
|||||||
}
|
}
|
||||||
average = average / NPROC / (1000 * 1000);
|
average = average / NPROC / (1000 * 1000);
|
||||||
|
|
||||||
if(average < 100) /* we asked for 1ms... we are dumb, after all */
|
if(average < 300) /* we asked for 1ms... we are dumb, after all */
|
||||||
{
|
{
|
||||||
print("PASS\n");
|
print("PASS\n");
|
||||||
exits("PASS");
|
exits("PASS");
|
||||||
}
|
}
|
||||||
print("FAIL: average timeout too long %lld ms\n", average);
|
print("FAIL: %s: average timeout too long %lld ms\n", argv0, average);
|
||||||
exits("FAIL");
|
exits("FAIL");
|
||||||
}
|
}
|
||||||
|
@ -76,18 +76,18 @@
|
|||||||
"SourceFiles": [
|
"SourceFiles": [
|
||||||
"libposix_sigchld.c"
|
"libposix_sigchld.c"
|
||||||
],
|
],
|
||||||
"Disabled": [
|
"SourceFilesCmd": [
|
||||||
|
"000-hello.c",
|
||||||
"010-fork.c",
|
"010-fork.c",
|
||||||
"020-waitpid.c",
|
"020-waitpid.c",
|
||||||
|
"100-files.c",
|
||||||
|
"101-files.c",
|
||||||
"200-signals.c",
|
"200-signals.c",
|
||||||
"201-signals.c",
|
"201-signals.c",
|
||||||
"202-signals.c",
|
"202-signals.c",
|
||||||
"203-signals.c"
|
"203-signals.c",
|
||||||
],
|
"204-signals.c",
|
||||||
"SourceFilesCmd": [
|
"205-signals.c"
|
||||||
"000-hello.c",
|
|
||||||
"100-files.c",
|
|
||||||
"101-files.c"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"NewlibTestsuite": {
|
"NewlibTestsuite": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user