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
26 declare -a commands=() cmdline=() required_objects=() good=() bad=()
30 good[$i]='help server ----'
35 good[$i]='^successfully'
36 bad[$i]='!^successfully'
39 commands[$i]="add_ogg"
40 required_objects[$i]='ogg_afh'
41 cmdline[$i]="add $oggs"
46 required_objects[$i]='ogg_afh'
47 cmdline[$i]="ls -lv -p $oggs"
55 test_require_objects "server"
56 missing_objects="$result"
57 test_require_executables "ssh-keygen"
58 missing_executables="$result"
60 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
61 ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
64 read &>/dev/null < /dev/tcp/localhost/$port
67 cat > $user_list << EOF
68 user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
71 # para_server sends this signal to all processes in the current process group.
76 --logfile "$serverlog" \
77 --config-file /dev/null \
79 --loglevel $loglevel \
81 --afs-database-dir "$db" \
82 --afs-socket "$sock" \
83 --user-list "$user_list" \
84 --http-port "$stream_port" \
85 --dccp-port "$stream_port"
88 for ((i=0; i < ${#commands[@]}; i++)); do
89 command=${commands[$i]}
90 if [[ -n "$missing_objects" ]]; then
91 test_skip "$command" "missing object(s): $missing_objects"
94 if [[ -n "$missing_executables" ]]; then
95 test_skip "$command" \
96 "missing executables(s): $missing_executables"
99 if (($key_gen_result != 0)); then
100 test_skip "$command" "ssh-keygen failed"
103 if (($check_port_result == 0)); then
104 test_skip "$command" "port $port already in use"
107 if [[ -n "${required_objects[$i]}" ]]; then
108 test_require_objects "${required_objects[$i]}"
109 if [[ -n "$result" ]]; then
110 test_skip "$command" "requires object $result"
114 test_expect_success "$command" "
116 --loglevel $loglevel \
117 --server-port $port \
118 --key-file $privkey \
119 --config-file /dev/null \
121 ${cmdline[$i]} > $command.out &&
122 { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
123 { [[ -z \"${bad[$i]}\" ]] || ! grep \"${bad[$i]}\"; } < $command.out
127 trap SIGUSR1 # reset to the value it had upon entrance to the shell