function_log_compare 

Fuego 1.0 wiki

Login or create account

function log compare

NAME [edit section]

log_compare

SYNOPSIS [edit section]

  • log_compare "$TESTDIR" <count> <pattern> <type>

DESCRIPTION [edit section]

log_compare is used to detect success or failure of a functional test.

It scans the test log looking for occurrences of the pattern, and counting the number of times it occurs.

It also does a comparison of the parsed test log output (filtered using the pattern) with saved, parsed test log output. If these don't match, then log_compare is supposed to fail with an error message.

The result of the last log_compare function determines the success or failure of the entire test.

EXAMPLES [edit section]

Here are some sample invocations:
       log_compare "$TESTDIR" "11" "^TEST.*OK" "p"

       log_compare "$TESTDIR" $FUNCTIONAL_CMT_LINES_COUNT "Test passed" "p"

       log_compare "$TESTDIR" "0" "^TEST.*FAILED" "n"

        assert_define LTP_OPEN_POSIX_SUBTEST_COUNT_POS
        P_CRIT="execution: PASS"
        log_compare "$TESTDIR" $LTP_OPEN_POSIX_SUBTEST_COUNT_POS "${P_CRIT}" "p"

ENVIRONMENT and ARGUMENTS [edit section]

Arguments to log_compare are:

  • $1 should be "$TESTDIR"
  • $2 should be the count of how many times to expect the pattern in the test log
  • $3 should be the regular expression pattern to search for in the test log
  • $4 should be one of 'p' or 'n'. 'p' is for positive results and 'n' is for negative results.

Environment variables used by log_compare are:

  • FUEGO_RW
  • TESTDIR
  • NODE_NAME
  • BUILD_ID
  • BUILD_NUM

RETURN [edit section]

Returns non-zero on error.

SOURCE [edit section]

Located in scripts/functions.sh

SEE ALSO [edit section]

TBWiki engine 1.8.3 by Tim Bird