public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] new ltp lib doesn't print actual error
@ 2016-06-15 17:08 Alexey Kodanev
  2016-06-15 17:28 ` Jan Stancek
  2016-06-20 12:17 ` Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Alexey Kodanev @ 2016-06-15 17:08 UTC (permalink / raw)
  To: ltp

Hi,

When running a test with the new LTP lib, noticed that if some error 
occurs in a library (tst_tmpdir.c), it'll print the same message:

TMPDIR=/usr ./creat01
tst_tmpdir.c:155: BROK: Non-NULL cleanup in newlib!

but should be:
TMPDIR=/usr ./creat01
tst_tmpdir.c:155: BROK: tst_tmpdir: mkdtemp(/usr/creF5DhMS) failed: EACCES


May be we should remove the strict check in tst_res.c? Otherwise we 
don't see the actual error.

diff --git a/lib/tst_res.c b/lib/tst_res.c
index b388d0d..dd27c54 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -547,11 +547,6 @@ void tst_brkm_(const char *file, const int lineno, 
int ttype,
         EXPAND_VAR_ARGS(tmesg, arg_fmt, USERMESG);

         if (tst_test) {
-               if (func) {
-                       tst_brk_(file, lineno, TBROK,
-                                "Non-NULL cleanup in newlib!");
- }
-
                 tst_brk_(file, lineno, ttype, "%s", tmesg);
         } else {
                 tst_brk__(file, lineno, ttype, func, "%s", tmesg);


Thanks,
Alexey


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] new ltp lib doesn't print actual error
  2016-06-15 17:08 [LTP] new ltp lib doesn't print actual error Alexey Kodanev
@ 2016-06-15 17:28 ` Jan Stancek
  2016-06-16  8:46   ` Alexey Kodanev
  2016-06-20 12:17 ` Cyril Hrubis
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2016-06-15 17:28 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Alexey Kodanev" <alexey.kodanev@oracle.com>
> To: ltp@lists.linux.it
> Sent: Wednesday, 15 June, 2016 7:08:11 PM
> Subject: [LTP] new ltp lib doesn't print actual error
> 
> Hi,
> 
> When running a test with the new LTP lib, noticed that if some error
> occurs in a library (tst_tmpdir.c), it'll print the same message:
> 
> TMPDIR=/usr ./creat01
> tst_tmpdir.c:155: BROK: Non-NULL cleanup in newlib!
> 
> but should be:
> TMPDIR=/usr ./creat01
> tst_tmpdir.c:155: BROK: tst_tmpdir: mkdtemp(/usr/creF5DhMS) failed: EACCES
> 
> 
> May be we should remove the strict check in tst_res.c? Otherwise we
> don't see the actual error.

Or turn it into warning, so that we get both failures. tst_tmpdir() needs
a fix to not pass cleanup function for newlib testcases.

diff --git a/lib/tst_res.c b/lib/tst_res.c
index b388d0d2e516..ab9759b9263b 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -548,8 +548,8 @@ void tst_brkm_(const char *file, const int lineno, int ttype,

        if (tst_test) {
                if (func) {
-                       tst_brk_(file, lineno, TBROK,
-                                "Non-NULL cleanup in newlib!");
+                       tst_resm(TWARN, "Non-NULL cleanup in newlib! %s:%d",
+                               file, lineno);
                }

                tst_brk_(file, lineno, ttype, "%s", tmesg);


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] new ltp lib doesn't print actual error
  2016-06-15 17:28 ` Jan Stancek
@ 2016-06-16  8:46   ` Alexey Kodanev
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2016-06-16  8:46 UTC (permalink / raw)
  To: ltp

Hi,
On 06/15/2016 08:28 PM, Jan Stancek wrote:
>
>
>
> ----- Original Message -----
>> From: "Alexey Kodanev" <alexey.kodanev@oracle.com>
>> To: ltp@lists.linux.it
>> Sent: Wednesday, 15 June, 2016 7:08:11 PM
>> Subject: [LTP] new ltp lib doesn't print actual error
>>
>> Hi,
>>
>> When running a test with the new LTP lib, noticed that if some error
>> occurs in a library (tst_tmpdir.c), it'll print the same message:
>>
>> TMPDIR=/usr ./creat01
>> tst_tmpdir.c:155: BROK: Non-NULL cleanup in newlib!
>>
>> but should be:
>> TMPDIR=/usr ./creat01
>> tst_tmpdir.c:155: BROK: tst_tmpdir: mkdtemp(/usr/creF5DhMS) failed: EACCES
>>
>>
>> May be we should remove the strict check in tst_res.c? Otherwise we
>> don't see the actual error.
> Or turn it into warning, so that we get both failures. tst_tmpdir() needs
> a fix to not pass cleanup function for newlib testcases.
>
> diff --git a/lib/tst_res.c b/lib/tst_res.c
> index b388d0d2e516..ab9759b9263b 100644
> --- a/lib/tst_res.c
> +++ b/lib/tst_res.c
> @@ -548,8 +548,8 @@ void tst_brkm_(const char *file, const int lineno, int ttype,
>
>          if (tst_test) {
>                  if (func) {
> -                       tst_brk_(file, lineno, TBROK,
> -                                "Non-NULL cleanup in newlib!");
> +                       tst_resm(TWARN, "Non-NULL cleanup in newlib! %s:%d",
> +                               file, lineno);
>                  }
>
>                  tst_brk_(file, lineno, ttype, "%s", tmesg);

OK, we can do that, I just thought why we need to print it as it's not 
related to the test...

Best regards,
Alexey

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] new ltp lib doesn't print actual error
  2016-06-15 17:08 [LTP] new ltp lib doesn't print actual error Alexey Kodanev
  2016-06-15 17:28 ` Jan Stancek
@ 2016-06-20 12:17 ` Cyril Hrubis
  2016-06-20 15:58   ` Alexey Kodanev
  1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2016-06-20 12:17 UTC (permalink / raw)
  To: ltp

Hi!
> When running a test with the new LTP lib, noticed that if some error 
> occurs in a library (tst_tmpdir.c), it'll print the same message:
> 
> TMPDIR=/usr ./creat01
> tst_tmpdir.c:155: BROK: Non-NULL cleanup in newlib!
> 
> but should be:
> TMPDIR=/usr ./creat01
> tst_tmpdir.c:155: BROK: tst_tmpdir: mkdtemp(/usr/creF5DhMS) failed: EACCES
> 
> 
> May be we should remove the strict check in tst_res.c? Otherwise we 
> don't see the actual error.

Passing a cleanup callback from newlib testcase is always a mistake
because it's never executed. I would prefer keeping the check in the
library.

It does not matter in case of tmpdir_cleanup() since that function only
prints a warning message. What about removing the tmpdir_cleanup()
cleanup instead? It does not seem to be useful to me anyway.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] new ltp lib doesn't print actual error
  2016-06-20 12:17 ` Cyril Hrubis
@ 2016-06-20 15:58   ` Alexey Kodanev
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2016-06-20 15:58 UTC (permalink / raw)
  To: ltp

Hi,
On 06/20/2016 03:17 PM, Cyril Hrubis wrote:
> Hi!
>> When running a test with the new LTP lib, noticed that if some error
>> occurs in a library (tst_tmpdir.c), it'll print the same message:
>>
>> TMPDIR=/usr ./creat01
>> tst_tmpdir.c:155: BROK: Non-NULL cleanup in newlib!
>>
>> but should be:
>> TMPDIR=/usr ./creat01
>> tst_tmpdir.c:155: BROK: tst_tmpdir: mkdtemp(/usr/creF5DhMS) failed: EACCES
>>
>>
>> May be we should remove the strict check in tst_res.c? Otherwise we
>> don't see the actual error.
> Passing a cleanup callback from newlib testcase is always a mistake
> because it's never executed. I would prefer keeping the check in the
> library.
>
> It does not matter in case of tmpdir_cleanup() since that function only
> prints a warning message. What about removing the tmpdir_cleanup()
> cleanup instead? It does not seem to be useful to me anyway.

Agree, I've checked both old/new lib, and now it looks good. Applied patch.

Thanks,
Alexey


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-20 15:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-15 17:08 [LTP] new ltp lib doesn't print actual error Alexey Kodanev
2016-06-15 17:28 ` Jan Stancek
2016-06-16  8:46   ` Alexey Kodanev
2016-06-20 12:17 ` Cyril Hrubis
2016-06-20 15:58   ` Alexey Kodanev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox