diff options
author | Maciej W. Rozycki <macro@redhat.com> | 2024-07-26 13:21:34 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@redhat.com> | 2024-07-26 13:21:34 +0100 |
commit | 1b97a9f23bf605ca608162089c94187573fb2a9e (patch) | |
tree | b49b6733838b5d7f392b64058415a463a672eba2 /math | |
parent | fe47595504a55e7bb992f8928533df154b510383 (diff) | |
download | glibc-1b97a9f23bf605ca608162089c94187573fb2a9e.tar.gz glibc-1b97a9f23bf605ca608162089c94187573fb2a9e.tar.xz glibc-1b97a9f23bf605ca608162089c94187573fb2a9e.zip |
support: Add FAIL test failure helper
Add a FAIL test failure helper analogous to FAIL_RET, that does not cause the current function to return, providing a standardized way to report a test failure with a message supplied while permitting the caller to continue executing, for further reporting, cleaning up, etc. Update existing test cases that provide a conflicting definition of FAIL by removing the local FAIL definition and then as follows: - tst-fortify-syslog: provide a meaningful message in addition to the file name already added by <support/check.h>; 'support_record_failure' is already called by 'support_print_failure_impl' invoked by the new FAIL test failure helper. - tst-ctype: no update to FAIL calls required, with the name of the file and the line number within of the failure site additionally included by the new FAIL test failure helper, and error counting plus count reporting upon test program termination also already provided by 'support_record_failure' and 'support_report_failure' respectively, called by 'support_print_failure_impl' and 'adjust_exit_status' also respectively. However in a number of places 'printf' is called and the error count adjusted by hand, so update these places to make use of FAIL instead. And last but not least adjust the final summary just to report completion, with any error count following as reported by the test driver. - test-tgmath2: no update to FAIL calls required, with the name of the file of the failure site additionally included by the new FAIL test failure helper. Also there is no need to track the return status by hand as any call to FAIL will eventually cause the test case to return an unsuccesful exit status regardless of the return status from the test function, via a call to 'adjust_exit_status' made by the test driver. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'math')
-rw-r--r-- | math/test-tgmath2.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/math/test-tgmath2.c b/math/test-tgmath2.c index 37afa8a08a..4aeb877b8e 100644 --- a/math/test-tgmath2.c +++ b/math/test-tgmath2.c @@ -24,6 +24,8 @@ #include <string.h> #include <tgmath.h> +#include <support/check.h> + //#define DEBUG typedef complex float cfloat; @@ -87,13 +89,6 @@ enum int count; int counts[Tlast][C_last]; -#define FAIL(str) \ - do \ - { \ - printf ("%s failure on line %d\n", (str), __LINE__); \ - result = 1; \ - } \ - while (0) #define TEST_TYPE_ONLY(expr, rettype) \ do \ { \ @@ -133,8 +128,6 @@ int counts[Tlast][C_last]; int test_cos (const int Vint4, const long long int Vllong4) { - int result = 0; - TEST (cos (vfloat1), float, cos); TEST (cos (vdouble1), double, cos); TEST (cos (vldouble1), ldouble, cos); @@ -152,7 +145,7 @@ test_cos (const int Vint4, const long long int Vllong4) TEST (cos (Vcdouble1), cdouble, cos); TEST (cos (Vcldouble1), cldouble, cos); - return result; + return 0; } int |