aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-07-20 17:15:02 +0000
committerFranklin Wei <me@fwei.tk>2018-07-20 17:15:02 +0000
commitdb7be6b17ef18bb0f0263992a1f38959be5012dc (patch)
tree97f9d3e9a4141de053a743ebdcaca474bc53f8aa
parent4ef7acdbe514cd7e13c62ff22d8b0eb8c04cce1f (diff)
downloadcsaa-db7be6b17ef18bb0f0263992a1f38959be5012dc.zip
csaa-db7be6b17ef18bb0f0263992a1f38959be5012dc.tar.gz
csaa-db7be6b17ef18bb0f0263992a1f38959be5012dc.tar.bz2
csaa-db7be6b17ef18bb0f0263992a1f38959be5012dc.tar.xz
Add scripts for testing with prepopulated database
-rw-r--r--dummy_service.c2
-rwxr-xr-xprepopulate2.sh9
-rwxr-xr-xprepopulate_dummy.sh2
-rw-r--r--service_provider.c2
-rwxr-xr-xtabulate.sh6
-rwxr-xr-xtestall.sh8
-rwxr-xr-xtestall_preinit.sh32
-rwxr-xr-xtestdummy.sh4
-rwxr-xr-xtestdummy_preinit.sh29
-rwxr-xr-xtestmain_preinit.sh23
-rwxr-xr-xtestmodify.sh7
-rwxr-xr-xtestmodifyenc.sh5
-rwxr-xr-xtestretrieve.sh7
13 files changed, 117 insertions, 19 deletions
diff --git a/dummy_service.c b/dummy_service.c
index 7be38f9..9964b9d 100644
--- a/dummy_service.c
+++ b/dummy_service.c
@@ -25,7 +25,7 @@
#include "trusted_module.h"
#include "service_provider.h"
-#define PREPOPULATE
+//#define PREPOPULATE
#define RUNS_TEST 500
/* arbitrary */
diff --git a/prepopulate2.sh b/prepopulate2.sh
index dd1b8bf..22d471e 100755
--- a/prepopulate2.sh
+++ b/prepopulate2.sh
@@ -2,9 +2,14 @@
mkdir -p databases
-for i in `seq 10 25`
+pids=""
+for i in `seq 10 12`
do
echo $i
rm -f socket
- ./server $i databases/csaa_$i.db > /dev/null
+ ./server $i databases/csaa_$i.db > /dev/null &
+
+ pids=$pids" "$!
done
+
+wait $pids
diff --git a/prepopulate_dummy.sh b/prepopulate_dummy.sh
index 2b84a5c..19178a9 100755
--- a/prepopulate_dummy.sh
+++ b/prepopulate_dummy.sh
@@ -4,7 +4,7 @@ mkdir -p databases
pids=""
-for i in `seq 10 25`
+for i in `seq 10 12`
do
echo $i
rm -f socket
diff --git a/service_provider.c b/service_provider.c
index 9450aa0..ebb81c1 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -28,7 +28,7 @@
/* define these to make the service provider prepopulate a database
* with 2^logleaves - RUNS_TEST files, then exit */
-#define PREPOPULATE
+//#define PREPOPULATE
#define RUNS_TEST 500
/* free with free_version */
diff --git a/tabulate.sh b/tabulate.sh
index 2cb9801..7698cc7 100755
--- a/tabulate.sh
+++ b/tabulate.sh
@@ -4,7 +4,7 @@ runs_test=500
rm -f all_*.txt dummy_all_*.txt
-for i in `seq 9 15`
+for i in `seq 10 12`
do
for j in `seq 1 $trials`
do
@@ -23,7 +23,7 @@ cat all_*.txt | awk '{
runs_create=lshift(1, $1);
runs_test='$runs_test';
if(NF >= 5)
- print $1, $5, runs_create >> "data_create.txt";
+ print $1, $5, runs_test >> "data_create.txt";
if(NF >= 9)
print $1, $9, runs_test >> "data_modify.txt"
if(NF >= 13)
@@ -38,7 +38,7 @@ cat dummy_all_*.txt | awk '{
runs_create=lshift(1, $1);
runs_test='$runs_test';
if(NF >= 5)
- print $1, $5, runs_create >> "data_dummy_create.txt";
+ print $1, $5, runs_test >> "data_dummy_create.txt";
if(NF >= 9)
print $1, $9, runs_test >> "data_dummy_modify.txt";
if(NF >= 13)
diff --git a/testall.sh b/testall.sh
index bc9903a..e2c584c 100755
--- a/testall.sh
+++ b/testall.sh
@@ -15,11 +15,11 @@ rm files -rf
pid=$!
sleep .2
/usr/bin/time -v ./testcreate.sh ./client $runs_create
-/usr/bin/time -v ./testmodify.sh ./client $runs_test
-/usr/bin/time -v ./testretrieve.sh ./client $runs_test
-/usr/bin/time -v ./testmodifyenc.sh ./client $runs_test
+/usr/bin/time -v ./testmodify.sh ./client $runs_test 1
+/usr/bin/time -v ./testretrieve.sh ./client $runs_test 1
+/usr/bin/time -v ./testmodifyenc.sh ./client $runs_test 1
echo "Encrypted retrieve: "
-/usr/bin/time -v ./testretrieve.sh ./client $runs_test
+/usr/bin/time -v ./testretrieve.sh ./client $runs_test 1
kill -SIGINT $!
rm csaa.db
diff --git a/testall_preinit.sh b/testall_preinit.sh
new file mode 100755
index 0000000..4a061b5
--- /dev/null
+++ b/testall_preinit.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+if [[ $# -ne 2 ]]
+then
+ echo "Usage: "$0" LOGLEAVES RUNS_TEST"
+ exit 1
+fi
+
+logleaves=$1
+runs_test=$2
+
+echo "Initializing..."
+rm files -rf
+
+cp databases/csaa_$logleaves.db csaa.db
+cp databases/state_$logleaves module_state
+chmod 644 csaa.db
+
+start_id=$(echo "2^$1 - $runs_test" | bc)
+
+./server $1 csaa.db > /dev/null &
+pid=$!
+sleep .2
+/usr/bin/time -v ./testcreate.sh ./client $runs_test
+/usr/bin/time -v ./testmodify.sh ./client $runs_test $start_id
+/usr/bin/time -v ./testretrieve.sh ./client $runs_test $start_id
+/usr/bin/time -v ./testmodifyenc.sh ./client $runs_test $start_id
+
+echo "Encrypted retrieve: "
+/usr/bin/time -v ./testretrieve.sh ./client $runs_test $start_id
+
+kill -SIGINT $!
+rm csaa.db module_state
diff --git a/testdummy.sh b/testdummy.sh
index 4f4940b..4cb1e7a 100755
--- a/testdummy.sh
+++ b/testdummy.sh
@@ -15,7 +15,7 @@ rm files -rf
pid=$!
sleep .2
/usr/bin/time -v ./testcreate.sh ./dummy_client $runs_create
-/usr/bin/time -v ./testmodify.sh ./dummy_client $runs_test
-/usr/bin/time -v ./testretrieve.sh ./dummy_client $runs_test
+/usr/bin/time -v ./testmodify.sh ./dummy_client $runs_test 1
+/usr/bin/time -v ./testretrieve.sh ./dummy_client $runs_test 1
kill -SIGINT $!
rm csaa.db
diff --git a/testdummy_preinit.sh b/testdummy_preinit.sh
new file mode 100755
index 0000000..423c875
--- /dev/null
+++ b/testdummy_preinit.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+if [[ $# -ne 2 ]]
+then
+ echo "Usage: "$0" LOGLEAVES RUNS_TEST"
+ exit 1
+fi
+
+logleaves=$1
+runs_test=$2
+
+echo "Initializing dummy..."
+rm files -rf
+
+cp databases/dummy_$logleaves.db csaa.db
+chmod 644 csaa.db
+
+./dummy_server $1 csaa.db > /dev/null &
+
+start_id=$(echo "2^$1 - $runs_test + 1" | bc)
+
+pid=$!
+sleep .2
+/usr/bin/time -v ./testcreate.sh ./dummy_client $runs_test
+/usr/bin/time -v ./testmodify.sh ./dummy_client $runs_test $start_id
+/usr/bin/time -v ./testretrieve.sh ./dummy_client $runs_test $start_id
+
+kill -SIGINT $!
+
+rm csaa.db
diff --git a/testmain_preinit.sh b/testmain_preinit.sh
new file mode 100755
index 0000000..7be371b
--- /dev/null
+++ b/testmain_preinit.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+mkdir -p results
+trials=2
+runs_test=500
+
+# minimum is ceil(lg(runs_test)), otherwise modify will fail
+for i in `seq 10 12`
+do
+ echo "logleaves "$i
+
+ runs_create=$(echo '2^'"$i" | bc)
+
+ echo "Doing "$trials"x"$runs_test" operations, with prepopulated database"
+ for j in $(seq 1 $trials)
+ do
+ ./testall_preinit.sh $i $runs_test 2> results/run_"$i"_"$j".txt
+ sleep .2
+
+ # dummy
+ ./testdummy_preinit.sh $i $runs_test 2> results/dummy_"$i"_"$j".txt
+ sleep .2
+ done
+done
diff --git a/testmodify.sh b/testmodify.sh
index bd20dc7..2762196 100755
--- a/testmodify.sh
+++ b/testmodify.sh
@@ -1,7 +1,10 @@
#!/bin/bash
-# modify files 1 - $2, creating a new version with fixed contents
+# modify files $3 - ($3 + 2), creating a new version with fixed contents
echo "Modify:"
-for i in $(seq 1 $2)
+
+stop=$(echo "$3+$2" | bc)
+
+for i in $(seq $3 $stop)
do
$1 -u 1 -k a modifyfile -f $i -i container1/hello-world.tar > /dev/null
if [[ $? -ne 0 ]]
diff --git a/testmodifyenc.sh b/testmodifyenc.sh
index 5c182cc..4c4ae4f 100755
--- a/testmodifyenc.sh
+++ b/testmodifyenc.sh
@@ -1,6 +1,9 @@
#!/bin/bash
echo "Modify (encrypted):"
-for i in $(seq 1 $2)
+
+stop=$(echo "$3+$2" | bc)
+
+for i in $(seq $3 $stop)
do
$1 -u 1 -k a modifyfile -e -f $i -i container1/hello-world.tar > /dev/null
if [[ $? -ne 0 ]]
diff --git a/testretrieve.sh b/testretrieve.sh
index ed1bbf8..f0db543 100755
--- a/testretrieve.sh
+++ b/testretrieve.sh
@@ -1,7 +1,10 @@
#!/bin/bash
-# retrieve files 1 - $2, outputting to `out'
+# retrieve files $3-($3+$2), outputting to `out'
echo "Retrieve:"
-for i in $(seq 1 $2)
+
+stop=$(echo "$3+$2" | bc)
+
+for i in $(seq $3 $stop)
do
$1 -u 1 -k a retrievefile -f $i -o out > /dev/null
if [[ $? -ne 0 ]]