diff mbox series

[v6,05/37] kselftest/arm64: Allow signal tests to trigger from a function

Message ID 20211115152835.3212149-6-broonie@kernel.org (mailing list archive)
State New
Headers show
Series arm64/sme: Initial support for the Scalable Matrix Extension | expand

Commit Message

Mark Brown Nov. 15, 2021, 3:28 p.m. UTC
Currently we have the facility to specify custom code to trigger a signal
but none of the tests use it and for some reason the framework requires us
to also specify a signal to send as a trigger in order to make use of a
custom trigger. This doesn't seem to make much sense, instead allow the
use of a custom trigger function without specifying a signal to inject.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/signal/test_signals_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Catalin Marinas Dec. 9, 2021, 1:39 p.m. UTC | #1
On Mon, Nov 15, 2021 at 03:28:03PM +0000, Mark Brown wrote:
> Currently we have the facility to specify custom code to trigger a signal
> but none of the tests use it and for some reason the framework requires us
> to also specify a signal to send as a trigger in order to make use of a
> custom trigger. This doesn't seem to make much sense, instead allow the
> use of a custom trigger function without specifying a signal to inject.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  tools/testing/selftests/arm64/signal/test_signals_utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c
> index 22722abc9dfa..8bb12be87a51 100644
> --- a/tools/testing/selftests/arm64/signal/test_signals_utils.c
> +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c
> @@ -310,7 +310,7 @@ int test_setup(struct tdescr *td)
>  
>  int test_run(struct tdescr *td)
>  {
> -	if (td->sig_trig) {
> +	if (td->sig_trig || td->trigger) {
>  		if (td->trigger)
>  			return td->trigger(td);
>  		else

I think we can write this with even less indentation:

int test_run(struct tdescr *td)
{
	if (td->trigger)
		return td->trigger(td);
	else if (td->sig_trig)
		return default_trigger(td);
	return td->run(td, NULL, NULL);
}
diff mbox series

Patch

diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c
index 22722abc9dfa..8bb12be87a51 100644
--- a/tools/testing/selftests/arm64/signal/test_signals_utils.c
+++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c
@@ -310,7 +310,7 @@  int test_setup(struct tdescr *td)
 
 int test_run(struct tdescr *td)
 {
-	if (td->sig_trig) {
+	if (td->sig_trig || td->trigger) {
 		if (td->trigger)
 			return td->trigger(td);
 		else