summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel.rs
blob: d6c9df3704973b41db9e24be8e2586ac98075ce0 (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
#include "shared.rsh"

int *ain;
int *aout;
int dimX;
static bool failed = false;

void init_vars(int *out) {
    *out = 7;
}


int __attribute__((kernel)) root(int ain, uint32_t x) {
    _RS_ASSERT(ain == 7);
    return ain + x;
}

static bool test_root_output() {
    bool failed = false;
    int i;

    for (i = 0; i < dimX; i++) {
        _RS_ASSERT(aout[i] == (i + ain[i]));
    }

    if (failed) {
        rsDebug("test_root_output FAILED", 0);
    }
    else {
        rsDebug("test_root_output PASSED", 0);
    }

    return failed;
}

void verify_root() {
    failed |= test_root_output();
}

void kernel_test() {
    if (failed) {
        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
    }
    else {
        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
    }
}