summaryrefslogtreecommitdiffstats
path: root/src/usr/cxxtest/cxxtestexec.C
blob: d79188e9e8d3b769545a306523a0cae364592126 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <sys/vfs.h>
#include <sys/task.h>
#include <string.h>
#include <kernel/console.H>
#include <sys/time.h>
#include <sys/sync.h>

#include <cxxtest/TestSuite.H>

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

/**
 *  @brief _start()
 *  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];
    tid_t   tidrc   =   0;

    printk( "Executing CxxTestExec.\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);

                printk( "CxxTestExec %d : running %s, ModulesStarted=0x%ld\n",
                        __LINE__,
                        vfsItr->module,
                        CxxTest::g_ModulesStarted );
                tidrc = task_exec( vfsItr->module, NULL );
                printk( "CxxTestExec %d : tidrc=%d\n",
                        __LINE__, tidrc );

            }
        }
        vfsItr++;
    }

    __sync_add_and_fetch(&CxxTest::g_ModulesCompleted, 1);
    printk( " ModulesCompleted=0x%ld\n", CxxTest::g_ModulesCompleted );


    printk( "total tests:   %ld\n", CxxTest::g_TotalTests  );
    printk( "failed tests:  %ld\n", CxxTest::g_FailedTests );
    printk( "warnings:      %ld\n", CxxTest::g_Warnings    );
    printk( "trace calls:   %ld\n", CxxTest::g_TraceCalls  );


    task_end();
}
OpenPOWER on IntegriCloud