t0004: Always create PEM keys.
[paraslash.git] / t / t0004-server.sh
index 04d6cd609a33a9886130d31efff86f4af509ab6f..03957464e17e2a50596149e59627cd7584424fe9 100755 (executable)
@@ -21,13 +21,14 @@ pubkey=$privkey.pub
 serverlog=server.log
 
 get_audio_file_paths ogg
 serverlog=server.log
 
 get_audio_file_paths ogg
-oggs="$result"
+declare -a oggs=($result)
+declare -a oggs_base=(${oggs[@]##*/})
 
 declare -a commands=() cmdline=() required_objects=() good=() bad=()
 i=0
 commands[$i]="help"
 
 declare -a commands=() cmdline=() required_objects=() good=() bad=()
 i=0
 commands[$i]="help"
-cmdline[$i]="help"
-good[$i]='help server  ----'
+cmdline[$i]="help -l"
+good[$i]='help \{1,\}----'
 
 let i++
 commands[$i]="init"
 
 let i++
 commands[$i]="init"
@@ -38,14 +39,38 @@ bad[$i]='!^successfully'
 let i++
 commands[$i]="add_ogg"
 required_objects[$i]='ogg_afh'
 let i++
 commands[$i]="add_ogg"
 required_objects[$i]='ogg_afh'
-cmdline[$i]="add $oggs"
+cmdline[$i]="add ${oggs[@]}"
 bad[$i]='.'
 
 let i++
 commands[$i]="ls_ogg"
 required_objects[$i]='ogg_afh'
 bad[$i]='.'
 
 let i++
 commands[$i]="ls_ogg"
 required_objects[$i]='ogg_afh'
-cmdline[$i]="ls -lv -p $oggs"
-good[$i]='^path:'
+cmdline[$i]="ls -l=v -b ${oggs_base[@]}"
+good[$i]='^basename:'
+
+let i++
+commands[$i]='addatt'
+required_objects[$i]=''
+cmdline[$i]="addatt $(seq 64 | tr '\n' ' ')"
+bad[$i]='.'
+
+let i++
+commands[$i]='lsatt'
+required_objects[$i]=''
+cmdline[$i]="lsatt"
+good[$i]='^1$'
+
+let i++
+commands[$i]='setatt'
+required_objects[$i]='ogg_afh'
+cmdline[$i]="setatt 33+ ${oggs[@]}"
+bad[$i]='.'
+
+let i++
+commands[$i]="ls"
+required_objects[$i]='ogg_afh'
+cmdline[$i]="ls -l=v ${oggs[@]}"
+good[$i]='^attributes_txt: 33'
 
 let i++
 commands[$i]="term"
 
 let i++
 commands[$i]="term"
@@ -58,7 +83,7 @@ test_require_executables "ssh-keygen"
 missing_executables="$result"
 
 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
 missing_executables="$result"
 
 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
-       ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
+       ssh-keygen -q -t rsa -b 2048 -N "" -m PEM -f $privkey
        key_gen_result=$?
 
        read &>/dev/null < /dev/tcp/localhost/$port
        key_gen_result=$?
 
        read &>/dev/null < /dev/tcp/localhost/$port
@@ -83,6 +108,7 @@ EOF
                --user-list "$user_list" \
                --http-port "$stream_port" \
                --dccp-port "$stream_port"
                --user-list "$user_list" \
                --http-port "$stream_port" \
                --dccp-port "$stream_port"
+       (($? != 0)) && exit 1
 fi
 
 for ((i=0; i < ${#commands[@]}; i++)); do
 fi
 
 for ((i=0; i < ${#commands[@]}; i++)); do