mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Marc Reilly <marc@cpdesign.com.au>
Cc: barebox <barebox@lists.infradead.org>
Subject: Re: [PATCH] commands: mtest: add iteration count parameter for mtest command
Date: Sat, 12 Jan 2013 10:06:26 +0100	[thread overview]
Message-ID: <CAB_54W4qZX0P6NcSgJmhvR-DJaqmcL4rxJ=zveAVzUkzKetXxw@mail.gmail.com> (raw)
In-Reply-To: <1357976708-9010-1-git-send-email-marc@cpdesign.com.au>


[-- Attachment #1.1: Type: text/plain, Size: 4074 bytes --]

Hi,

I actually work on a patch series to improve|rewrite the memtest command.
This will add a iteration argument, too.

I will try to find some time this weekend to make it done.

Regards
Alexander Aring

2013/1/12 Marc Reilly <marc@cpdesign.com.au>

> The number of test iterations can be specified so that the test
> does not continue forever without manual intervention.
>
> This enables better use of mtest via scripts.
>
> Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
> ---
>  commands/memtest.c |   30 +++++++++++++++++++-----------
>  1 files changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/commands/memtest.c b/commands/memtest.c
> index 651a195..f3fe5e5 100644
> --- a/commands/memtest.c
> +++ b/commands/memtest.c
> @@ -34,7 +34,7 @@
>   * sub-tests.
>   */
>  #ifdef CONFIG_CMD_MTEST_ALTERNATIVE
> -static int mem_test(ulong _start, ulong _end, ulong pattern_unused)
> +static int mem_test(ulong _start, ulong _end, ulong pattern_unused, ulong
> iter_count)
>  {
>         vu_long *start = (vu_long *)_start;
>         vu_long *end   = (vu_long *)_end;
> @@ -68,13 +68,17 @@ static int mem_test(ulong _start, ulong _end, ulong
> pattern_unused)
>         };
>
>         /* XXX: enforce alignment of start and end? */
> -       for (;;) {
> +       while (!iter_count || (iterations <= iter_count)) {
>                 if (ctrlc()) {
>                         putchar ('\n');
>                         return 1;
>                 }
>
> -               printf("Iteration: %6d\r", iterations);
> +               printf("Iteration: %6d", iterations);
> +               if (iter_count)
> +                       printf(" of %6lu", iter_count);
> +               printf("\r");
> +
>                 iterations++;
>
>                 /*
> @@ -262,9 +266,10 @@ static int mem_test(ulong _start, ulong _end, ulong
> pattern_unused)
>                 }
>         }
>
> +       return 0;
>  }
>  #else
> -static int mem_test(ulong _start, ulong _end, ulong pattern)
> +static int mem_test(ulong _start, ulong _end, ulong pattern, ulong
> iter_count)
>  {
>         vu_long *addr;
>         vu_long *start = (vu_long *)_start;
> @@ -273,9 +278,10 @@ static int mem_test(ulong _start, ulong _end, ulong
> pattern)
>         ulong   readback;
>         ulong   incr;
>         int rcode;
> +       int iterations = 1;
>
>         incr = 1;
> -       for (;;) {
> +       while (!iter_count || (iterations <= iter_count)) {
>                 if (ctrlc()) {
>                         putchar('\n');
>                         return 1;
> @@ -317,6 +323,8 @@ static int mem_test(ulong _start, ulong _end, ulong
> pattern)
>                         pattern = ~pattern;
>                 }
>                 incr = -incr;
> +
> +               ++iterations;
>         }
>         return rcode;
>  }
> @@ -324,7 +332,7 @@ static int mem_test(ulong _start, ulong _end, ulong
> pattern)
>
>  static int do_mem_mtest(int argc, char *argv[])
>  {
> -       ulong start, end, pattern = 0;
> +       ulong start, end, pattern = 0, iterations = 0;
>
>         if (argc < 3)
>                 return COMMAND_ERROR_USAGE;
> @@ -335,16 +343,16 @@ static int do_mem_mtest(int argc, char *argv[])
>         if (argc > 3)
>                 pattern = simple_strtoul(argv[3], NULL, 0);
>
> +       if (argc > 4)
> +               iterations = simple_strtoul(argv[4], NULL, 0);
> +
>         printf ("Testing 0x%08x ... 0x%08x:\n", (uint)start, (uint)end);
>
> -       return mem_test(start, end, pattern);
> +       return mem_test(start, end, pattern, iterations);
>  }
>
>  static const __maybe_unused char cmd_mtest_help[] =
> -"Usage: <start> <end> "
> -#ifdef CONFIG_CMD_MTEST_ALTERNATIVE
> -"[pattern]"
> -#endif
> +"Usage: <start> <end> [pattern] [iterations]"
>

What's with [pattern]?
It's only available in MTEST_ALTERNATIVE.


>  "\nsimple RAM read/write test\n";
>
>  BAREBOX_CMD_START(mtest)
> --
> 1.7.7
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>

[-- Attachment #1.2: Type: text/html, Size: 5584 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-01-12  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12  7:45 Marc Reilly
2013-01-12  9:06 ` Alexander Aring [this message]

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='CAB_54W4qZX0P6NcSgJmhvR-DJaqmcL4rxJ=zveAVzUkzKetXxw@mail.gmail.com' \
    --to=alex.aring@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=marc@cpdesign.com.au \
    /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