public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 2/4] Add support for mixing C and shell code
Date: Fri, 6 Sep 2024 11:53:13 +0200	[thread overview]
Message-ID: <ZtrRCVxNKuu5ZdHN@yuki.lan> (raw)
In-Reply-To: <CAEemH2eQQfhTfVo5xrBHFjzuf4dn=VqK2M=9Y3+hy+r8yzMtAA@mail.gmail.com>

Hi!
> tst_test.c:1860: TINFO: LTP version: 20240524
> tst_test.c:1864: TINFO: Tested kernel: 6.8.0-1010-raspi #11-Ubuntu SMP
> PREEMPT_DYNAMIC Thu Aug  8 23:22:41 UTC 2024 aarch64
> tst_test.c:1703: TINFO: Timeout per run is 0h 00m 30s
> shell_test01.c:11: TINFO: C test exits now
> Usage: tst_res_ filename lineno [TPASS|TFAIL|TCONF|TINFO|TDEBUG] 'A short
> description'
> tst_test.c:1535: TBROK: Test haven't reported results!
> 
> Summary:
> passed   0
> failed   0
> broken   1
> skipped  0
> warnings 0
> 
> 
> Here I got test failures on my RPi4 (bash-5.2.21) that the $LINEON can't
> be parsed correctly.

Are you sure that this is due to bash? My guess is that on RPi the
default shell is dash because it's debian based.

I will try to reproduce.

> The reason probably is some shells or specific versions might not handle
> $LINENO correctly within aliases, especially when the line number needs
> to be dynamically determined.
> 
> So I suggest using a function instead of the alias.
> 
> 
> --- a/testcases/lib/tst_env.sh
> +++ b/testcases/lib/tst_env.sh
> @@ -21,5 +21,12 @@ tst_brk_()
>         esac
>  }
> 
> -alias tst_res="tst_res_ $tst_script_name \$LINENO"
> -alias tst_brk="tst_brk_ $tst_script_name \$LINENO"
> +tst_res()
> +{
> +    tst_res_ "$tst_script_name" "$LINENO" "$@"
> +}
> +
> +tst_brk()
> +{
> +    tst_brk_ "$tst_script_name" "$LINENO" "$@"
> +}

That actually does not work because unlike the alias the $LINENO is
expanded in the wrong place and the line is incorrect.

The whole reason for this to be alias is that it's expanded on the
correct line in the test source.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2024-09-06  9:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 12:02 [LTP] [PATCH v3 0/4] Shell test library v3 Cyril Hrubis
2024-08-27 12:02 ` [LTP] [PATCH v3 1/4] include: tst_clone.h: Fix possible MUSL build failures Cyril Hrubis
2024-09-03  7:46   ` Petr Vorel
2024-09-03  8:02     ` Cyril Hrubis
2024-08-27 12:02 ` [LTP] [PATCH v3 2/4] Add support for mixing C and shell code Cyril Hrubis
2024-08-30 12:40   ` Andrea Cervesato via ltp
2024-09-03  7:29   ` Li Wang
2024-09-03  8:24   ` Petr Vorel
2024-09-16  9:52     ` Cyril Hrubis
2024-09-06  7:34   ` Li Wang
2024-09-06  9:53     ` Cyril Hrubis [this message]
2024-09-06 10:03       ` Cyril Hrubis
2024-09-06 10:09       ` Li Wang
2024-09-06 11:22         ` Cyril Hrubis
2024-09-06 13:28           ` Cyril Hrubis
2024-09-07  1:29             ` Li Wang
2024-09-06 10:19       ` Li Wang
2024-09-06 11:06         ` Li Wang
2024-08-27 12:02 ` [LTP] [PATCH v3 3/4] libs: Vendor ujson library Cyril Hrubis
2024-08-30 12:41   ` Andrea Cervesato via ltp
2024-09-16  9:58     ` Cyril Hrubis
2024-08-27 12:02 ` [LTP] [PATCH v3 4/4] testcaes/lib: Add shell loader Cyril Hrubis
2024-08-30 12:47   ` Andrea Cervesato via ltp
2024-09-16 10:04     ` Cyril Hrubis
2024-08-30 12:50   ` Andrea Cervesato via ltp
2024-09-16 10:02     ` Cyril Hrubis
2024-09-09  9:03   ` Li Wang
2024-09-16 10:08 ` [LTP] [PATCH v3 0/4] Shell test library v3 Cyril Hrubis

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=ZtrRCVxNKuu5ZdHN@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=liwang@redhat.com \
    --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