summaryrefslogtreecommitdiffstats
path: root/make/scripts/tests.sh
blob: 3b69eac06c1b5c1f9cc452fa426d42fd05c0522b (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#! /bin/bash

if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then
    echo Usage $0 java-exe java-xargs build-dir
    exit 0
fi

javaexe="$1"
shift
javaxargs=$1
shift
bdir="$1"
shift

if [ ! -x "$javaexe" ] ; then
    echo java-exe "$javaexe" is not an executable
    exit 1
fi
if [ ! -d "$bdir" ] ; then
    echo build-dir "$bdir" is not a directory
    exit 1
fi

rm -f java-run.log

spath=`dirname $0`

. $spath/setenv-jocl.sh "$bdir"
unset CLASSPATH

MOSX=0
MOSX_MT=0
uname -a | grep -i Darwin && MOSX=1
if [ $MOSX -eq 1 ] ; then
    echo setup OSX environment vars
    #export NSZombieEnabled=YES
    export NSTraceEvents=YES
    #export OBJC_PRINT_EXCEPTIONS=YES
    echo NSZombieEnabled $NSZombieEnabled 2>&1 | tee -a java-run.log
    echo NSTraceEvents $NSTraceEvents  2>&1 | tee -a java-run.log
    echo OBJC_PRINT_EXCEPTIONS $OBJC_PRINT_EXCEPTIONS  2>&1 | tee -a java-run.log
    MOSX_MT=1
fi

#export LD_LIBRARY_PATH=/opt-linux-x86_64/opencl-lala/lib64:$LD_LIBRARY_PATH

which "$javaexe" 2>&1 | tee -a java-run.log
"$javaexe" -version 2>&1 | tee -a java-run.log
echo LD_LIBRARY_PATH $LD_LIBRARY_PATH 2>&1 | tee -a java-run.log
echo "$javaexe" $javaxargs $X_ARGS $D_ARGS $* 2>&1 | tee -a java-run.log
echo MacOsX $MOSX

function jrun() {
    awton=$1
    shift

    #D_ARGS="-Djocl.debug.DebugCL -Djocl.debug.TraceCL"

    #D_ARGS="-Djogamp.debug=all"
    #D_ARGS="-Dnativewindow.debug=all"
    #D_ARGS="-Djogl.debug=all"
    #D_ARGS="-Dnewt.debug=all"
    #D_ARGS="-Djocl=all"

    #X_ARGS="-verbose:jni"
    #X_ARGS="-Xrs"

    if [ $awton -eq 1 ] ; then
        export CLASSPATH=$JOGAMP_ALL_CLASSPATH
        echo CLASSPATH $CLASSPATH
        X_ARGS="-Djava.awt.headless=false $X_ARGS"
    else
        export CLASSPATH=$JOGAMP_ALL_CLASSPATH
        X_ARGS="-Djava.awt.headless=true $X_ARGS"
    fi
    if [ ! -z "$CUSTOM_CLASSPATH" ] ; then
        export CLASSPATH=$CUSTOM_CLASSPATH:$CLASSPATH
    fi
    echo CLASSPATH $CLASSPATH
    if [ $MOSX_MT -eq 1 ] ; then
        if [ $awton -eq 0 ] ; then
            # No AWT, No SWT -> Preserve Main-Thread
            X_ARGS="-XstartOnFirstThread $X_ARGS"
            C_ARG="com.jogamp.newt.util.MainThread"
        fi
    fi
    echo
    echo "Test Start: $*"
    echo
    echo "$javaexe" $javaxargs $X_ARGS $D_ARGS $C_ARG $*
    #gdb --args "$javaexe" $javaxargs $X_ARGS $D_ARGS $C_ARG $*
    "$javaexe" $javaxargs $X_ARGS $D_ARGS $C_ARG $*
    echo
    echo "Test End: $*"
    echo
}

function testnoawt() {
    jrun 0 $* 2>&1 | tee -a java-run.log
}

function testawt() {
    MOSX_MT=0
    jrun 1 $* 2>&1 | tee -a java-run.log
}

#
# Version
#
testnoawt com.jogamp.opencl.JoclVersion $*

#
#
#testnoawt com.jogamp.opencl.CLBufferTest $*
#testnoawt com.jogamp.opencl.CLCommandQueueTest $*
#testnoawt com.jogamp.opencl.CLExceptionTest $*
#testnoawt com.jogamp.opencl.CLImageTest $*
#testnoawt com.jogamp.opencl.CLProgramTest $*
#testnoawt com.jogamp.opencl.HighLevelBindingTest $*
#testnoawt com.jogamp.opencl.LowLevelBindingTest $*
#testnoawt com.jogamp.opencl.TestJoclVersion $*
#testnoawt com.jogamp.opencl.TestUtils $*
#testnoawt com.jogamp.opencl.gl.CLGLTest $*
#testnoawt com.jogamp.opencl.util.concurrent.CLMultiContextTest $*