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 ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
63 read &>/dev/null < /dev/tcp/localhost/$port
66 cat > $user_list << EOF
67 user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
70 # para_server sends this signal to all processes in the current process group.
74 --logfile "$serverlog" \
75 --config_file /dev/null \
77 --loglevel $loglevel \
79 --afs_database_dir "$db" \
80 --afs_socket "$sock" \
81 --user_list "$user_list" \
82 --http_port "$stream_port" \
83 --dccp_port "$stream_port"
85 for ((i=0; i < ${#commands[@]}; i++)); do
86 command=${commands[$i]}
87 if [[ -n "$missing_objects" ]]; then
88 test_skip "$command" "missing object(s): $missing_objects"
91 if [[ -n "$missing_executables" ]]; then
92 test_skip "$command" \
93 "missing executables(s): $missing_executables"
96 if (($key_gen_result != 0)); then
97 test_skip "$command" "ssh-keygen failed"
100 if (($check_port_result == 0)); then
101 test_skip "$command" "port $port already in use"
104 if [[ -n "${required_objects[$i]}" ]]; then
105 test_require_objects "${required_objects[$i]}"
106 if [[ -n "$result" ]]; then
107 test_skip "$command" "requires object $result"
111 test_expect_success "$command" "
113 --loglevel $loglevel \
114 --server_port $port \
115 --key_file $privkey \
116 --config_file /dev/null \
118 ${cmdline[$i]} > $command.out &&
119 { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
120 { [[ -z \"${bad[$i]}\" ]] || ! grep \"${bad[$i]}\"; } < $command.out
124 trap SIGUSR1 # reset to the value it had upon entrance to the shell