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=()
31 good[$i]='help server ----'
36 good[$i]='^successfully'
37 bad[$i]='!^successfully'
40 commands[$i]="add_ogg"
41 required_objects[$i]='ogg_afh'
42 cmdline[$i]="add ${oggs[@]}"
47 required_objects[$i]='ogg_afh'
48 cmdline[$i]="ls -l=v -b ${oggs_base[@]}"
53 required_objects[$i]=''
54 cmdline[$i]="addatt $(seq 64 | tr '\n' ' ')"
59 required_objects[$i]=''
65 required_objects[$i]='ogg_afh'
66 cmdline[$i]="setatt 33+ ${oggs[@]}"
71 required_objects[$i]='ogg_afh'
72 cmdline[$i]="ls -l=v -F ${oggs[@]}"
73 good[$i]='^attributes_txt: 33'
80 test_require_objects "server"
81 missing_objects="$result"
82 test_require_executables "ssh-keygen"
83 missing_executables="$result"
85 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
86 ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
89 read &>/dev/null < /dev/tcp/localhost/$port
92 cat > $user_list << EOF
93 user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
96 # para_server sends this signal to all processes in the current process group.
101 --logfile "$serverlog" \
102 --config-file /dev/null \
104 --loglevel $loglevel \
106 --afs-database-dir "$db" \
107 --afs-socket "$sock" \
108 --user-list "$user_list" \
109 --http-port "$stream_port" \
110 --dccp-port "$stream_port"
111 (($? != 0)) && exit 1
114 for ((i=0; i < ${#commands[@]}; i++)); do
115 command=${commands[$i]}
116 if [[ -n "$missing_objects" ]]; then
117 test_skip "$command" "missing object(s): $missing_objects"
120 if [[ -n "$missing_executables" ]]; then
121 test_skip "$command" \
122 "missing executables(s): $missing_executables"
125 if (($key_gen_result != 0)); then
126 test_skip "$command" "ssh-keygen failed"
129 if (($check_port_result == 0)); then
130 test_skip "$command" "port $port already in use"
133 if [[ -n "${required_objects[$i]}" ]]; then
134 test_require_objects "${required_objects[$i]}"
135 if [[ -n "$result" ]]; then
136 test_skip "$command" "requires object $result"
140 test_expect_success "$command" "
142 --loglevel $loglevel \
143 --server-port $port \
144 --key-file $privkey \
145 --config-file /dev/null \
147 ${cmdline[$i]} > $command.out &&
148 { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
149 { [[ -z \"${bad[$i]}\" ]] || ! grep \"${bad[$i]}\"; } < $command.out
153 trap SIGUSR1 # reset to the value it had upon entrance to the shell