new
This commit is contained in:
150
test/run-tests.sh
Executable file
150
test/run-tests.sh
Executable file
@@ -0,0 +1,150 @@
|
||||
#!/bin/bash
|
||||
|
||||
_qCol() {
|
||||
# print "easier" mapping of ANSI colors and controls
|
||||
local K="\033[1;30m"
|
||||
local R="\033[1;31m"
|
||||
local G="\033[1;32m"
|
||||
local B="\033[1;34m"
|
||||
local Y="\033[1;33m"
|
||||
local M="\033[1;35m"
|
||||
local C="\033[1;36m"
|
||||
local W="\033[1;37m"
|
||||
|
||||
local k="\033[2;30m"
|
||||
local r="\033[2;31m"
|
||||
local g="\033[2;32m"
|
||||
local b="\033[2;34m"
|
||||
local y="\033[2;33m"
|
||||
local m="\033[2;35m"
|
||||
local c="\033[2;36m"
|
||||
local w="\033[2;37m"
|
||||
|
||||
local bk="\033[40m"
|
||||
local br="\033[41m"
|
||||
local bg="\033[42m"
|
||||
local by="\033[43m"
|
||||
local bb="\033[44m"
|
||||
local bm="\033[45m"
|
||||
local bc="\033[46m"
|
||||
local bw="\033[47m"
|
||||
|
||||
local S='\033[1m' #strong
|
||||
local s='\033[2m' #strong off
|
||||
local U='\033[4m' #underline
|
||||
local u='\033[24m' #underline off
|
||||
local z='\033[0m' #zero colors
|
||||
local Z='\033[0m' #zero colors
|
||||
local ic='\033[7m' #inverse colors
|
||||
local io='\033[27m' #inverse off
|
||||
local st='\033[9m' #strike on
|
||||
local so='\033[29m' #strike off
|
||||
local CLR='\033[2J' # Clear screen
|
||||
local CLREND='\033[K' # Clear to end of line
|
||||
local CLRBEG='\033[1K' # Clear to beginning of line
|
||||
local CLRSCR="$CLR"'\033[0;0H' # Clear screen, reset cursor
|
||||
|
||||
local color_keys=" K R G B Y M C W k r g b y m c w S s U u z Z ic io st so bk br bg by bb bm bc bw CLR CLREND CLRBEG CLRSCR "
|
||||
|
||||
[[ "$1" = "export" ]] && {
|
||||
local key
|
||||
local prefix="$2"
|
||||
[[ -z "$2" ]] && prefix=_c
|
||||
for key in $color_keys; do
|
||||
eval export ${prefix}${key}=\'${!key}\'
|
||||
done
|
||||
return
|
||||
}
|
||||
|
||||
local arg val
|
||||
for ((arg=1;arg<=$#;arg++)) {
|
||||
val=${!arg}
|
||||
[[ ${color_keys} = *" $val "* ]] || { echo "No such color code '${val}'" >&2; return 1; }
|
||||
printf ${!val}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cont() {
|
||||
set +x
|
||||
_qCol G
|
||||
echo Continue
|
||||
_qCol z
|
||||
read continue
|
||||
_qCol Y
|
||||
echo =========================================
|
||||
_qCol z
|
||||
set -x
|
||||
}
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
BIG="big file(1).ext"
|
||||
BIGS="big_file1.ext"
|
||||
SMALL="small file"
|
||||
SMALLS="small_file"
|
||||
IMAGE="image.jpg"
|
||||
|
||||
test -f "$BIG" || dd if=/dev/zero of="$BIG" bs=8192 count=40000
|
||||
test -f "$SMALL" ||dd if=/dev/urandom of="$SMALL" bs=4096 count=400
|
||||
test -f "$IMAGE" || convert -size 640x480 xc:gray $IMAGE
|
||||
|
||||
set -x
|
||||
#~ cont
|
||||
ROOTURL="http://localhost:8136"
|
||||
|
||||
if false; then
|
||||
pv "$IMAGE" | \
|
||||
curl -fL -w "\n" -F file="@-" -X POST \
|
||||
-H "Name: $IMAGE" \
|
||||
-H "Max-Downloads: 4" \
|
||||
-H "Expires-Days: 14" \
|
||||
-H "Secret: dff789f0bbe8183d3254258b33a147d580c1131f39a698c56d3f640ac8415714" \
|
||||
"$ROOTURL"/upload
|
||||
fi
|
||||
|
||||
if false; then
|
||||
pv "$SMALL" | \
|
||||
curl -fL -w "\n" -F file="@-" -X POST \
|
||||
-H "Name: $SMALL" \
|
||||
-H "Max-Downloads: 4000" \
|
||||
-H "Expires-Days: 14" \
|
||||
-H "Secret: dff789f0bbe8183d3254258b33a147d580c1131f39a698c56d3f640ac8415714" \
|
||||
"$ROOTURL"/upload
|
||||
|
||||
pv "$BIG" | \
|
||||
curl -fL -w "\n" -F file="@-" -X POST \
|
||||
-H "Name: $BIG" \
|
||||
-H "Max-Downloads: 4000" \
|
||||
-H "Expires-Days: 14" \
|
||||
-H "Secret: dff789f0bbe8183d3254258b33a147d580c1131f39a698c56d3f640ac8415714" \
|
||||
"$ROOTURL"/upload
|
||||
fi
|
||||
|
||||
sqlite3 ../data/flees.db "select * FROM files"
|
||||
|
||||
if false; then
|
||||
curl -fL -w "\n" \
|
||||
-H "Secret: dff789f0bbe8183d3254258b33a147d580c1131f39a698c56d3f640ac8415714" \
|
||||
"$ROOTURL"/details/OdD7X0aKOGM/big_file1.ext
|
||||
|
||||
fi
|
||||
|
||||
if false; then
|
||||
rm -f big_file1.ext
|
||||
wget \
|
||||
"$ROOTURL"/dl/OdD7X0aKOGM/big_file1.ext
|
||||
fi
|
||||
|
||||
if false; then
|
||||
curl -fL -w "\n" \
|
||||
-H "Secret: dff789f0bbe8183d3254258b33a147d580c1131f39a698c56d3f640ac8415714" \
|
||||
"$ROOTURL"/delete/SKDMsQ3ifx8/image.jpg
|
||||
fi
|
||||
|
||||
if true; then
|
||||
curl -fL -w "\n" \
|
||||
-H "Secret: dff789f0bbe8183d3254258b33a147d580c1131f39a698c56d3f640ac8415714" \
|
||||
"$ROOTURL"/ls
|
||||
fi
|
||||
Reference in New Issue
Block a user