diff options
author | Sven Gothel <[email protected]> | 2022-05-29 15:13:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-29 15:13:57 +0200 |
commit | 9125831620a339933dc91ff3e588a6f8d4a53541 (patch) | |
tree | 38bcea2fcb2b026bcece410c7c2b3835d1978d6d | |
parent | 7bd6255eb201ef82da526b4406a9e18593542d5b (diff) |
scripts/test_data_[un]pack.sh: Adding my local cipherpack tests
-rw-r--r-- | scripts/test_data_pack.sh | 18 | ||||
-rw-r--r-- | scripts/test_data_unpack.sh | 71 |
2 files changed, 84 insertions, 5 deletions
diff --git a/scripts/test_data_pack.sh b/scripts/test_data_pack.sh index 995af51..e4da738 100644 --- a/scripts/test_data_pack.sh +++ b/scripts/test_data_pack.sh @@ -7,6 +7,9 @@ bname=`basename $0 .sh` . $sdir/setup-machine-arch.sh +logfile=~/${bname}-${archabi}.log +rm -f $logfile + dist_dir=${rootdir}/dist-${archabi} if [ ! -e ${dist_dir} ] ; then echo build first @@ -19,10 +22,15 @@ if [ ! -e bin/cipherpack -o ! -e lib/libelevator.so ] ; then exit 1 fi -#for i in ../test_data/data-10kiB.bin ../test_data/data-64kB.bin ../test_data/data-382MB.mkv ../test_data/data-1GB.mkv ; do +do_test() { + echo logfile $logfile + + #for i in ../test_data_local/data-10kiB.bin ../test_data_local/data-64kB.bin ../test_data_local/data-382MB.mkv ../test_data_local/data-1GB.mkv ; do + for i in ../test_data_local/*.bin ; do + ../scripts/run_cipherpack.sh pack -epk ../test_keys/terminal_rsa1.pub.pem -epk ../test_keys/terminal_rsa2.pub.pem -epk ../test_keys/terminal_rsa3.pub.pem \ + -ssk ../test_keys/host_rsa1 -in $i -target_path $i -version 201 -version_parent 200 -out $i.enc + done +} -for i in ../test_data/data-10kiB.bin ../test_data/data-64kB.bin ; do - ../scripts/run_cipherpack.sh pack -epk ../test_keys/terminal_rsa1.pub.pem -epk ../test_keys/terminal_rsa2.pub.pem -epk ../test_keys/terminal_rsa3.pub.pem \ - -ssk ../test_keys/host_rsa1 -in $i -target_path $i -version 201 -version_parent 200 -out $i.enc -done +do_test 2>&1 | tee $logfile diff --git a/scripts/test_data_unpack.sh b/scripts/test_data_unpack.sh new file mode 100644 index 0000000..bbd95b3 --- /dev/null +++ b/scripts/test_data_unpack.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +export elevator_debug=true +export elevator_verbose=true + +USE_HTTPD=1 + +script_args="$@" +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` + +. $sdir/setup-machine-arch.sh + +logfile=~/${bname}-${archabi}.log +rm -f $logfile +logfile_httpd=~/${bname}-${archabi}-httpd.log +rm -f $logfile_httpd + +dist_dir=${rootdir}/dist-${archabi} +if [ ! -e ${dist_dir} ] ; then + echo build first + exit 1 +fi +cd ${dist_dir} + +if [ ! -e bin/cipherpack -o ! -e lib/libelevator.so ] ; then + echo build incomplete + exit 1 +fi + +killall mini_httpd +killall mini_httpd +if [ $USE_HTTPD -eq 1 ] ; then + /usr/sbin/mini_httpd -d ${rootdir} -p 8080 -l $logfile_httpd +fi + +# 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 + +ulimit -c unlimited + +do_test() { + echo logfile $logfile + echo logfile $logfile_httpd + echo elevator_debug $elevator_debug + echo elevator_verbose $elevator_verbose + + #for i in ../test_data_local/data-10kiB.bin ../test_data_local/data-64kB.bin ../test_data_local/data-382MB.mkv ../test_data_local/data-1GB.mkv ; do + #for i in ../test_data_local/*.bin.enc ; do + #for i in ../test_data_local/data-1GB.bin.enc ; do + for i in ../test_data_local/data-10kiB.bin.enc ; do + bname_file=`basename $i` + if [ $USE_HTTPD -eq 1 ] ; then + in_name="http://localhost:8080/test_data_local/${bname_file}" + else + in_name=${i} + fi + LD_LIBRARY_PATH=`pwd`/lib bin/cipherpack unpack \ + -spk ../test_keys/host_rsa1.pub.pem -spk ../test_keys/host_rsa2.pub.pem \ + -dsk ../test_keys/terminal_rsa1 \ + -in ${in_name} \ + -out $i.dec + done +} + +do_test 2>&1 | tee $logfile + |