FrontPage 

Fuego wiki

Login or create account

function log compare in 'raw' format

= NAME =
log_compare

= SYNOPSIS =
 * log_compare "$TESTDIR" <count> <pattern> <type> 

= DESCRIPTION =
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 =
Here are some sample invocations:
{{{#!YellowBox
   log_compare "$TESTDIR" "11" "^TEST.*OK" "p"
}}}

{{{#!YellowBox
   log_compare "$TESTDIR" $FUNCTIONAL_CMT_LINES_COUNT "Test passed" "p"
}}}

{{{#!YellowBox
   log_compare "$TESTDIR" "0" "^TEST.*FAILED" "n"
}}}

{{{#!YellowBox
    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 =

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 =
Returns non-zero on error.

= SOURCE =
Located in ''scripts/functions.sh''

= SEE ALSO =
 * [[function_test_processing|test_processing]]


TBWiki engine 1.8.3 by Tim Bird