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_ogg"
42 required_objects[$i]='ogg_afh'
43 cmdline[$i]="add ${oggs[@]}"
48 required_objects[$i]='ogg_afh'
49 cmdline[$i]="ls -l=v -b ${oggs_base[@]}"
54 required_objects[$i]=''
55 cmdline[$i]="addatt $(seq 64 | tr '\n' ' ')"
60 required_objects[$i]=''
66 required_objects[$i]='ogg_afh'
67 cmdline[$i]="setatt 33+ ${oggs[@]}"
72 required_objects[$i]='ogg_afh'
73 cmdline[$i]="ls -l=v ${oggs[@]}"
74 good[$i]='^attributes_txt: 33'
77 commands[$i]='addmood'
78 cmdline[$i]="addmood test-mood"
81 commands[$i]='empty-mood-parameter'
82 cmdline[$i]="select m/"
83 expect_failure[$i]='true'
90 test_require_objects "server"
91 missing_objects="$result"
92 test_require_executables "ssh-keygen"
93 missing_executables="$result"
95 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
96 ssh-keygen -q -t rsa -b 2048 -N "" -m PEM -f $privkey
99 read &>/dev/null < /dev/tcp/localhost/$port
102 cat > $user_list << EOF
103 user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
106 # para_server sends this signal to all processes in the current process group.
111 --logfile "$serverlog" \
112 --config-file /dev/null \
114 --loglevel $loglevel \
116 --afs-database-dir "$db" \
117 --afs-socket "$sock" \
118 --user-list "$user_list" \
119 --http-port "$stream_port" \
120 --dccp-port "$stream_port"
121 (($? != 0)) && exit 1
124 for ((i=0; i < ${#commands[@]}; i++)); do
125 command=${commands[$i]}
126 if [[ -n "$missing_objects" ]]; then
127 test_skip "$command" "missing object(s): $missing_objects"
130 if [[ -n "$missing_executables" ]]; then
131 test_skip "$command" \
132 "missing executables(s): $missing_executables"
135 if (($key_gen_result != 0)); then
136 test_skip "$command" "ssh-keygen failed"
139 if (($check_port_result == 0)); then
140 test_skip "$command" "port $port already in use"
143 if [[ -n "${required_objects[$i]}" ]]; then
144 test_require_objects "${required_objects[$i]}"
145 if [[ -n "$result" ]]; then
146 test_skip "$command" "requires object $result"
150 if [[ -n "${expect_failure[$i]}" ]]; then
151 f=test_expect_failure
153 f=test_expect_success
157 --loglevel $loglevel \
158 --server-port $port \
159 --key-file $privkey \
160 --config-file /dev/null \
162 ${cmdline[$i]} > $command.out < /dev/null &&
163 { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
164 { [[ -z \"${bad[$i]}\" ]] || ! grep \"${bad[$i]}\"; } < $command.out
168 trap SIGUSR1 # reset to the value it had upon entrance to the shell