3 #----------------------------------------------------------------------------------
5 # Copyright (c) 2018-2019 AT&T Intellectual Property.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 #---------------------------------------------------------------------------------
22 # ----------------------------------------------------------------------
23 # Mnemonic: verify_replay.sh
24 # Abstract: Simple script to attempt to verify that the replay utility
25 # works as expected. This assumes that verify.sh has been run
26 # and that at least one RDC file is in /tmp/rdc. This script
27 # will start the replay utility and a few pipe listeners to
30 # Date: 19 November 2019
31 # Author: E. Scott Daniels
32 # ----------------------------------------------------------------------
34 # set the various sleep values based on long test or short test
35 function set_wait_values {
41 echo "starting replayer"
42 file=$( ls ${stage_dir}/MCLT_*|head -1 )
45 /playpen/bin/rdc_replay -f $file -d $fifo_dir >/tmp/replay.log 2>&1
48 echo "replay finished"
51 # run a pipe reader for one message type
53 echo "starting pipe reader $1"
54 /playpen/bin/pipe_reader $ext_hdr -m $1 -d $fifo_dir >/tmp/pr.$1.log 2>&1 &
55 #/playpen/bin/pipe_reader -m $1 -d $fifo_dir & # >/tmp/pr.$1.log 2>&1
59 echo "stopping pipe reader $1"
63 # ---- run everything ---------------------------------------------------
65 ext_hdr="" # run with extended header enabled (-e turns extended off)
66 run_listener=0 # -a turns on to run all
71 *) echo "$1 is not a recognised option"
73 echo "-a will cause the listener verification to run which generates files for this script"
83 echo "running listener to generate test files to replay..."
85 verify.sh # assumed to be in the path
91 if (( ! raw_capture )) # -n set, turn off capture
93 export MCL_RDC_ENABLE=0
96 if [[ -d /data/final ]] # assume if we find data that final directory goes here
98 echo "### found /data/final using that as final directory"
99 export MCL_RDC_FINAL=/data/final
102 stage_dir=${MCL_RDC_STAGE:-/tmp/rdc/stage}
103 if [[ ! -d $stage_dir ]]
105 echo "abort: cannot find stage directory to replay from: $stage_dir"
110 if [[ ! -d $fifo_dir ]]
112 mkdir -p $fifo_dir # redirect fifos so we don't depend on mount
116 for p in 0 1 2 3 4 5 6
122 run_replay & # start after readers are going
124 sleep $main_wait # long enough for all functions to finish w/o having to risk a wait hanging
125 echo "all functions stopped; looking at logs"
127 # ---------- validation -------------------------------------------------
131 # logs should be > 0 in size
132 echo "----- logs ---------"
135 # pipe reader log files 1-6 should have 'stand up and cheer' messages
136 # pipe reader log for MT 0 will likley be empty as sender sends only
137 # one of those and buffer not likely flushed. So, we only check 1-6
141 if [[ ! -s /tmp/pr.$l.log ]]
143 echo "[FAIL] log $l was empty"
146 if ! grep -q -i "stand up and cheer" /tmp/pr.$l.log
148 echo "[FAIL] pipe reader log did not have any valid messages: /tmp/pr.$l.log"
156 echo "[OK] All logs seem good"
159 nfifos=$( ls /tmp/fifos/MT_* | wc -l )
162 echo "didn't find enough fifos"
166 echo "[OK] Found expected fifos"
171 echo "[FAIL] $errors errors noticed"