diff options
author | Sven Gothel <[email protected]> | 2022-07-26 02:52:00 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-07-26 02:52:00 +0200 |
commit | f3a04a46dacb5ae61d9fb8f8dc65bfb7e96a501b (patch) | |
tree | 68a4732517b4342f6b60e8e373f30fd78247b83f /scripts | |
parent | 642845a3af81ebfe48359bcfbdd6d5e910e16036 (diff) |
Update scripts, analog to jaulib v0.14.0-37-g8e76c99
- example symlinks: remove prefix 'run-'
- can invoke from project root dir like in jaulib and cipherlib
- using {build|dist}-OS_NAME-ARCHABI for multi OS support
Diffstat (limited to 'scripts')
24 files changed, 305 insertions, 326 deletions
diff --git a/scripts/run-DBTPeripheral00.sh b/scripts/DBTPeripheral00.sh index 726a5881..726a5881 120000 --- a/scripts/run-DBTPeripheral00.sh +++ b/scripts/DBTPeripheral00.sh diff --git a/scripts/run-DBTScanner10.sh b/scripts/DBTScanner10.sh index 726a5881..726a5881 120000 --- a/scripts/run-DBTScanner10.sh +++ b/scripts/DBTScanner10.sh diff --git a/scripts/build-doc.sh b/scripts/build-doc.sh index c67ec4c6..4d4201ae 100755 --- a/scripts/build-doc.sh +++ b/scripts/build-doc.sh @@ -6,7 +6,7 @@ bname=`basename $0 .sh` logfile=$bname.log rm -f $logfile -. $sdir/setup-machine-arch.sh +. $rootdir/jaulib/scripts/setup-machine-arch.sh if [ -e /usr/lib/jvm/java-17-openjdk-$archabi ] ; then export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$archabi diff --git a/scripts/build.sh b/scripts/build.sh index 8b570855..ef8bce55 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,21 +4,11 @@ sdir=`dirname $(readlink -f $0)` rootdir=`dirname $sdir` bname=`basename $0 .sh` -. $sdir/setup-machine-arch.sh +. $rootdir/jaulib/scripts/setup-machine-arch.sh -logfile=$rootdir/$bname-$archabi.log +logfile=$rootdir/$bname-$os_name-$archabi.log rm -f $logfile -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 - exit 1 -fi - CPU_COUNT=`getconf _NPROCESSORS_ONLN` # run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8' @@ -28,39 +18,48 @@ export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 buildit() { + if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then + echo "WARNING: JAVA_HOME $JAVA_HOME does not exist" + else + echo JAVA_HOME $JAVA_HOME + fi echo rootdir $rootdir echo logfile $logfile echo CPU_COUNT $CPU_COUNT - cd $rootdir - rm -rf dist-$archabi - mkdir -p dist-$archabi/bin - rm -rf build-$archabi - mkdir -p build-$archabi - cd build-$archabi - # CLANG_ARGS="-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++" + dist_dir="dist-$os_name-$archabi" + build_dir="build-$os_name-$archabi" + echo dist_dir $dist_dir + echo build_dir $build_dir - cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON .. + cd $rootdir + rm -rf $dist_dir + mkdir -p $dist_dir + rm -rf $build_dir + mkdir -p $build_dir + cd $build_dir + CLANG_ARGS="-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++" - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DUSE_LIBUNWIND=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DUSE_LIBUNWIND=ON .. + cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DUSE_STRIP=OFF .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DUSE_STRIP=ON -DJAVAC_DEBUG_ARGS="none" .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DGPROF=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DPERF_ANALYSIS=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DINSTRUMENTATION=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DINSTRUMENTATION_UNDEFINED=ON .. - # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DINSTRUMENTATION_THREAD=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DUSE_LIBUNWIND=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DUSE_LIBUNWIND=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DUSE_STRIP=OFF .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DUSE_STRIP=ON -DJAVAC_DEBUG_ARGS="none" .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DGPROF=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DPERF_ANALYSIS=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DINSTRUMENTATION=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DINSTRUMENTATION_UNDEFINED=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TRIAL=ON -DDEBUG=ON -DINSTRUMENTATION_THREAD=ON .. make -j $CPU_COUNT install if [ $? -eq 0 ] ; then - echo "BUILD SUCCESS $bname $archabi" + echo "BUILD SUCCESS $bname $os_name $archabi" cd $rootdir return 0 else - echo "BUILD FAILURE $bname $archabi" + echo "BUILD FAILURE $bname $os_name $archabi" cd $rootdir return 1 fi diff --git a/scripts/clangppone.sh b/scripts/clangppone.sh deleted file mode 100644 index b110291d..00000000 --- a/scripts/clangppone.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh - -sdir=`dirname $(readlink -f $0)` -rootdir=`dirname $sdir` - -clang++ -c -o a.o -std=c++11 -Wall -I$rootdir/api/direct_bt -I$rootdir/ieee11073 -I$rootdir/api $1 2>&1 | tee make.log -rm -f a.o diff --git a/scripts/run-dbt_peripheral00.sh b/scripts/dbt_peripheral00.sh index 68360a74..68360a74 120000 --- a/scripts/run-dbt_peripheral00.sh +++ b/scripts/dbt_peripheral00.sh diff --git a/scripts/run-dbt_readsmpkey.sh b/scripts/dbt_readsmpkey.sh index 4ddbfb62..4ddbfb62 120000 --- a/scripts/run-dbt_readsmpkey.sh +++ b/scripts/dbt_readsmpkey.sh diff --git a/scripts/run-dbt_repeater00.sh b/scripts/dbt_repeater00.sh index 68360a74..68360a74 120000 --- a/scripts/run-dbt_repeater00.sh +++ b/scripts/dbt_repeater00.sh diff --git a/scripts/run-dbt_scanner10.sh b/scripts/dbt_scanner10.sh index 68360a74..68360a74 120000 --- a/scripts/run-dbt_scanner10.sh +++ b/scripts/dbt_scanner10.sh diff --git a/scripts/rebuild-doc.sh b/scripts/rebuild-doc.sh index 82936dd4..8b4cb202 100644 --- a/scripts/rebuild-doc.sh +++ b/scripts/rebuild-doc.sh @@ -3,20 +3,11 @@ sdir=`dirname $(readlink -f $0)` rootdir=`dirname $sdir` bname=`basename $0 .sh` -logfile=$bname.log -rm -f $logfile -. $sdir/setup-machine-arch.sh +. $rootdir/jaulib/scripts/setup-machine-arch.sh -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 - exit 1 -fi +logfile=$rootdir/$bname-$os_name-$archabi.log +rm -f $logfile CPU_COUNT=`getconf _NPROCESSORS_ONLN` @@ -25,21 +16,31 @@ export LANG=en_US.UTF-8 export LC_MEASUREMENT=en_US.UTF-8 buildit() { + if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then + echo "WARNING: JAVA_HOME $JAVA_HOME does not exist" + else + echo JAVA_HOME $JAVA_HOME + fi echo rootdir $rootdir echo logfile $logfile echo CPU_COUNT $CPU_COUNT - cd $rootdir/build-$archabi + dist_dir="dist-$os_name-$archabi" + build_dir="build-$os_name-$archabi" + echo dist_dir $dist_dir + echo build_dir $build_dir + + cd $rootdir/$build_dir rm -rf documentation make -j $CPU_COUNT doc if [ $? -eq 0 ] ; then - echo "REBUILD SUCCESS $bname $archabi" + echo "REBUILD SUCCESS $bname $os_name $archabi" rm -f $rootdir/documentation.tar.xz tar caf $rootdir/documentation.tar.xz documentation cd $rootdir return 0 else - echo "REBUILD FAILURE $bname $archabi" + echo "REBUILD FAILURE $bname $os_name $archabi" cd $rootdir return 1 fi diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh index 997a5f42..91ed854b 100644 --- a/scripts/rebuild.sh +++ b/scripts/rebuild.sh @@ -4,21 +4,11 @@ sdir=`dirname $(readlink -f $0)` rootdir=`dirname $sdir` bname=`basename $0 .sh` -. $sdir/setup-machine-arch.sh +. $rootdir/jaulib/scripts/setup-machine-arch.sh -logfile=$rootdir/$bname-$archabi.log +logfile=$rootdir/$bname-$os_name-$archabi.log rm -f $logfile -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 - exit 1 -fi - CPU_COUNT=`getconf _NPROCESSORS_ONLN` # run 'dpkg-reconfigure locales' enable 'en_US.UTF-8' @@ -26,18 +16,28 @@ export LANG=en_US.UTF-8 export LC_MEASUREMENT=en_US.UTF-8 buildit() { + if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then + echo "WARNING: JAVA_HOME $JAVA_HOME does not exist" + else + echo JAVA_HOME $JAVA_HOME + fi echo rootdir $rootdir echo logfile $logfile echo CPU_COUNT $CPU_COUNT - cd $rootdir/build-$archabi + dist_dir="dist-$os_name-$archabi" + build_dir="build-$os_name-$archabi" + echo dist_dir $dist_dir + echo build_dir $build_dir + + cd $rootdir/$build_dir make -j $CPU_COUNT install if [ $? -eq 0 ] ; then - echo "REBUILD SUCCESS $bname $archabi" + echo "REBUILD SUCCESS $bname $os_name $archabi" cd $rootdir return 0 else - echo "REBUILD FAILURE $bname $archabi" + echo "REBUILD FAILURE $bname $os_name $archabi" cd $rootdir return 1 fi diff --git a/scripts/run-java-example.sh b/scripts/run-java-example.sh index 6186bf81..4d1fe29f 100755 --- a/scripts/run-java-example.sh +++ b/scripts/run-java-example.sh @@ -29,9 +29,44 @@ sdir=`dirname $(readlink -f $0)` rootdir=`dirname $sdir` bname=`basename $0 .sh` -exename=`echo $bname | sed 's/^run-//g'` +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" -if [ ! -e lib/java/direct_bt.jar -o ! -e bin/java/${exename}.jar -o ! -e lib/libdirect_bt.so ] ; then +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 $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 + +if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then + echo "ERROR: JAVA_HOME $JAVA_HOME does not exist" + exit 1 +else + 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}" + +if [ "$1" = "-log" ] ; then + logfile=$2 + shift 2 +else + mkdir -p $rootdir/doc/test + logfile=$rootdir/doc/test/${bname}-${os_name}-${archabi}.log +fi +rm -f $logfile +logbasename=`basename ${logfile} .log` + +if [ ! -e $dist_dir/lib/java/direct_bt.jar -o ! -e $dist_dir/bin/java/${bname}.jar -o ! -e $dist_dir/lib/libdirect_bt.so ] ; then echo run from dist directory exit 1 fi @@ -46,16 +81,6 @@ elif [ "$1" = "-root" ] ; then shift 1 fi -if [ "$1" = "-log" ] ; then - logbasename=$2 - shift 2 -else - logbasename=~/${bname}-${archabi} -fi - -logfile=$logbasename.log -rm -f $logfile - valgrindlogfile=$logbasename-valgrind.log rm -f $valgrindlogfile @@ -82,7 +107,7 @@ JAVA_CMD="${JAVA_EXE}" runit_root() { echo "sudo ... ${*@Q}" - sudo -- bash -c "ulimit -c unlimited; $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} ${*@Q}" + sudo -- bash -c "ulimit -c unlimited; $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp $dist_dir/lib/java/direct_bt.jar:$dist_dir/bin/java/${bname}.jar -Djava.library.path=${dist_dir}/lib ${bname} ${*@Q}" exit $? } @@ -93,7 +118,7 @@ runit_setcap() { sudo setcap 'cap_net_raw,cap_net_admin+eip' ${JAVA_EXE} sudo getcap ${JAVA_EXE} ulimit -c unlimited - $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} "$@" + $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp $dist_dir/lib/java/direct_bt.jar:$dist_dir/bin/java/${bname}.jar -Djava.library.path=${dist_dir}/lib ${bname} "$@" exit $? } @@ -101,7 +126,7 @@ runit_capsh() { echo "sudo capsh ... ${*@Q}" sudo /sbin/capsh --caps="cap_net_raw,cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" \ --keep=1 --user=$username --addamb=cap_net_raw,cap_net_admin+eip \ - -- -c "ulimit -c unlimited; $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} ${*@Q}" + -- -c "ulimit -c unlimited; $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp $dist_dir/lib/java/direct_bt.jar:$dist_dir/bin/java/${bname}.jar -Djava.library.path=${dist_dir}/lib ${bname} ${*@Q}" exit $? } @@ -110,7 +135,7 @@ runit() { echo username $username echo run_setcap ${run_setcap} echo run_root ${run_root} - echo ${exename} commandline "$@" + echo ${bname} commandline "$@" echo EXE_WRAPPER $EXE_WRAPPER echo logbasename $logbasename echo logfile $logfile @@ -119,8 +144,8 @@ runit() { echo direct_bt_debug $direct_bt_debug echo direct_bt_verbose $direct_bt_verbose - echo $EXE_WRAPPER $JAVA_CMD -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} $* - # $EXE_WRAPPER $JAVA_CMD -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} $* + echo $EXE_WRAPPER $JAVA_CMD -cp $dist_dir/lib/java/direct_bt.jar:$dist_dir/bin/java/${bname}.jar -Djava.library.path=${dist_dir}/lib ${bname} $* + # $EXE_WRAPPER $JAVA_CMD -cp $dist_dir/lib/java/direct_bt.jar:$dist_dir/bin/java/${bname}.jar -Djava.library.path=${dist_dir}/lib ${bname} $* mkdir -p client_keys mkdir -p server_keys diff --git a/scripts/run-java-test.sh b/scripts/run-java-test.sh deleted file mode 100755 index f1262f70..00000000 --- a/scripts/run-java-test.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -# -# See scripts/scripts/run-native-example.sh for general details, -# however, commandline arguments are not used for tests but '-log <logfile>' -# - -# -# JAVA_PROPS="-Dorg.direct_bt.debug=true -Dorg.direct_bt.verbose=true" -# - -script_args="$@" -sdir=`dirname $(readlink -f $0)` -rootdir=`dirname $sdir` -bname=`basename $0 .sh` - -. $sdir/setup-machine-arch.sh - -build_dir=${rootdir}/build-${archabi} - -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 - 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 -else - logfile= -fi - -test_class=test.org.direct_bt.TestBringup00 -if [ ! -z "$1" ] ; then - test_class=$1 - shift 1 -fi -test_basename=`echo ${test_class} | sed 's/.*\.//g'` - -if [ -z "${logfile}" ] ; then - logfile=~/${bname}-${test_basename}-${archabi}.log -fi -rm -f $logfile -logbasename=`basename ${logfile} .log` - -valgrindlogfile=$logbasename-valgrind.log -rm -f $valgrindlogfile - -callgrindoutfile=$logbasename-callgrind.out -rm -f $callgrindoutfile - -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' -# perhaps run as root 'update-locale LC_MEASUREMENT=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8' -export LC_MEASUREMENT=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 -export LANG=en_US.UTF-8 - -# export JAVA_PROPS="-Xint" -# export EXE_WRAPPER="valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --num-callers=24 --malloc-fill=0xff --free-fill=0xfe --error-limit=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=helgrind --track-lockorders=yes --num-callers=24 --ignore-thread-creation=yes --default-suppressions=yes --suppressions=$sdir/valgrind.supp --suppressions=$sdir/valgrind-jvm.supp --gen-suppressions=all -s --log-file=$valgrindlogfile" -# 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}/test/java/direct_bt-test.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_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=${rootdir}/dist-${archabi}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}" - exit $? -} - -do_test "$@" 2>&1 | tee $logfile - 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 $? } diff --git a/scripts/run-java-trials-forever.sh b/scripts/run-java-trials-forever.sh index 912cd98d..a48f529b 100755 --- a/scripts/run-java-trials-forever.sh +++ b/scripts/run-java-trials-forever.sh @@ -1,9 +1,18 @@ #!/bin/bash -if [ ! -e direct_bt-trial.jar ] ; then - echo "Run from build/trial/java directory" - exit 1 -fi +script_args="$@" +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` + +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" + +dist_dir=$rootdir/"dist-$os_name-$archabi" +build_dir=$rootdir/"build-$os_name-$archabi" +echo dist_dir $dist_dir +echo build_dir $build_dir + +cd ${build_dir}/trial/java run_forever() { let n=0; while true ; do res="ERROR"; make test && res="OK"; let n=${n}+1; echo "Test ${n} ${res}"; cp -av Testing/Temporary/LastTest.log LastTest-${n}-${res}.log ; done diff --git a/scripts/run-java-trials-until.sh b/scripts/run-java-trials-until.sh index 56056002..90a7aa5c 100755 --- a/scripts/run-java-trials-until.sh +++ b/scripts/run-java-trials-until.sh @@ -1,9 +1,18 @@ #!/bin/bash -if [ ! -e direct_bt-trial.jar ] ; then - echo "Run from build/trial/java directory" - exit 1 -fi +script_args="$@" +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` + +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" + +dist_dir=$rootdir/"dist-$os_name-$archabi" +build_dir=$rootdir/"build-$os_name-$archabi" +echo dist_dir $dist_dir +echo build_dir $build_dir + +cd ${build_dir}/trial/java run_until() { let n=0; while make test ; do let n=${n}+1; echo "Test ${n} OK"; cp -av Testing/Temporary/LastTest.log LastTest-${n}.log ; done diff --git a/scripts/run-native-example-simple.sh b/scripts/run-native-example-simple.sh index 40a0f1d1..3fa51ff2 100755 --- a/scripts/run-native-example-simple.sh +++ b/scripts/run-native-example-simple.sh @@ -7,14 +7,6 @@ # Assuming executing dbt_scanner10: # -# Only reliable way, but Linux specific -THIS_SHELL=`readlink /proc/$$/exe` -#THIS_SHELL=`ps -hp $$ | awk '{ print $5 }'` -if [ "$(basename ${THIS_SHELL})" != "bash" ]; then - echo "$0 must run in bash to preserve command-line quotes, not ${THIS_SHELL}" - exit 1 -fi - script_args="$@" username=${USER} @@ -23,19 +15,33 @@ sdir=`dirname $(readlink -f $0)` rootdir=`dirname $sdir` bname=`basename $0 .sh` -exename=`echo $bname | sed 's/^run-//g'` +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" -if [ ! -e bin/${exename} -o ! -e lib/libdirect_bt.so ] ; then - echo run from dist directory +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 $dist_dir/bin/$bname ] ; then + echo "Not existing $dist_dir/bin/$bname" exit 1 fi -logbasename=~/$bname -logfile=$logbasename.log -rm -f $logfile +if [ ! -e $dist_dir/lib/libdirect_bt.so ] ; then + echo "Not existing $dist_dir/lib/libdirect_bt.so" + exit 1 +fi -# echo 'core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern >/dev/null -# ulimit -c unlimited +if [ "$1" = "-log" ] ; then + logbasename=$2 + shift 2 +else + logbasename=$bname-$os_name-$archabi +fi + +mkdir -p $rootdir/doc/test +logfile=$rootdir/doc/test/$logbasename.0.log +rm -f $logfile # run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8' # perhaps run as root 'update-locale LC_MEASUREMENT=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8' @@ -55,9 +61,8 @@ runit() { mkdir -p client_keys mkdir -p server_keys - exe_file=$(readlink -f bin/${exename}) ulimit -c unlimited - LD_LIBRARY_PATH=`pwd`/lib ${exe_file} "$@" + LD_LIBRARY_PATH=$dist_dir/lib $dist_dir/bin/${bname} "$@" exit $? } diff --git a/scripts/run-native-example.sh b/scripts/run-native-example.sh index b9f27cb1..3d2e62ba 100755 --- a/scripts/run-native-example.sh +++ b/scripts/run-native-example.sh @@ -66,14 +66,6 @@ # sudo YOUR FANCY direct_bt STUFF # -# Only reliable way, but Linux specific -THIS_SHELL=`readlink /proc/$$/exe` -#THIS_SHELL=`ps -hp $$ | awk '{ print $5 }'` -if [ "$(basename ${THIS_SHELL})" != "bash" ]; then - echo "$0 must run in bash to preserve command-line quotes, not ${THIS_SHELL}" - exit 1 -fi - script_args="$@" username=${USER} @@ -82,10 +74,20 @@ sdir=`dirname $(readlink -f $0)` rootdir=`dirname $sdir` bname=`basename $0 .sh` -exename=`echo $bname | sed 's/^run-//g'` +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" + +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 $dist_dir/bin/$bname ] ; then + echo "Not existing $dist_dir/bin/$bname" + exit 1 +fi -if [ ! -e bin/${exename} -o ! -e lib/libdirect_bt.so ] ; then - echo run from dist directory +if [ ! -e $dist_dir/lib/libdirect_bt.so ] ; then + echo "Not existing $dist_dir/lib/libdirect_bt.so" exit 1 fi @@ -103,10 +105,11 @@ if [ "$1" = "-log" ] ; then logbasename=$2 shift 2 else - logbasename=~/${bname}-${archabi} + logbasename=$bname-$os_name-$archabi fi -logfile=$logbasename.log +mkdir -p $rootdir/doc/test +logfile=$rootdir/doc/test/$logbasename.0.log rm -f $logfile valgrindlogfile=$logbasename-valgrind.log @@ -115,7 +118,6 @@ rm -f $valgrindlogfile callgrindoutfile=$logbasename-callgrind.out rm -f $callgrindoutfile -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' @@ -132,19 +134,19 @@ export LANG=en_US.UTF-8 runit_root() { echo "sudo ... ${*@Q}" - sudo -- bash -c "ulimit -c unlimited; LD_LIBRARY_PATH=`pwd`/lib $EXE_WRAPPER bin/${exename} ${*@Q}" + sudo -- bash -c "ulimit -c unlimited; LD_LIBRARY_PATH=$dist_dir/lib $EXE_WRAPPER $dist_dir/bin/${bname} ${*@Q}" exit $? } runit_setcap() { echo "sudo setcap ... " "$@" - exe_file=$(readlink -f bin/${exename}) + exe_file=$(readlink -f $dist_dir/bin/${bname}) echo "sudo setcap 'cap_net_raw,cap_net_admin+eip' ${exe_file}" trap 'sudo setcap -q -r '"${exe_file}"'' EXIT INT HUP QUIT TERM ALRM USR1 sudo setcap 'cap_net_raw,cap_net_admin+eip' ${exe_file} sudo getcap ${exe_file} ulimit -c unlimited - LD_LIBRARY_PATH=`pwd`/lib $EXE_WRAPPER ${exe_file} "$@" + LD_LIBRARY_PATH=$dist_dir/lib $EXE_WRAPPER ${exe_file} "$@" exit $? } @@ -152,17 +154,17 @@ runit_capsh() { echo "sudo capsh ... ${*@Q}" sudo /sbin/capsh --caps="cap_net_raw,cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" \ --keep=1 --user=$username --addamb=cap_net_raw,cap_net_admin+eip \ - -- -c "ulimit -c unlimited; LD_LIBRARY_PATH=`pwd`/lib $EXE_WRAPPER bin/${exename} ${*@Q}" + -- -c "ulimit -c unlimited; LD_LIBRARY_PATH=$dist_dir/lib $EXE_WRAPPER $dist_dir/bin/${bname} ${*@Q}" exit $? } runit() { echo "script invocation: $0 ${script_args}" - echo exename $exename + echo bname $bname echo username $username echo run_setcap ${run_setcap} echo run_root ${run_root} - echo ${exename} commandline "$@" + echo ${bname} commandline "$@" echo EXE_WRAPPER $EXE_WRAPPER echo logbasename $logbasename echo logfile $logfile @@ -171,7 +173,7 @@ runit() { echo direct_bt_debug $direct_bt_debug echo direct_bt_verbose $direct_bt_verbose - echo LD_LIBRARY_PATH=`pwd`/lib $EXE_WRAPPER bin/${exename} "$@" + echo LD_LIBRARY_PATH=$dist_dir/lib $EXE_WRAPPER $dist_dir/bin/${bname} "$@" mkdir -p client_keys mkdir -p server_keys diff --git a/scripts/run-native-trial.sh b/scripts/run-native-trial.sh index 27a12d68..28ccb8af 100755 --- a/scripts/run-native-trial.sh +++ b/scripts/run-native-trial.sh @@ -13,16 +13,12 @@ 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} - -if [ "$1" = "-log" ] ; then - logfile=$2 - shift 2 -else - logfile= -fi +dist_dir=$rootdir/"dist-$os_name-$archabi" +build_dir=$rootdir/"build-$os_name-$archabi" +echo dist_dir $dist_dir +echo build_dir $build_dir test_exe=${build_dir}/trial/direct_bt/test_client_server10_NoEnc if [ ! -z "$1" ] ; then @@ -31,11 +27,16 @@ if [ ! -z "$1" ] ; then fi test_basename=`basename ${test_exe}` -if [ -z "${logfile}" ] ; then - logfile=~/${bname}-${test_basename}-${archabi}.log +if [ "$1" = "-log" ] ; then + logbasename=$2 + shift 2 +else + logbasename=$bname-${test_basename}-$os_name-$archabi fi + +mkdir -p $rootdir/doc/test +logfile=$rootdir/doc/test/$logbasename.0.log rm -f $logfile -logbasename=`basename ${logfile} .log` valgrindlogfile=$logbasename-valgrind.log rm -f $valgrindlogfile @@ -43,7 +44,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' diff --git a/scripts/run-native-trials-forever.sh b/scripts/run-native-trials-forever.sh index f3154aaa..cd211359 100755 --- a/scripts/run-native-trials-forever.sh +++ b/scripts/run-native-trials-forever.sh @@ -1,9 +1,18 @@ #!/bin/bash -if [ ! -e test_client_server10_NoEnc ] ; then - echo "Run from build/trial/direct_bt/ directory" - exit 1 -fi +script_args="$@" +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` + +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" + +dist_dir=$rootdir/"dist-$os_name-$archabi" +build_dir=$rootdir/"build-$os_name-$archabi" +echo dist_dir $dist_dir +echo build_dir $build_dir + +cd ${build_dir}/trial/direct_bt run_forever() { let n=0; while true ; do res="ERROR"; make test && res="OK"; let n=${n}+1; echo "Test ${n} ${res}"; cp -av Testing/Temporary/LastTest.log LastTest-${n}-${res}.log ; done diff --git a/scripts/run-native-trials-until.sh b/scripts/run-native-trials-until.sh index eb144372..6e2a7b1f 100755 --- a/scripts/run-native-trials-until.sh +++ b/scripts/run-native-trials-until.sh @@ -1,9 +1,18 @@ #!/bin/bash -if [ ! -e test_client_server10_NoEnc ] ; then - echo "Run from build/trial/direct_bt/ directory" - exit 1 -fi +script_args="$@" +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` + +. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet" + +dist_dir=$rootdir/"dist-$os_name-$archabi" +build_dir=$rootdir/"build-$os_name-$archabi" +echo dist_dir $dist_dir +echo build_dir $build_dir + +cd ${build_dir}/trial/direct_bt run_until() { let n=0; while make test ; do let n=${n}+1; echo "Test ${n} OK"; cp -av Testing/Temporary/LastTest.log LastTest-${n}.log ; done diff --git a/scripts/setup-machine-arch.sh b/scripts/setup-machine-arch.sh deleted file mode 100644 index df6c6444..00000000 --- a/scripts/setup-machine-arch.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -machine=`uname -m` - -case "$machine" in - "arm") - cpu="arm" - cpufamily="arm" - archabi="armhf" - syslibdir="arm-linux-gnueabihf" - ;; - "armv7l") - cpu="armv7l" - cpufamily="arm" - archabi="armhf" - syslibdir="arm-linux-gnueabihf" - ;; - "aarch64") - cpu="aarch64" - cpufamily="arm" - archabi="arm64" - syslibdir="aarch64-linux-gnu" - ;; - "x86_64") - cpu="x86_64" - cpufamily="x86" - archabi="amd64" - syslibdir="x86_64-linux-gnu" - ;; - *) - echo "Unsupported machine $machine" - exit 1 - ;; -esac - -echo machine $machine -echo cpu $cpu -echo cpufamily $cpufamily -echo archabi $archabi -echo syslibdir $syslibdir - diff --git a/scripts/test_exe_template.sh b/scripts/test_exe_template.sh index 1ac741ef..0d8942c3 100755 --- a/scripts/test_exe_template.sh +++ b/scripts/test_exe_template.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Arguments: # --perf_analysis special performance analysis using 3rd party tools @@ -6,13 +6,18 @@ # <none> auto_run, no benchmarking # +script_args="$@" + 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 $build_dir/test/direct_bt/$bname ] ; then echo "test exe $build_dir/test/direct_bt/$bname not existing" @@ -23,9 +28,10 @@ if [ "$1" = "-log" ] ; then logbasename=$2 shift 2 else - logbasename=$bname.$archabi + logbasename=$bname-$os_name-$archabi fi +mkdir -p $rootdir/doc/test logfile=$rootdir/doc/test/$logbasename.0.log rm -f $logfile @@ -62,12 +68,15 @@ runit() { echo valgrindlogfile $valgrindlogfile echo callgrindoutfile $callgrindoutfile - echo $EXE_WRAPPER $build_dir/test/direct_bt/$bname $* + cd $build_dir/test/direct_bt + pwd + + echo "$EXE_WRAPPER ./$bname ${*@Q}" #export ASAN_OPTIONS=verbosity=1:malloc_context_size=20 #export ASAN_OPTIONS=print_stats:halt_on_error:replace_intrin - $EXE_WRAPPER $build_dir/test/direct_bt/$bname $* + $EXE_WRAPPER ./$bname "$@" } runit $* 2>&1 | tee $logfile diff --git a/scripts/test_java.sh b/scripts/test_java.sh index ff515937..fc09bc4b 100644..100755 --- a/scripts/test_java.sh +++ b/scripts/test_java.sh @@ -1,30 +1,57 @@ -#!/bin/sh +#!/bin/bash # Arguments: # class-name unit test class name # +script_args="$@" 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" -dist_dir=$rootdir/dist-$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 $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 -if [ ! -z "$1" ] ; then - logbasename=$1 +if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then + echo "ERROR: JAVA_HOME $JAVA_HOME does not exist" + exit 1 else - logbasename=$bname.$archabi + 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}" -logfile=$rootdir/doc/test/$logbasename.0.log +test_class=test.org.direct_bt.TestBringup00 +if [ ! -z "$1" ] ; then + test_class=$1 + shift 1 +fi +test_basename=`echo ${test_class} | sed 's/.*\.//g'` + +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` ulimit -c unlimited @@ -34,17 +61,20 @@ export LC_MEASUREMENT=en_US.UTF-8 # export EXE_WRAPPER="nice -20" +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}/test/java/direct_bt-test.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}/test/java/direct_bt-test.jar + + runit() { echo COMMANDLINE $0 $* echo EXE_WRAPPER $EXE_WRAPPER echo logbasename $logbasename echo logfile $logfile - echo $EXE_WRAPPER java -cp /usr/share/java/junit4.jar:$dist_dir/lib/java/direct_bt-test.jar $* - - # $EXE_WRAPPER java -Djau.debug=true -cp /usr/share/java/junit4.jar:$dist_dir/lib/java/direct_bt-test.jar $* + 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}" - $EXE_WRAPPER java -cp /usr/share/java/junit4.jar:$dist_dir/lib/java/direct_bt-test.jar $* + "/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 $? } runit $* 2>&1 | tee $logfile |