"Fossies" - the Fresh Open Source Software Archive

Member "check-0.13.0/tests/test_xml_output.sh" (22 Oct 2019, 1525 Bytes) of package /linux/privat/check-0.13.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "test_xml_output.sh": 0.10.0_vs_0.11.0.

    1 #!/usr/bin/env sh
    2 
    3 OUTPUT_FILE=test.xml
    4 CK_DEFAULT_TIMEOUT=4
    5 
    6 . ./test_vars
    7 . $(dirname $0)/test_output_strings
    8 
    9 rm -f ${OUTPUT_FILE}
   10 export CK_DEFAULT_TIMEOUT
   11 ./ex_output${EXEEXT} CK_MINIMAL XML NORMAL > /dev/null
   12 actual_xml=`cat ${OUTPUT_FILE} | tr -d "\r" | grep -v \<duration\> | grep -v \<datetime\> | grep -v \<path\>`
   13 if [ x"${expected_xml}" != x"${actual_xml}" ]; then
   14     echo "Problem with ex_xml_output${EXEEXT}";
   15     echo "Expected:";
   16     echo "${expected_xml}";
   17     echo "Got:";
   18     echo "${actual_xml}";
   19     exit 1;
   20 fi
   21 
   22 actual_duration_count=`grep -c \<duration\> ${OUTPUT_FILE}`
   23 if [ x"${expected_duration_count}" != x"${actual_duration_count}" ]; then
   24     echo "Wrong number of <duration> elements in ${OUTPUT_FILE}, ${expected_duration_count} vs ${actual_duration_count}";
   25     exit 1;
   26 fi
   27 
   28 num_durations=`grep "\<duration\>" ${OUTPUT_FILE} | wc -l`
   29 
   30 i=1
   31 while [ ${i} -le ${num_durations} ]; do
   32    duration=`grep "\<duration\>" ${OUTPUT_FILE} | head -n ${i} | tail -n 1 | cut -d ">" -f 2 | cut -d "<" -f 1`
   33    int_duration=`echo $duration | cut -d "." -f 1`
   34    if [ "${int_duration}" -ne "-1" ] && [ "${int_duration}" -gt "${CK_DEFAULT_TIMEOUT}" ]; then
   35        echo "Problem with duration ${duration}; is not valid. Should be -1 or in [0, ${CK_DEFAULT_TIMEOUT}]"
   36        exit 1
   37    fi
   38 
   39    i=$((i+1))
   40 done
   41 
   42 if [ ! -z `which xmllint` ]; then
   43     xmllint_output=`xmllint ${OUTPUT_FILE}`
   44     if [ $? -ne 0 ]; then
   45         echo "xmllint found an issue"
   46         echo ${xmllint_output}
   47         exit 1
   48     fi
   49 fi
   50 
   51 exit 0