OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [baremetal/] [test_suite/] [main.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Main function for all tests
3
 *
4
 * Copyright (C) 2009 B Labs Ltd.
5
 */
6
#include <l4/api/errno.h>
7
#include <container.h>
8
#include <thread.h>
9
#include <tests.h>
10
#include <l4lib/macros.h>
11
#include L4LIB_INC_ARCH(syslib.h)
12
#include L4LIB_INC_ARCH(syscalls.h)
13
#include <l4/api/space.h>
14
 
15
 
16
int exit_test_thread(void *arg)
17
{
18
        while (1)
19
                ;
20
        //l4_thread_switch(0);
21
        //l4_exit(5);
22
        return 0;
23
}
24
 
25
int exit_test(void)
26
{
27
        int ret;
28
        struct task_ids ids;
29
 
30
        /* Create and run a new thread */
31
        if ((ret = thread_create(exit_test_thread, 0,
32
                                 TC_SHARE_SPACE | TC_AS_PAGER,
33
                                 &ids)) < 0) {
34
                printf("Top-level simple_pager creation failed.\n");
35
                goto out_err;
36
        } else
37
                printf("Thread (%d) created successfully.\n", ids.tid);
38
 
39
        // l4_thread_switch(0);
40
 
41
        /* Kill it */
42
        printf("Killing Thread (%d).\n", ids.tid);
43
        if ((ret = l4_thread_control(THREAD_DESTROY, &ids)) < 0)
44
                printf("Error: Killing Thread (%d), err = %d\n", ids.tid, ret);
45
        else
46
                printf("Success: Killed Thread (%d)\n", ids.tid);
47
 
48
 
49
#if 0
50
        /* Wait on it */
51
        printf("Waiting on Thread (%d) to exit.\n", ids.tid);
52
        if ((ret = l4_thread_control(THREAD_WAIT, &ids)) >= 0)
53
                printf("Success. Paged child returned %d\n", ret);
54
        else
55
                printf("Error. Wait on (%d) failed. err = %d\n",
56
                       ids.tid, ret);
57
 
58
#endif
59
        return 0;
60
out_err:
61
        BUG();
62
}
63
 
64
int main(void)
65
{
66
        printf("%s: Container %s started\n",
67
               __CONTAINER__, __CONTAINER_NAME__);
68
 
69
        capability_test();
70
 
71
        //exit_test();
72
 
73
        /* Now quit to demo self-paging quit */
74
        //l4_exit(0);
75
 
76
        /* Now quit by null pointer */
77
        //      *((int *)0) = 5;
78
 
79
        return 0;
80
}
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.