aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run-java-trial.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/run-java-trial.sh')
-rwxr-xr-xscripts/run-java-trial.sh54
1 files changed, 31 insertions, 23 deletions
diff --git a/scripts/run-java-trial.sh b/scripts/run-java-trial.sh
index 7e54a8cf..836611cc 100755
--- a/scripts/run-java-trial.sh
+++ b/scripts/run-java-trial.sh
@@ -17,30 +17,32 @@ sdir=`dirname $(readlink -f $0)`
rootdir=`dirname $sdir`
bname=`basename $0 .sh`
-. $sdir/setup-machine-arch.sh
+. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet"
-build_dir=${rootdir}/build-${archabi}
+dist_dir=$rootdir/"dist-$os_name-$archabi"
+build_dir=$rootdir/"build-$os_name-$archabi"
+echo dist_dir $dist_dir
+echo build_dir $build_dir
-if [ -e /usr/lib/jvm/java-17-openjdk-$archabi ] ; then
- export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$archabi
-elif [ -e /usr/lib/jvm/java-11-openjdk-$archabi ] ; then
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-$archabi
-fi
-if [ ! -e $JAVA_HOME ] ; then
- echo $JAVA_HOME does not exist
+if [ ! -e $dist_dir/lib/java/direct_bt-test.jar ] ; then
+ echo "test exe $dist_dir/lib/java/direct_bt-test.jar not existing"
exit 1
fi
-JAVA_EXE=${JAVA_HOME}/bin/java
-# JAVA_EXE=`readlink -f $(which java)`
-# JAVA_CMD="${JAVA_EXE} -Xcheck:jni -verbose:jni"
-JAVA_CMD="${JAVA_EXE}"
-if [ "$1" = "-log" ] ; then
- logfile=$2
- shift 2
+if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then
+ echo "ERROR: JAVA_HOME $JAVA_HOME does not exist"
+ exit 1
else
- logfile=
+ echo JAVA_HOME $JAVA_HOME
fi
+if [ -z "$JUNIT_CP" ] ; then
+ echo "ERROR: JUNIT_CP $JUNIT_CP does not exist"
+ exit 1
+else
+ echo JUNIT_CP $JUNIT_CP
+fi
+JAVA_EXE=${JAVA_HOME}/bin/java
+JAVA_CMD="${JAVA_EXE}"
test_class=trial.org.direct_bt.TestDBTClientServer10_NoEnc
if [ ! -z "$1" ] ; then
@@ -49,8 +51,12 @@ if [ ! -z "$1" ] ; then
fi
test_basename=`echo ${test_class} | sed 's/.*\.//g'`
-if [ -z "${logfile}" ] ; then
- logfile=~/${bname}-${test_basename}-${archabi}.log
+if [ "$1" = "-log" ] ; then
+ logfile=$2
+ shift 2
+else
+ mkdir -p $rootdir/doc/test
+ logfile=$rootdir/doc/test/${bname}-${test_basename}-${os_name}-${archabi}.log
fi
rm -f $logfile
logbasename=`basename ${logfile} .log`
@@ -61,7 +67,7 @@ rm -f $valgrindlogfile
callgrindoutfile=$logbasename-callgrind.out
rm -f $callgrindoutfile
-echo 'core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern
+# echo 'core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern
ulimit -c unlimited
# run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8'
@@ -76,7 +82,9 @@ export LANG=en_US.UTF-8
# export EXE_WRAPPER="valgrind --tool=drd --segment-merging=no --ignore-thread-creation=yes --trace-barrier=no --trace-cond=no --trace-fork-join=no --trace-mutex=no --trace-rwlock=no --trace-semaphore=no --default-suppressions=yes --suppressions=$sdir/valgrind.supp --suppressions=$sdir/valgrind-jvm.supp --gen-suppressions=all -s --log-file=$valgrindlogfile"
# export EXE_WRAPPER="valgrind --tool=callgrind --instr-atstart=yes --collect-atstart=yes --collect-systime=yes --combine-dumps=yes --separate-threads=no --callgrind-out-file=$callgrindoutfile --log-file=$valgrindlogfile"
-test_classpath=/usr/share/java/junit4.jar:${build_dir}/java/direct_bt.jar:${build_dir}/jaulib/java_base/jaulib_base.jar:${build_dir}/jaulib/test/java/jaulib-test.jar:${build_dir}/trial/java/direct_bt-trial.jar
+test_classpath=$JUNIT_CP:${dist_dir}/lib/java/direct_bt.jar:${build_dir}/jaulib/java_base/jaulib_base.jar:${build_dir}/jaulib/test/java/jaulib-test.jar:${build_dir}/trial/java/direct_bt-trial.jar
+#test_classpath=$JUNIT_CP:${dist_dir}/lib/java/direct_bt-fat.jar:${build_dir}/jaulib/java_base/jaulib_base.jar:${build_dir}/jaulib/test/java/jaulib-test.jar:${build_dir}/trial/java/direct_bt-trial.jar
+
do_test() {
echo "script invocation: $0 ${script_args}"
@@ -88,9 +96,9 @@ do_test() {
cd ${test_dir}
pwd
- echo "/usr/bin/sudo" "/sbin/capsh" "--caps=cap_net_raw,cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" "--keep=1" "--user=sven" "--addamb=cap_net_raw,cap_net_admin+eip" "--" "-c" "ulimit -c unlimited; $EXE_WRAPPER ${JAVA_CMD} ${JAVA_PROPS} -cp ${test_classpath} -Djava.library.path=${rootdir}/dist-${archabi}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}"
+ echo "/usr/bin/sudo" "/sbin/capsh" "--caps=cap_net_raw,cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" "--keep=1" "--user=sven" "--addamb=cap_net_raw,cap_net_admin+eip" "--" "-c" "ulimit -c unlimited; $EXE_WRAPPER ${JAVA_CMD} ${JAVA_PROPS} -cp ${test_classpath} -Djava.library.path=${dist_dir}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}"
- "/usr/bin/sudo" -E "/sbin/capsh" "--caps=cap_net_raw,cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" "--keep=1" "--user=sven" "--addamb=cap_net_raw,cap_net_admin+eip" "--" "-c" "ulimit -c unlimited; $EXE_WRAPPER ${JAVA_CMD} ${JAVA_PROPS} -cp ${test_classpath} -Djava.library.path=${rootdir}/dist-${archabi}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}"
+ "/usr/bin/sudo" "/sbin/capsh" "--caps=cap_net_raw,cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" "--keep=1" "--user=sven" "--addamb=cap_net_raw,cap_net_admin+eip" "--" "-c" "ulimit -c unlimited; $EXE_WRAPPER ${JAVA_CMD} ${JAVA_PROPS} -cp ${test_classpath} -Djava.library.path=${dist_dir}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}"
exit $?
}