diff mbox series

testsuite: Unset torture_current_flags after use

Message ID mptbk02borb.fsf@arm.com
State New
Headers show
Series testsuite: Unset torture_current_flags after use | expand

Commit Message

Richard Sandiford Oct. 2, 2024, 1:47 p.m. UTC
Before running a test with specific torture options, gcc-dg-runtest
sets the global variable torture_current_flags to the set of torture
options that will be used.  However, it never unset the variable
afterwards, which meant that the last options would hang around
and potentially confuse later non-torture tests.

I saw this with a follow-on patch to check-function-bodies, but it's
probably possible to construct aritificial test combinations that
expose it with check-function-bodies's existing flag filtering.

Tested on aarch64-linux-gnu.  OK to install?

Richard


gcc/testsuite/
	* gcc/testsuite/lib/gcc-dg.exp (gcc-dg-runtest): Unset
	torture_current_flags after each test.
---
 gcc/testsuite/lib/gcc-dg.exp | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Biener Oct. 2, 2024, 3:07 p.m. UTC | #1
> Am 02.10.2024 um 15:48 schrieb Richard Sandiford <richard.sandiford@arm.com>:
> 
> Before running a test with specific torture options, gcc-dg-runtest
> sets the global variable torture_current_flags to the set of torture
> options that will be used.  However, it never unset the variable
> afterwards, which meant that the last options would hang around
> and potentially confuse later non-torture tests.
> 
> I saw this with a follow-on patch to check-function-bodies, but it's
> probably possible to construct aritificial test combinations that
> expose it with check-function-bodies's existing flag filtering.
> 
> Tested on aarch64-linux-gnu.  OK to install?

Ok

Richard 

> Richard
> 
> 
> gcc/testsuite/
>    * gcc/testsuite/lib/gcc-dg.exp (gcc-dg-runtest): Unset
>    torture_current_flags after each test.
> ---
> gcc/testsuite/lib/gcc-dg.exp | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
> index cb401a70435..7adca02f937 100644
> --- a/gcc/testsuite/lib/gcc-dg.exp
> +++ b/gcc/testsuite/lib/gcc-dg.exp
> @@ -628,6 +628,7 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } {
>        set torture_current_flags "$flags_t"
>        verbose "Testing $nshort, $flags $flags_t" 1
>        dg-test $test "$flags $flags_t" ${default-extra-flags}
> +        unset torture_current_flags
>    }
>     }
> 
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index cb401a70435..7adca02f937 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -628,6 +628,7 @@  proc gcc-dg-runtest { testcases flags default-extra-flags } {
 	    set torture_current_flags "$flags_t"
 	    verbose "Testing $nshort, $flags $flags_t" 1
 	    dg-test $test "$flags $flags_t" ${default-extra-flags}
+	    unset torture_current_flags
 	}
     }