All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] tst_test: using SIGTERM to terminate process
Date: Mon, 31 May 2021 14:57:51 +0200	[thread overview]
Message-ID: <YLTdT3v4AscW1PIE@yuki> (raw)
In-Reply-To: <20f87781-e66d-e8c6-1ac5-de208667a7f2@jv-coder.de>

Hi!
> >>   # default trap function
> >> -trap "tst_brk TBROK 'test interrupted or timed out'" INT
> >> +trap "tst_brk TBROK 'test interrupted'" INT
> >> +trap "unset _tst_setup_timer_pid; tst_brk TBROK 'test terminated'" TERM
> > I've been looking at this for a while and I think that we should unset
> > the _tst_setup_timer_pid at the end of the _tst_timeout_process()
> > instead, right?
> That won't work or am I missing something? ;) We are in a subshell in 
> _tst_timeout_process, it cannot manipulate the environment of the parent 
> or is my mental modal of how shell works wrong again?.

Nah, you are right this time, I missed that it runs on a background.

> > Otherwise we will leave the timeout process sleeping if someone sends
> > SIGTERM to the test process from the outside, or do I miss something?
> Yes, that is one of the reasons why I initially suggested a different 
> signal for timeout. That would cleanly separate the logic.
> But on the other hand when will SIGTERM be sent from the outside? This 
> is probably only happening on shutdown? In that case it is not really a 
> problem.
> If someone wants to terminate gracefully using SIGTERM, he could send it 
> to the process group. That would kill the timeout process as well.

Okay. Let's go with this version, it's simple enough and anything that
would behave better would only overcomplicate the code again.

For the patch:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-05-31 12:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 12:26 [LTP] [PATCH 1/2] tst_test: discard the stderr output Li Wang
2021-05-18 12:26 ` [LTP] [PATCH 2/2] tst_test: using SIGTERM to terminate process Li Wang
2021-05-19  6:46   ` Joerg Vehlow
2021-05-19  8:52     ` Li Wang
2021-05-31 12:35     ` Cyril Hrubis
2021-05-31 13:16       ` Joerg Vehlow
2021-05-31 12:54         ` Cyril Hrubis
2021-06-01  4:23           ` Joerg Vehlow
2021-05-31 12:49   ` Cyril Hrubis
2021-05-31 13:20     ` Joerg Vehlow
2021-05-31 12:57       ` Cyril Hrubis [this message]
2021-06-01  2:08         ` Li Wang
2021-06-01  4:03           ` Petr Vorel
2021-05-18 13:50 ` [LTP] [PATCH 1/2] tst_test: discard the stderr output Cyril Hrubis
2021-05-18 14:35 ` 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=YLTdT3v4AscW1PIE@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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.