All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] lib/tst_test.c: Fix tst_brk() handling
Date: Thu, 3 Apr 2025 16:12:27 +0200	[thread overview]
Message-ID: <Z-6XSwc9Rbu2RIzm@yuki.lan> (raw)
In-Reply-To: <20250403123610.GA465253@pevik>

Hi!
> One thing I'm worried is the fact that some shell loader tests core dumped in CI:
> https://github.com/pevik/ltp/actions/runs/14242818586/job/39916477770
> e.g. these which are supposed to TBROK due broken metadata:
> shell_loader_invalid_block.sh, shell_loader_no_metadata.sh,
> shell_loader_wrong_metadata.sh:
> 
> Segmentation fault (core dumped)

Ah, that's because if we call tst_brk() before we finished
initialization results is not defined. We need at least:

diff --git a/lib/tst_test.c b/lib/tst_test.c
index c6395a5eb..6b1100b09 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -407,7 +407,8 @@ void tst_vbrk_(const char *file, const int lineno, int ttype, const char *fmt,
         * current process.
         */
        if (TTYPE_RESULT(ttype) == TBROK) {
-               tst_atomic_inc(&results->abort_flag);
+               if (results)
+                       tst_atomic_inc(&results->abort_flag);

                /*
                 * If TBROK was called from one of the child processes we kill

> I also wonder if tst_brk() related doc should be updated.

I did update the documentation comment in the tst_test.h.

> Isn't there anything which should be updated in doc/old/C-Test-API.asciidoc ?
> This docs will stay with us for some time, the conversion to kerneldoc takes
> time, it'd be good to keep it updated (valuable texts will be migrated to
> kerneldoc).
> 
> Maybe parts:
> 1.8 Doing the test in the child process
> 1.9 Fork() and Parent-child synchronization
> (both code examples and the description).

I will have a look.

> very nit: please before merge fix typos in both code and commit message:
> exitting => exiting
> countes|countes => counters
> immediatelly => immediately
> filtesystem => filesyste

Uff, will do.

> NOTE: test_brk_pass could be added to lib/newlib_tests/runtest.sh. I would also
> prefer, if we changed tests to behave like testcases/lib/run_tests.sh, i.e.
> allow to run all tests and check exit code (intermediate step before we compare
> the test output).

Rewriting the tests is a more complex task that should be done in a
separate patchset.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-04-03 14:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 11:30 [LTP] [PATCH] lib/tst_test.c: Fix tst_brk() handling Cyril Hrubis
2025-04-03 12:36 ` Petr Vorel
2025-04-03 14:12   ` Cyril Hrubis [this message]
2025-04-04 12:04     ` Cyril Hrubis
2025-04-04 12:55       ` Petr Vorel
2025-04-04 12:58         ` Jan Stancek via ltp
2025-04-04 14:00         ` Cyril Hrubis
2025-04-04 13:18     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-6XSwc9Rbu2RIzm@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.