summaryrefslogtreecommitdiffstats
path: root/src/usr/cxxtest/cxxtestexec.C
blob: b4785cbc52b00451009a19dbcbd2b53e7297e56f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <sys/vfs.h>
#include <sys/task.h>
#include <string.h>
#include <kernel/console.H>

namespace CxxTest
{
    uint64_t g_ModulesStarted = 0;
    uint64_t g_ModulesCompleted = 0;
}

/* Iterate through all modules in the VFS named "libtest*" and create children
 * tasks to execute them. 
 */
extern "C"
void _start(void*) 
{
    VfsSystemModule* vfsItr = &VFS_MODULES[0];

    printk( "Executing CxxTestExec module.\n");
    __sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);

    while(vfsItr->module[0] != '\0')
    {
        if (0 == memcmp(vfsItr->module, "libtest", 7))
        {
            if (NULL != vfsItr->start)
            {
                __sync_add_and_fetch(&CxxTest::g_ModulesStarted, 1);
                task_exec(vfsItr->module, NULL);
            }
        }
        vfsItr++;
    }

    __sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);

    task_end();
}
OpenPOWER on IntegriCloud