| 1 |
# Copyright (C) 2020-2025 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation; either version 3 of the License, or |
| 6 |
# (at your option) any later version. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with GCC; see the file COPYING3. If not see |
| 15 |
# <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
# This harness is for tests that should be run at all optimisation levels. |
| 18 |
|
| 19 |
# Load support procs. |
| 20 |
load_lib gdc-dg.exp |
| 21 |
|
| 22 |
# Helper function allows adding tests that use imports/*, but don't compile |
| 23 |
# the sources in with dg-additional-sources. |
| 24 |
global testdir |
| 25 |
set testdir $srcdir/$subdir |
| 26 |
proc srcdir {} { |
| 27 |
global testdir |
| 28 |
return $testdir |
| 29 |
} |
| 30 |
|
| 31 |
# The default option list can be overridden by |
| 32 |
# TORTURE_OPTIONS="{ { list1 } ... { listN } }" |
| 33 |
|
| 34 |
if ![info exists TORTURE_OPTIONS] { |
| 35 |
set TORTURE_OPTIONS [list \ |
| 36 |
{ -O0 } { -O1 } { -O2 } { -O3 } { -Os } \ |
| 37 |
{ -O0 -frelease } { -O0 -g } { -O0 -frelease -g } \ |
| 38 |
{ -O1 -frelease } { -O1 -g } { -O1 -frelease -g } \ |
| 39 |
{ -O2 -frelease } { -O2 -g } { -O2 -frelease -g } \ |
| 40 |
{ -O3 -frelease } { -O3 -g } { -O3 -frelease -g } \ |
| 41 |
{ -Os -frelease } { -Os -g } { -Os -frelease -g }] |
| 42 |
} |
| 43 |
|
| 44 |
# Initialize `dg'. |
| 45 |
dg-init |
| 46 |
|
| 47 |
# Initialize use of torture lists. |
| 48 |
torture-init |
| 49 |
set-torture-options $TORTURE_OPTIONS |
| 50 |
|
| 51 |
# Main loop. |
| 52 |
gdc-dg-runtest [lsort \ |
| 53 |
[glob -nocomplain $srcdir/$subdir/*.d ] ] "" "" |
| 54 |
|
| 55 |
# Finalize use of torture lists. |
| 56 |
torture-finish |
| 57 |
|
| 58 |
# All done. |
| 59 |
dg-finish |