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 -lv ${oggs_base[@]}"
56 test_require_objects "server"
57 missing_objects="$result"
58 test_require_executables "ssh-keygen"
59 missing_executables="$result"
61 if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
62 ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
65 read &>/dev/null < /dev/tcp/localhost/$port
68 cat > $user_list << EOF
69 user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
72 # para_server sends this signal to all processes in the current process group.
77 --logfile "$serverlog" \
78 --config-file /dev/null \
80 --loglevel $loglevel \
82 --afs-database-dir "$db" \
83 --afs-socket "$sock" \
84 --user-list "$user_list" \
85 --http-port "$stream_port" \
86 --dccp-port "$stream_port"
89 for ((i=0; i < ${#commands[@]}; i++)); do
90 command=${commands[$i]}
91 if [[ -n "$missing_objects" ]]; then
92 test_skip "$command" "missing object(s): $missing_objects"
95 if [[ -n "$missing_executables" ]]; then
96 test_skip "$command" \
97 "missing executables(s): $missing_executables"
100 if (($key_gen_result != 0)); then
101 test_skip "$command" "ssh-keygen failed"
104 if (($check_port_result == 0)); then
105 test_skip "$command" "port $port already in use"
108 if [[ -n "${required_objects[$i]}" ]]; then
109 test_require_objects "${required_objects[$i]}"
110 if [[ -n "$result" ]]; then
111 test_skip "$command" "requires object $result"
115 test_expect_success "$command" "
117 --loglevel $loglevel \
118 --server-port $port \
119 --key-file $privkey \
120 --config-file /dev/null \
122 ${cmdline[$i]} > $command.out &&
123 { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
124 { [[ -z \"${bad[$i]}\" ]] || ! grep \"${bad[$i]}\"; } < $command.out
128 trap SIGUSR1 # reset to the value it had upon entrance to the shell