The previous implementation of the TEST_COMPARE macro would fail
to compile code like this:
int ret = res_send (query, sizeof (query), buf, sizeof (buf));
TEST_COMPARE (ret,
sizeof (query)
+ 2 /* Compression reference. */
+ 2 + 2 + 4 + 2 /* Type, class, TTL, RDATA length. */
+ 1 /* Pascal-style string length. */
+ strlen (expected_name));
This resulted in a failed static assertion, "integer conversions
may alter sign of operands". A user of the TEST_COMPARE would have
to add a cast to fix this.
This patch reverts to the original proposed solution of a run-time
check, making TEST_COMPARE usable for comparisons of numbers with
types with different signedness in more contexts.
Previously, the implementation would conditionally exit based on the
status argument, which GCC did not know about. This leads to
false uninitialized variable warnings when data is accessed after a
TEST_VERIFY_EXIT failure (from code which would never execute).
This causes more test programs to link in the support_record_failure
function, which triggers an early call to mmap from an ELF
constructor, but this should not have side effects intefering
with the functionality actually under test (unlike, say, a call
to malloc).
This patch adds a simple SYSV message queue test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvmsg.
* sysvipc/test-sysvmsg.c: New file.
* test-skeleton.c (FAIL_UNSUPPORTED): New define.
The new functions support_record_failure records a test failure,
but does not terminate the process. The macros TEST_VERIFY
and TEST_VERIFY_EXIT check that a condition is true.
The new test driver in <support/test-driver.c> has feature parity with
the old one. The main difference is that its hooking mechanism is
based on functions and function pointers instead of macros. This
commit also implements a new environment variable, TEST_COREDUMPS,
which disables the code which disables coredumps (that is, it enables
them if the invocation environment has not disabled them).
<test-skeleton.c> defines wrapper functions so that it is possible to
use existing macros with the new-style hook functionality.
This commit changes only a few test cases to the new test driver, to
make sure that it works as expected.