| 1 |
# Copyright (C) 2017-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 |
load_lib libphobos-dg.exp |
| 18 |
|
| 19 |
set dg-output-text [list] |
| 20 |
|
| 21 |
# Arguments to pass to the test program, expected output, and return code. |
| 22 |
set cycle_test_list [list \ |
| 23 |
{ ignore "" 0 } \ |
| 24 |
{ abort "object.Error@.*: Cyclic dependency between module mod. and mod." 1 } \ |
| 25 |
{ print "Cyclic dependency between module mod. and mod." 0 } \ |
| 26 |
{ deprecate "deprecate is no longer supported, using abort instead" 1 } \ |
| 27 |
] |
| 28 |
|
| 29 |
# Initialize dg. |
| 30 |
dg-init |
| 31 |
|
| 32 |
# Gather a list of all tests. |
| 33 |
set tests [lsort [find $srcdir/$subdir *.d]] |
| 34 |
|
| 35 |
# Main loop. |
| 36 |
foreach cycle_test $cycle_test_list { |
| 37 |
# The set the argument to pass to the program. |
| 38 |
set libphobos_run_args "--DRT-oncycle=[lindex $cycle_test 0]" |
| 39 |
|
| 40 |
# Whether the program is expected to fail. |
| 41 |
set expected_fail [lindex $cycle_test 2] |
| 42 |
|
| 43 |
foreach test $tests { |
| 44 |
set libphobos_test_name "[dg-trim-dirname $srcdir $test] $libphobos_run_args" |
| 45 |
set shouldfail $expected_fail |
| 46 |
dg-runtest $test "" $DEFAULT_DFLAGS |
| 47 |
set libphobos_test_name "" |
| 48 |
} |
| 49 |
|
| 50 |
set shouldfail 0 |
| 51 |
set libphobos_run_args "" |
| 52 |
} |
| 53 |
|
| 54 |
# All done. |
| 55 |
dg-finish |