Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / test / childstatus.c
blob6dd54c5839ee3a3bcccb8bc0aff73fb64a6ce8c6
1 #include <proto/exec.h>
2 #include <dos/dosextens.h>
3 #include <proto/dos.h>
4 #include <assert.h>
6 LONG entry()
8 Delay(50);
9 return 0;
12 int main()
14 struct Process *child;
16 struct TagItem tags[] =
18 { NP_Entry, (IPTR) entry },
19 { NP_Cli, (IPTR) TRUE },
20 { NP_Name, (IPTR) "test" },
21 { NP_NotifyOnDeath, (IPTR) TRUE },
22 { TAG_DONE, 0 }
25 child = CreateNewProc(tags);
27 if(child)
29 ULONG childstatus;
30 ULONG childid = GetETask((struct Task*) child)->et_UniqueID;
31 Printf("Checking status value for non-existing child id\n");
32 childstatus = ChildStatus(-1);
33 assert(childstatus == CHILD_NOTFOUND);
34 Printf("Result: CHILD_NOTFOUND\n");
35 Printf("Checking status value for running child id\n");
36 childstatus = ChildStatus(childid);
37 assert(childstatus == CHILD_ACTIVE);
38 Printf("Result: CHILD_ACTIVE\n");
39 ChildWait(childid);
40 Printf("Checking status value for died child id\n");
41 childstatus = ChildStatus(childid);
42 assert(childstatus == CHILD_EXITED);
43 Printf("Result: CHILD_EXITED\n");
44 ChildFree(childid);
45 Printf("Checking status value for freed child id\n");
46 childstatus = ChildStatus(childid);
47 assert(childstatus == CHILD_NOTFOUND);
48 Printf("Result: CHILD_NOTFOUND\n");
50 else
51 PrintFault(IoErr(), "Couldn't create child process");
52 return 0;