aboutsummaryrefslogtreecommitdiffstats
path: root/make/scripts/tests.sh
blob: a5369a0dfd931664e0cdef9aa1a756ca3ae17667 (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
function print_usage() {
    echo "Usage: $0 java-exe joal-build-dir"
    echo "e.g.: bash scripts/tests.sh `which java` -d64 ../build-x86_64"
}
    
if [ -z "$1" -o -z "$2" ] ; then
    print_usage
    exit 0
fi

javaexe="$1"
shift
bdir=$1
shift
bdir_base=`basename $bdir`

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

#
# See https://github.com/kcat/openal-soft/blob/master/docs/env-vars.txt
# export ALSOFT_LOGLEVEL=3
#

rm -f java-run.log

spath=`dirname $0`

unset CLASSPATH

which "$javaexe" 2>&1 | tee -a java-run.log
"$javaexe" -version 2>&1 | tee -a java-run.log

GLUEGEN_DIR=$spath/../../../gluegen
GLUEGEN_BDIR=$GLUEGEN_DIR/$bdir_base
if [ ! -d $GLUEGEN_DIR -o ! -d $GLUEGEN_BDIR ] ; then
    echo GLUEGEN not found
    print_usage
    exit
fi
JUNIT_JAR=$GLUEGEN_DIR/make/lib/junit.jar

if [ -z "$ANT_PATH" ] ; then
    ANT_PATH=$(dirname $(dirname $(which ant)))
    if [ -e $ANT_PATH/lib/ant.jar ] ; then
        export ANT_PATH
        echo autosetting ANT_PATH to $ANT_PATH
    fi
fi
if [ -z "$ANT_PATH" ] ; then
    echo ANT_PATH does not exist, set it
    print_usage
    exit
fi
ANT_JARS=$ANT_PATH/lib/ant.jar:$ANT_PATH/lib/ant-junit.jar

function jrun() {
    #D_ARGS="-Djogamp.debug=all"
    #D_ARGS="-Djogamp.debug.Bitstream"
    #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djoal.debug=true"
    D_ARGS="-Djogamp.debug.AudioSink"
    #D_ARGS="-Djogamp.debug.AudioSink -Djoal.debug.AudioSink.trace"
    #D_ARGS="-Djoal.debug.AudioSink.trace"
    #D_ARGS="-Djoal.debug=all"
    #D_ARGS="-Djogamp.debug.JNILibLoader"
    #X_ARGS="-verbose:jni"
    #X_ARGS="-Xcheck:jni"
    #X_ARGS="-verbose:jni -Xcheck:jni -Xrs -Xnoclassgc"
    #X_ARGS="-Xrs"

    # StartFlightRecording: delay=10s,
    # FlightRecorderOptions: stackdepth=2048
    # Enable remote connection to jmc: jcmd <PID> ManagementAgent.start jmxremote.authenticate=false jmxremote.ssl=false jmxremote.port=7091
    # X_ARGS="-XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints $X_ARGS"
    # X_ARGS="-XX:FlightRecorderOptions=stackdepth=2048,threadbuffersize=16k $X_ARGS"
    # X_ARGS="-XX:StartFlightRecording=delay=10s,dumponexit=true,filename=java-run.jfr $X_ARGS"

    export CLASSPATH=$GLUEGEN_BDIR/gluegen-rt.jar:$bdir/jar/joal.jar:$bdir/jar/joal-test.jar:$JUNIT_JAR:$ANT_JARS
    #export CLASSPATH=$GLUEGEN_BDIR/gluegen-rt.jar:$bdir/jar/joal.jar:$bdir/jar/joal-natives.jar:$bdir/jar/joal-test.jar:$JUNIT_JAR:$ANT_JARS
    echo CLASSPATH $CLASSPATH

    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 testnormal() {
    jrun $* 2>&1 | tee -a java-run.log
}


#testnormal com.jogamp.openal.JoalVersion $*
#testnormal com.jogamp.openal.test.manual.OpenALTest $*
#testnormal com.jogamp.openal.test.manual.Sound3DTest $*
#testnormal com.jogamp.openal.test.manual.Synth01AL $*
testnormal com.jogamp.openal.test.manual.Synth02AL $*
#testnormal com.jogamp.openal.test.manual.Synth02bAL $*
#testnormal com.jogamp.openal.test.junit.ALVersionTest $*
#testnormal com.jogamp.openal.test.junit.ALutWAVLoaderTest $*
#testnormal com.jogamp.openal.test.junit.ALExtLoopbackDeviceSOFTTest $*