diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /stdlib/tst-fmtmsg.c | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz |
2.5-18.1
Diffstat (limited to 'stdlib/tst-fmtmsg.c')
-rw-r--r-- | stdlib/tst-fmtmsg.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/stdlib/tst-fmtmsg.c b/stdlib/tst-fmtmsg.c index d5369bda62..c3748d64d5 100644 --- a/stdlib/tst-fmtmsg.c +++ b/stdlib/tst-fmtmsg.c @@ -1,6 +1,8 @@ #include <fmtmsg.h> #include <mcheck.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #define MM_TEST 10 @@ -12,11 +14,13 @@ main (void) mtrace (); - if (addseverity (MM_TEST, "TEST") != MM_OK) + char TEST[] = "ABCD"; + if (addseverity (MM_TEST, TEST) != MM_OK) { puts ("addseverity failed"); result = 1; } + strcpy (TEST, "TEST"); if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt", "should print message for MM_HALT", "GLIBC:tst-fmtmsg:1") @@ -48,5 +52,31 @@ main (void) != MM_OK) result = 1; + if (addseverity (MM_TEST, NULL) != MM_OK) + { + puts ("second addseverity failed"); + result = 1; + } + + if (addseverity (MM_TEST, NULL) != MM_NOTOK) + { + puts ("third addseverity unexpectedly succeeded"); + result = 1; + } + + char *p = strdup ("TEST2"); + if (addseverity (MM_TEST, p) != MM_OK) + { + puts ("fourth addseverity failed"); + result = 1; + } + if (addseverity (MM_TEST, "TEST3") != MM_OK) + { + puts ("fifth addseverity failed"); + result = 1; + } + + free (p); + return result; } |