diff options
author | Sven Gothel <[email protected]> | 2022-04-24 01:37:22 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-04-24 01:37:22 +0200 |
commit | 5235b48aa85b0a8a465a9f2e4acee46aa37d4395 (patch) | |
tree | 806764e9741728c002f828ccdd8a01477bb0fdb6 /scripts/run-java-trial.sh | |
parent | 77e86ffecd195c546c2b9138d67ace39d4db1d97 (diff) |
scripts/run-java-trial.sh: Convenient java trial launch script using same invocation as trial unit tests (non-fat jar)
Diffstat (limited to 'scripts/run-java-trial.sh')
-rwxr-xr-x | scripts/run-java-trial.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/run-java-trial.sh b/scripts/run-java-trial.sh new file mode 100755 index 00000000..46750593 --- /dev/null +++ b/scripts/run-java-trial.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +script_args="$@" +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` + +. $sdir/setup-machine-arch.sh + +export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$archabi +if [ ! -e $JAVA_HOME ] ; then + echo $JAVA_HOME does not exist + exit 1 +fi + +test_class=trial.org.direct_bt.TestDBTClientServer01_NoEnc + +if [ ! -z "$1" ] ; then + test_class=$1 + shift 1 +fi + +test_basename=`echo ${test_class} | sed 's/.*\.//g'` + +logfile=$rootdir/${bname}-${test_basename}-${archabi}.log +rm -f $logfile + +java=/usr/lib/jvm/java-17-openjdk-${archabi}/bin/java + +project_dir=/usr/local/projects/zafena/direct_bt +build_dir=${project_dir}/build-${archabi} + +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 + +do_test() { + echo "script invocation: $0 ${script_args}" + echo logfile $logfile + + 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} -cp ${test_classpath} -Djava.library.path=${project_dir}/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} -cp ${test_classpath} -Djava.library.path=${project_dir}/dist-${archabi}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}" + exit $? +} + +do_test "$@" 2>&1 | tee $logfile + |