3 test_description='Check if server command socket works.
5 A new ssh key pair is generated, para_server is started and some commands are
6 sent to the server by executing para_client. This is an implicit check of the
15 # need absolute paths here because server cds to / in daemon mode
23 get_audio_file_paths ogg
24 declare -a oggs=($result)
25 declare -a oggs_base=(${oggs[@]##*/})
27 declare -a commands=() cmdline=() required_objects=() good=() bad=() \
32 good[$i]='help \{1,\}----'
37 good[$i]='^successfully'
38 bad[$i]='!^successfully'
41 commands[$i]='add_dir'
42 required_objects[$i]='ogg_afh'
43 cmdline[$i]="add -v $test_audio_file_dir"
48 required_objects[$i]='ogg_afh'
49 cmdline[$i]="rm -v $test_audio_file_dir/*"
53 commands[$i]="add_ogg"
54 required_objects[$i]='ogg_afh'
55 cmdline[$i]="add ${oggs[@]}"
60 required_objects[$i]='ogg_afh'
61 cmdline[$i]="ls -l=v -b ${oggs_base[@]}"
66 required_objects[$i]=''
67 cmdline[$i]="addatt $(seq 64 | tr '\n' ' ')"
72 required_objects[$i]=''
78 required_objects[$i]='ogg_afh'
79 cmdline[$i]="setatt 33+ ${oggs[@]}"
84 required_objects[$i]='ogg_afh'
85 cmdline[$i]="ls -l=v ${oggs[@]}"
86 good[$i]='^attributes_txt: 33'
89 commands[$i]='addmood'
90 cmdline[$i]="addmood test-mood"
93 commands[$i]='empty-mood-parameter'
94 cmdline[$i]="select m/"
95 expect_failure[$i]='true'
102 test_require_objects "server"
103 missing_objects="$result"
104 test_require_executables "ssh-keygen"
105 missing_executables="$result"
107 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
108 ssh-keygen -q -t rsa -b 2048 -N "" -m PEM -f $privkey
111 read &>/dev/null < /dev/tcp/localhost/$port
114 cat > $user_list << EOF
115 user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
118 # para_server sends this signal to all processes in the current process group.
123 --logfile "$serverlog" \
124 --config-file /dev/null \
126 --loglevel $loglevel \
128 --afs-database-dir "$db" \
129 --afs-socket "$sock" \
130 --user-list "$user_list" \
131 --http-port "$stream_port" \
132 --dccp-port "$stream_port"
133 (($? != 0)) && exit 1
136 for ((i=0; i < ${#commands[@]}; i++)); do
137 command=${commands[$i]}
138 if [[ -n "$missing_objects" ]]; then
139 test_skip "$command" "missing object(s): $missing_objects"
142 if [[ -n "$missing_executables" ]]; then
143 test_skip "$command" \
144 "missing executables(s): $missing_executables"
147 if (($key_gen_result != 0)); then
148 test_skip "$command" "ssh-keygen failed"
151 if (($check_port_result == 0)); then
152 test_skip "$command" "port $port already in use"
155 if [[ -n "${required_objects[$i]}" ]]; then
156 test_require_objects "${required_objects[$i]}"
157 if [[ -n "$result" ]]; then
158 test_skip "$command" "requires object $result"
162 if [[ -n "${expect_failure[$i]}" ]]; then
163 f=test_expect_failure
165 f=test_expect_success
169 --loglevel $loglevel \
170 --server-port $port \
171 --key-file $privkey \
172 --config-file /dev/null \
174 ${cmdline[$i]} > $command.out < /dev/null &&
175 { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
176 { [[ -z \"${bad[$i]}\" ]] || ! grep \"${bad[$i]}\"; } < $command.out
180 trap SIGUSR1 # reset to the value it had upon entrance to the shell