[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] testsuite: Enable selection of tests using env var TESTS
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH v2] testsuite: Enable selection of tests using env var TESTS |
Date: |
Fri, 14 Jan 2022 11:04:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> This patch enables user to choose specific tests to run. Test harness
> selects tests based on pattern of TESTS environment variable.
>
> 2022-01-14 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * testsuite/lib/poke.exp (tests_pattern): New variable.
> (tests_pattern_pk): Likewise.
> * testsuite/poke.cmd/cmd.exp: Use `tests_pattern`.
> * testsuite/poke.map/map.exp: Likewise.
> * testsuite/poke.pickles/pickles.exp: Likewise.
> * testsuite/poke.pkl/pkl.exp: Likewise.
> * testsuite/poke.pktest/pktest.exp: Likewise.
> * testsuite/poke.std/std.exp: Likewise.
> * testsuite/poke.time/time.exp: Likewise.
> * etc/hacking.org (Run selected tests): New section.
> ---
>
> Hi, Jose.
>
> I've added the documentation.
> Interestingly, we didn't document `RUNTESTFLAGS` before!
OK for master.
Thanks!
>
>
> Regards,
> Mohammad-Reza
>
>
>
> ChangeLog | 13 +++++++++++++
> etc/hacking.org | 12 ++++++++++++
> testsuite/lib/poke.exp | 9 +++++++++
> testsuite/poke.cmd/cmd.exp | 2 +-
> testsuite/poke.map/map.exp | 2 +-
> testsuite/poke.pickles/pickles.exp | 2 +-
> testsuite/poke.pkl/pkl.exp | 2 +-
> testsuite/poke.pktest/pktest.exp | 2 +-
> testsuite/poke.std/std.exp | 2 +-
> testsuite/poke.time/time.exp | 2 +-
> 10 files changed, 41 insertions(+), 7 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 14bbc43a..77d38bd4 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,16 @@
> +2022-01-14 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
> +
> + * testsuite/lib/poke.exp (tests_pattern): New variable.
> + (tests_pattern_pk): Likewise.
> + * testsuite/poke.cmd/cmd.exp: Use `tests_pattern`.
> + * testsuite/poke.map/map.exp: Likewise.
> + * testsuite/poke.pickles/pickles.exp: Likewise.
> + * testsuite/poke.pkl/pkl.exp: Likewise.
> + * testsuite/poke.pktest/pktest.exp: Likewise.
> + * testsuite/poke.std/std.exp: Likewise.
> + * testsuite/poke.time/time.exp: Likewise.
> + * etc/hacking.org (Run selected tests): New section.
> +
> 2022-01-14 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * libpoke/ios-dev.h (struct ios_dev_if): Move comments to
> diff --git a/etc/hacking.org b/etc/hacking.org
> index af484d15..88fcf306 100644
> --- a/etc/hacking.org
> +++ b/etc/hacking.org
> @@ -472,6 +472,18 @@ Indu Bhagat <indu.bhagat@oracle.com>
> https://gcc.gnu.org/onlinedocs/gccint/Directives.html
> https://gcc.gnu.org/wiki/HowToPrepareATestcase
>
> +** Run selected tests
> +
> + Tests are categorized in different sub-directories. You can run
> + run tests of a signle category by runing
> + : make check RUNTESTFLAGS=CATEGORY.exp
> + For example, to run tests of =pkl= in =poke.pkl= sub-directory, run:
> + : make check RUNTESTFLAGS=pkl.exp
> + You can also select tests using =TESTS= environment variable.
> + As an example, to run all test files which start with =array=, you
> + can run:
> + : make check TESTS=array*.pk
> +
> ** Unit Tests
>
> We are using DejaGnu's support for unit tests. See
> diff --git a/testsuite/lib/poke.exp b/testsuite/lib/poke.exp
> index ce7a2425..c911ac9d 100644
> --- a/testsuite/lib/poke.exp
> +++ b/testsuite/lib/poke.exp
> @@ -35,6 +35,15 @@ if ![info exists POKE] {
> set POKE ${objdir}/../poke/poke
> }
>
> +# Pattern for selection of tests.
> +
> +set tests_pattern {*.pk}
> +set tests_pattern_pk {*-test.pk}
> +if [info exists env(TESTS)] {
> + set tests_pattern $env(TESTS)
> + set tests_pattern_pk $env(TESTS)
> +}
> +
> # prompt is the poke prompt to expect from the program. As this can
> # change we can put it in a variable that can be easily modified later.
>
> diff --git a/testsuite/poke.cmd/cmd.exp b/testsuite/poke.cmd/cmd.exp
> index f160e69c..8a08b9d9 100644
> --- a/testsuite/poke.cmd/cmd.exp
> +++ b/testsuite/poke.cmd/cmd.exp
> @@ -18,5 +18,5 @@
>
> load_lib ${tool}-dg.exp
> dg-init
> -dg-runtest [lsort [glob -nocomplain $srcdir/poke.cmd/*.pk]] {} {}
> +dg-runtest [lsort [glob -nocomplain $srcdir/poke.cmd/$tests_pattern]] {} {}
> dg-finish
> diff --git a/testsuite/poke.map/map.exp b/testsuite/poke.map/map.exp
> index f9104f1a..6b300831 100644
> --- a/testsuite/poke.map/map.exp
> +++ b/testsuite/poke.map/map.exp
> @@ -18,5 +18,5 @@
>
> load_lib ${tool}-dg.exp
> dg-init
> -dg-runtest [lsort [glob -nocomplain $srcdir/poke.map/*.pk]] {} {}
> +dg-runtest [lsort [glob -nocomplain $srcdir/poke.map/$tests_pattern]] {} {}
> dg-finish
> diff --git a/testsuite/poke.pickles/pickles.exp
> b/testsuite/poke.pickles/pickles.exp
> index b0d70a58..902fdd20 100644
> --- a/testsuite/poke.pickles/pickles.exp
> +++ b/testsuite/poke.pickles/pickles.exp
> @@ -18,4 +18,4 @@
>
> load_lib "poke-pk.exp"
>
> -pk-runtest [lsort [glob -nocomplain $srcdir/poke.pickles/*-test.pk]]
> +pk-runtest [lsort [glob -nocomplain $srcdir/poke.pickles/$tests_pattern_pk]]
> diff --git a/testsuite/poke.pkl/pkl.exp b/testsuite/poke.pkl/pkl.exp
> index c4a7fbf4..9954c20f 100644
> --- a/testsuite/poke.pkl/pkl.exp
> +++ b/testsuite/poke.pkl/pkl.exp
> @@ -18,5 +18,5 @@
>
> load_lib ${tool}-dg.exp
> dg-init
> -dg-runtest [lsort [glob -nocomplain $srcdir/poke.pkl/*.pk]] {} {}
> +dg-runtest [lsort [glob -nocomplain $srcdir/poke.pkl/$tests_pattern]] {} {}
> dg-finish
> diff --git a/testsuite/poke.pktest/pktest.exp
> b/testsuite/poke.pktest/pktest.exp
> index da27b095..c6c3e7e3 100644
> --- a/testsuite/poke.pktest/pktest.exp
> +++ b/testsuite/poke.pktest/pktest.exp
> @@ -18,5 +18,5 @@
>
> load_lib ${tool}-dg.exp
> dg-init
> -dg-runtest [lsort [glob -nocomplain $srcdir/poke.pktest/*.pk]] {} {}
> +dg-runtest [lsort [glob -nocomplain $srcdir/poke.pktest/$tests_pattern]] {}
> {}
> dg-finish
> diff --git a/testsuite/poke.std/std.exp b/testsuite/poke.std/std.exp
> index ba0aae37..f26ad0b8 100644
> --- a/testsuite/poke.std/std.exp
> +++ b/testsuite/poke.std/std.exp
> @@ -18,4 +18,4 @@
>
> load_lib "poke-pk.exp"
>
> -pk-runtest [lsort [glob -nocomplain $srcdir/poke.std/*-test.pk]]
> +pk-runtest [lsort [glob -nocomplain $srcdir/poke.std/$tests_pattern_pk]]
> diff --git a/testsuite/poke.time/time.exp b/testsuite/poke.time/time.exp
> index e895f1bf..eb7b5b70 100644
> --- a/testsuite/poke.time/time.exp
> +++ b/testsuite/poke.time/time.exp
> @@ -18,5 +18,5 @@
>
> load_lib ${tool}-dg.exp
> dg-init
> -dg-runtest [lsort [glob -nocomplain $srcdir/poke.time/*.pk]] {} {}
> +dg-runtest [lsort [glob -nocomplain $srcdir/poke.time/$tests_pattern]] {} {}
> dg-finish