public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 4/5] lib/tst_res_.c: Add TBROK handler + more verbose errors
Date: Wed, 11 Dec 2024 01:11:06 +0100	[thread overview]
Message-ID: <20241211001106.GE386508@pevik> (raw)
In-Reply-To: <20241203151530.16882-5-chrubis@suse.cz>

> We use the tst_res_ helper for tst_brk_ as well so we need to be able to
> handle TBROK type as well.

How can we call tst_brk_() via tst_res_() ?
	tst_res_(argv[1], atoi(argv[2]), type, "%s", msg);

Also we have TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN check to not
add TBROK to tst_res_().

...
> -	else if (!strcmp(argv[3], "TINFO"))
> +	} else if (!strcmp(argv[3], "TINFO")) {
>  		type = TINFO;
> -	else if (!strcmp(argv[3], "TDEBUG"))
> +	} else if (!strcmp(argv[3], "TDEBUG")) {
>  		type = TDEBUG;
> -	else
> +	} else if (!strcmp(argv[3], "TBROK")) {
> +		type = TBROK;
> +	} else {
> +		printf("Wrong type '%s'\n", argv[3]);
>  		goto help;

Also tst_brk allows only TBROK and TCONF in C:

#define tst_brk(ttype, arg_fmt, ...)						\
	({									\
		TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(!((ttype) &			\
			(TBROK | TCONF | TFAIL)));				\
		tst_brk_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\
	})

... and shell:

	if [ "$res" != TBROK -a "$res" != TCONF ]; then
		tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res)"
	else
		tst_res "$res" "$@"
	fi

Kind regards,
Petr

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

  reply	other threads:[~2024-12-11  0:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 15:15 [LTP] [PATCH 0/5] First new shell library converted test Cyril Hrubis
2024-12-03 15:15 ` [LTP] [PATCH 1/5] tst_run_shell: Add save_restore parser Cyril Hrubis
2024-12-10 23:39   ` Petr Vorel
2024-12-03 15:15 ` [LTP] [PATCH 2/5] libs/ujson: Fix "Garbage after JSON string!" in strict mode Cyril Hrubis
2024-12-16 12:33   ` Petr Vorel
2024-12-03 15:15 ` [LTP] [PATCH 3/5] tst_run_shell: Better errors for metadata extractor Cyril Hrubis
2024-12-10 23:56   ` Petr Vorel
2024-12-03 15:15 ` [LTP] [PATCH 4/5] lib/tst_res_.c: Add TBROK handler + more verbose errors Cyril Hrubis
2024-12-11  0:11   ` Petr Vorel [this message]
2024-12-11  9:52     ` Cyril Hrubis
2024-12-11 19:36       ` Petr Vorel
2024-12-12  9:03         ` Cyril Hrubis
2024-12-03 15:15 ` [LTP] [PATCH 5/5] mem/vma05.sh: Convert to the new shell library Cyril Hrubis
2024-12-04  7:17   ` Andrea Cervesato via ltp
2024-12-04  7:17   ` Andrea Cervesato via ltp
2024-12-04  7:56     ` Cyril Hrubis
2024-12-10 23:34   ` Petr Vorel
2024-12-16 17:16     ` Cyril Hrubis
2024-12-10 23:54   ` Petr Vorel
2024-12-11  9:45 ` [LTP] [PATCH 0/5] First new shell library converted test Andrea Cervesato via ltp

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=20241211001106.GE386508@pevik \
    --to=pvorel@suse.cz \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox