All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Semihosting Tests PATCH 3/3] add SYS_GET_CMDLINE test
Date: Mon, 13 May 2024 13:36:04 +0100	[thread overview]
Message-ID: <87cypprirv.fsf@draig.linaro.org> (raw)
In-Reply-To: <20240513113513.640007-4-alex.bennee@linaro.org> ("Alex Bennée"'s message of "Mon, 13 May 2024 12:35:13 +0100")

Alex Bennée <alex.bennee@linaro.org> writes:

> We actually had the stubs to implement this. The main pain is getting
> the binary name into the program so we can validate the result.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  Makefile   | 22 +++++++++++-----------
>  usertest.c | 24 ++++++++++++++++++++++++
>  2 files changed, 35 insertions(+), 11 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 59fd831..f77665f 100644
> --- a/Makefile
> +++ b/Makefile
<snip>
> --- a/usertest.c
> +++ b/usertest.c
> @@ -315,6 +315,26 @@ static int test_feature_detect(void)
>      return 0;
>  }
>  
> +static int test_cmdline(void)
> +{
> +    char cmdline[256];
> +    int actual;
> +    const char *s, *c;
> +
> +    if (semi_get_cmdline(&cmdline[0], sizeof(cmdline), &actual)) {
> +        semi_write0("FAIL could recover command line\n");
> +        return 1;
> +    }
> +
> +    if (strcmp(&cmdline[0], BINARY_NAME) != 0) {
> +        semi_write0("FAIL unexpected command line:");
> +        semi_write0(&cmdline[0]);

oops need an error leg here.

> +    }
> +
> +    semi_write0("PASS command line test\n");
> +    return 0;
> +}
> +
>  int main(void)
>  {
>      void *bufp;
> @@ -366,6 +386,10 @@ int main(void)
>          return 1;
>      }
>  
> +    if (test_cmdline()) {
> +        return 1;
> +    }
> +
>      semi_write0("ALL TESTS PASSED\n");
>  
>      /* If we have EXIT_EXTENDED then use it */

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2024-05-13 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 11:35 [Semihosting Tests PATCH 0/3] add SYS_GET_CMDLINE test Alex Bennée
2024-05-13 11:35 ` [Semihosting Tests PATCH 1/3] .editorconfig: add code conventions for tooling Alex Bennée
2024-05-20 15:06   ` Peter Maydell
2024-05-13 11:35 ` [Semihosting Tests PATCH 2/3] update includes for bare metal compiling Alex Bennée
2024-05-20 15:07   ` Peter Maydell
2024-05-13 11:35 ` [Semihosting Tests PATCH 3/3] add SYS_GET_CMDLINE test Alex Bennée
2024-05-13 12:36   ` Alex Bennée [this message]
2024-05-20 15:17   ` Peter Maydell

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=87cypprirv.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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.