rework how line numbers are verified in check_check_sub.c
Line number checking failures in check_check_sub.c are broken
and were broken since r527 (2009-02-02).
_STR(__LINE__) as is evaluates to "__LINE__", which results in -1
being returned from atoi. A -1 means to not check the line
number of the failure. As a result, no line numbers were checked
since r527. Checking with strtol finds the conversion failure,
which is what identified this bug.
Note that more redirection can be used to convert __LINE__ to a string,
e.g.:
#define LINE_TO_STRING(Y) #Y
#define _LINE_TO_STRING(Y) LINE_TO_STRING(Y)
#define _STR(Y) _LINE_TO_STRING(Y)
However, then the line converted to a string is the line which references
the macro. I.e., not the line number of the test, which was expected.
The tests of the failure line numbers are valuable. To fix them,
instead of determining the values at compile time, they are determined
at run time. Whenever a test should fail, record_failure_line_num()
will be used to record the line number to a temporary file.
This in several cases required splitting up a test which was used
to induce a success and a failure. For such functions, there is
now a clear function to use when a success is required (no call
to record_failure_line_num()) and one to use when a failure
is required at a specific location (to call record_failure_line_num()).
The FILE pointer is created at the setup of the sub suite, and
deleted on the cleanup. The test_check_failure_lnos test then
will, for each failure, read the next line in the file and make
sure it matches the value reported by Check.
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1168
64e312b2-a51f-0410-8e61-
82d0ca0eb02a