aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/test_data_unpack.sh
blob: 68568f4afcc74ec27f6716351b7be7c38a694b7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh

# export cipherpack_debug=true
export cipherpack_verbose=true

USE_HTTPD=1
#USE_HTTPD=0

script_args="$@"
sdir=`dirname $(readlink -f $0)`
rootdir=`dirname $sdir`
bname=`basename $0 .sh`

. $rootdir/jaulib/scripts/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/libcipherpack.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 cipherpack_debug $cipherpack_debug
    echo cipherpack_verbose $cipherpack_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/data-10kiB.bin.enc ; do
    #for i in ../test_data_local/data-1GB.bin.enc ../test_data_local/data-2GB.bin.enc ; do
    #for i in ../test_data_local/*.bin.enc ; do
    for i in ../test_data_local/data-2GB.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