cis: bug fixes
[living-lab-site.git] / cis / eval / sec-eval.sh
1 #!/usr/bin/env bash
2
3 if [ $# -ne 1 ]; then
4         echo "usage: $0 <http | https>" >&2
5         exit 1
6 fi
7
8 TEST_TYPE=$1
9
10 case $TEST_TYPE in
11         "http")
12                 CMD="curl http://localhost:8080/test"
13                 ;;
14         "https")
15                 CMD="curl https://localhost:8080/test --insecure"
16                 ;;
17         *)
18                 echo "invalid parameter!" >&2
19                 ;;
20 esac
21
22 cd ..
23
24 for i in $(seq 1 1000); do
25         t1=$(date +%s.%N)
26         $CMD 2> /dev/null
27         t2=$(date +%s.%N)
28         
29         delta_t=$(echo "$t2 - $t1" | bc)
30         echo $delta_t
31 done