diff options
author | Sven Gothel <[email protected]> | 2022-07-25 08:51:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-07-25 08:51:49 +0200 |
commit | 78489714eb9caef9bf75e01d58a062d5823c7a1c (patch) | |
tree | 3d6969e0cbe3e5d711b49ca75edd90952ef968b0 /scripts | |
parent | 85d88a4ad83e021ea0f9b610b65519cbca021236 (diff) |
Update scripts, analog to jaulib v0.14.0-37-g8e76c99
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build.sh | 59 | ||||
-rwxr-xr-x | scripts/cipherpack | 35 | ||||
-rw-r--r-- | scripts/rebuild-doc.sh | 31 | ||||
-rw-r--r-- | scripts/rebuild.sh | 31 | ||||
-rwxr-xr-x | scripts/run-java-test.sh | 96 | ||||
-rwxr-xr-x | scripts/run-native-test.sh | 75 | ||||
-rwxr-xr-x | scripts/run_cipherpack.sh | 26 | ||||
-rw-r--r-- | scripts/setup-machine-arch.sh | 41 | ||||
-rw-r--r-- | scripts/test_data_pack.sh | 2 | ||||
-rw-r--r-- | scripts/test_data_unpack.sh | 2 | ||||
-rwxr-xr-x | scripts/test_exe_template.sh | 32 | ||||
-rwxr-xr-x | scripts/test_java.sh | 102 |
12 files changed, 223 insertions, 309 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index 1540a4d..5297459 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,30 +18,47 @@ 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 + dist_dir="dist-$os_name-$archabi" + build_dir="build-$os_name-$archabi" + echo dist_dir $dist_dir + echo build_dir $build_dir + cd $rootdir - rm -rf dist-$archabi - mkdir -p dist-$archabi/bin - rm -rf build-$archabi - mkdir -p build-$archabi - cd build-$archabi + 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_TESTING=ON -DTEST_WITH_SUDO=ON .. - cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON .. - #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON -DDEBUG=ON .. + #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON .. + cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON .. + #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON -DDEBUG=ON .. - make -j $CPU_COUNT install test + make -j $CPU_COUNT install if [ $? -eq 0 ] ; then - echo "BUILD SUCCESS $bname $archabi" - # cp -a examples/* $rootdir/dist-$archabi/bin - cd $rootdir - return 0 + echo "BUILD SUCCESS $bname $os_name $archabi" + make test + if [ $? -eq 0 ] ; then + echo "TEST SUCCESS $bname $os_name $archabi" + cd $rootdir + return 0 + else + echo "TEST FAILURE $bname $os_name $archabi" + cd $rootdir + return 1 + fi else - echo "BUILD FAILURE $bname $archabi" + echo "BUILD FAILURE $bname $os_name $archabi" cd $rootdir return 1 fi diff --git a/scripts/cipherpack b/scripts/cipherpack new file mode 100755 index 0000000..70290df --- /dev/null +++ b/scripts/cipherpack @@ -0,0 +1,35 @@ +#!/bin/bash + +export jau_debug=true +export cipherpack_debug=true +# export cipherpack_verbose=true +# +# ../scripts/cipherpack some_plaintext_file.bin +# +# Examples +# scripts/cipherpack pack -epk test_keys/terminal_rsa1.pub.pem -ssk test_keys/host_rsa1 -out a.enc test_data_local/data-10kiB.bin +# scripts/cipherpack unpack -spk test_keys/host_rsa1.pub.pem -dsk test_keys/terminal_rsa1 -out a.dec a.enc +# + +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} + +if [ ! -e ${dist_dir}/bin/cipherpack -o ! -e ${dist_dir}/lib/libcipherpack.so ] ; then + echo "Not available: ${dist_dir}/bin/cipherpack or ${dist_dir}/lib/libcipherpack.so" + exit 1 +fi +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 + +#LD_LIBRARY_PATH=${dist_dir}/lib strace ${dist_dir}/bin/cipherpack $* +LD_LIBRARY_PATH=${dist_dir}/lib ${dist_dir}/bin/cipherpack $* diff --git a/scripts/rebuild-doc.sh b/scripts/rebuild-doc.sh index 82936dd..8b4cb20 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 1a46603..91ed854 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,19 +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" - # cp -a examples/* $rootdir/dist-$archabi/bin + 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-test.sh b/scripts/run-java-test.sh deleted file mode 100755 index 75b416c..0000000 --- a/scripts/run-java-test.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -#export cipherpack_debug=true -#export cipherpack_verbose=true - -# -# JAVA_PROPS="-Dorg.cipherpack.debug=true -Dorg.cipherpack.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.cipherpack.Test01Cipherpack -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/cipherpack.jar:${build_dir}/jaulib/java_base/jaulib_base.jar:${build_dir}/jaulib/test/java/jaulib-test.jar:${build_dir}/test/java/cipherpack-test.jar - -do_test() { - echo "script invocation: $0 ${script_args}" - echo cipherpack_debug $cipherpack_debug - echo cipherpack_verbose $cipherpack_verbose - echo logfile $logfile - echo test_class ${test_class} - - test_dir="${build_dir}/test/java/" - echo "cd ${test_dir}" - cd ${test_dir} - pwd - - echo "$EXE_WRAPPER ${JAVA_CMD} ${JAVA_PROPS} -cp ${test_classpath} -Djava.library.path=${rootdir}/dist-${archabi}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}" - - 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-native-test.sh b/scripts/run-native-test.sh deleted file mode 100755 index 7958646..0000000 --- a/scripts/run-native-test.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -#export cipherpack_debug=true -#export cipherpack_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 [ "$1" = "-log" ] ; then - logfile=$2 - shift 2 -else - logfile= -fi - -test_exe=${build_dir}/test/cipherpack/test_01_cipherpack -if [ ! -z "$1" ] ; then - test_exe=$1 - shift 1 -fi -test_basename=`basename ${test_exe}` - -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 EXE_WRAPPER="valgrind --tool=memcheck --leak-check=full --show-reachable=yes --track-origins=yes --num-callers=24 --malloc-fill=0xff --free-fill=0xfe --error-limit=no --default-suppressions=yes --suppressions=$sdir/valgrind.supp --gen-suppressions=all -s --log-file=$valgrindlogfile" -# export EXE_WRAPPER="valgrind --tool=memcheck --leak-check=full --show-leak-kinds=definite --track-origins=yes --num-callers=24 --malloc-fill=0xff --free-fill=0xfe --error-limit=no --default-suppressions=yes --suppressions=$sdir/valgrind.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 --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 --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" - -do_test() { - echo "script invocation: $0 ${script_args}" - echo cipherpack_debug $cipherpack_debug - echo cipherpack_verbose $cipherpack_verbose - echo logfile $logfile - echo test_exe ${test_exe} - echo test_basename ${test_basename} - - test_dir=`dirname $test_exe` - echo "cd ${test_dir}" - cd ${test_dir} - pwd - - ulimit -c unlimited - $EXE_WRAPPER ./${test_basename} ${*@Q} - exit $? -} - -do_test "$@" 2>&1 | tee $logfile - diff --git a/scripts/run_cipherpack.sh b/scripts/run_cipherpack.sh deleted file mode 100755 index a0c29c6..0000000 --- a/scripts/run_cipherpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# export cipherpack_debug=true -export cipherpack_verbose=true -# -# ../scripts/run-cipherpack.sh some_plaintext_file.bin -# - -if [ ! -e bin/cipherpack -o ! -e lib/libcipherpack.so ] ; then - echo run from dist directory - exit 1 -fi -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 - -echo COMMANDLINE $0 $* -echo cipherpack_debug $cipherpack_debug -echo cipherpack_verbose $cipherpack_verbose - -#LD_LIBRARY_PATH=`pwd`/lib strace bin/cipherpack $* -LD_LIBRARY_PATH=`pwd`/lib bin/cipherpack $* diff --git a/scripts/setup-machine-arch.sh b/scripts/setup-machine-arch.sh deleted file mode 100644 index df6c644..0000000 --- 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_data_pack.sh b/scripts/test_data_pack.sh index f48a0da..b173e22 100644 --- a/scripts/test_data_pack.sh +++ b/scripts/test_data_pack.sh @@ -8,7 +8,7 @@ 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=~/${bname}-${archabi}.log rm -f $logfile diff --git a/scripts/test_data_unpack.sh b/scripts/test_data_unpack.sh index 7a1ecb7..68568f4 100644 --- a/scripts/test_data_unpack.sh +++ b/scripts/test_data_unpack.sh @@ -11,7 +11,7 @@ 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=~/${bname}-${archabi}.log rm -f $logfile diff --git a/scripts/test_exe_template.sh b/scripts/test_exe_template.sh index c7a0214..cfc1d68 100755 --- a/scripts/test_exe_template.sh +++ b/scripts/test_exe_template.sh @@ -1,7 +1,7 @@ -#!/bin/sh +#!/bin/bash -export elevator_debug=true -export elevator_verbose=true +#export cipherpack_debug=true +#export cipherpack_verbose=true # Arguments: # --perf_analysis special performance analysis using 3rd party tools @@ -9,16 +9,22 @@ export elevator_verbose=true # <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/elevator/$bname ] ; then - echo "test exe $build_dir/test/elevator/$bname not existing" +if [ ! -e $build_dir/test/cipherpack/$bname ] ; then + echo "test exe $build_dir/test/cipherpack/$bname not existing" exit 1 fi @@ -26,7 +32,7 @@ if [ "$1" = "-log" ] ; then logbasename=$2 shift 2 else - logbasename=$bname.$archabi + logbasename=$bname-$os_name-$archabi fi logfile=$rootdir/doc/test/$logbasename.0.log @@ -58,21 +64,23 @@ export LANG=en_US.UTF-8 # export EXE_WRAPPER="nice -20" runit() { - echo COMMANDLINE $0 $* + echo "script invocation: $0 ${script_args}" echo EXE_WRAPPER $EXE_WRAPPER echo logbasename $logbasename echo logfile $logfile echo valgrindlogfile $valgrindlogfile echo callgrindoutfile $callgrindoutfile - echo $EXE_WRAPPER $build_dir/test/elevator/$bname $* + cd $build_dir/test/cipherpack + 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 - cd $build_dir/test/elevator/ - $EXE_WRAPPER $build_dir/test/elevator/$bname $* + $EXE_WRAPPER ./$bname "$@" } -runit $* 2>&1 | tee $logfile +runit "$@" 2>&1 | tee $logfile diff --git a/scripts/test_java.sh b/scripts/test_java.sh new file mode 100755 index 0000000..1f1cb11 --- /dev/null +++ b/scripts/test_java.sh @@ -0,0 +1,102 @@ +#!/bin/bash + +# export cipherpack_debug=true +# export cipherpack_verbose=true + +# +# JAVA_PROPS="-Dorg.cipherpack.debug=true -Dorg.cipherpack.verbose=true" +# + +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 + +if [ ! -e $dist_dir/lib/java/jaulib-test.jar ] ; then + echo "test exe $dist_dir/lib/java/jaulib-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_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.cipherpack.Test01Cipherpack +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}-${os_name}-${archabi}.log +fi +rm -f $logfile +logbasename=`basename ${logfile} .log` + +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="nice -20" +# export JAVA_PROPS="-Djau.debug=true -Djau.verbose=true" + +test_classpath=$JUNIT_CP:${dist_dir}/lib/java/cipherpack.jar:${build_dir}/jaulib/java_base/jaulib_base.jar:${build_dir}/jaulib/test/java/jaulib-test.jar:${build_dir}/test/java/cipherpack-test.jar +#test_classpath=$JUNIT_CP:${dist_dir}/lib/java/cipherpack-fat.jar:${build_dir}/jaulib/java_base/jaulib_base.jar:${build_dir}/jaulib/test/java/jaulib-test.jar:${build_dir}/test/java/cipherpack-test.jar + +do_test() { + echo "script invocation: $0 ${script_args}" + echo EXE_WRAPPER $EXE_WRAPPER + echo cipherpack_debug $cipherpack_debug + echo cipherpack_verbose $cipherpack_verbose + echo logbasename $logbasename + echo logfile $logfile + echo test_class ${test_class} + + test_dir="${build_dir}/test/java/" + echo "cd ${test_dir}" + cd ${test_dir} + pwd + + echo "$EXE_WRAPPER ${JAVA_CMD} ${JAVA_PROPS} -cp ${test_classpath} -Djava.library.path=${dist_dir}/lib org.junit.runner.JUnitCore ${test_class} ${*@Q}" + + 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_CMD} ${JAVA_PROPS} -cp ${test_classpath} org.junit.runner.JUnitCore ${test_class} ${*@Q} + exit $? +} + +do_test "$@" 2>&1 | tee $logfile + |