1# Copyright (C) 2021-2022 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
17load_lib libphobos-dg.exp
18
19set dg-output-text [list]
20
21# Arguments to pass to the compiler, expected output, and return code.
22set unit_test_list [list \
23    { "-fversion=PassNoPrintout"  0 } \
24    { "-fversion=GoodTests" 0 } \
25    { "-fversion=FailNoPrintout" 1 } \
26    { "-fversion=FailedTests" 1 } \
27    { "-fversion=NoTests" 0 } \
28]
29
30# Initialize dg.
31dg-init
32
33# Gather a list of all tests.
34set tests [lsort [find $srcdir/$subdir *.d]]
35
36# Main loop.
37foreach unit_test $unit_test_list {
38    # The version flags to build the program with.
39    set test_flags [lindex $unit_test 0]
40
41    # Whether the program is expected to fail.
42    set expected_fail [lindex $unit_test 1]
43
44    foreach test $tests {
45        set shouldfail $expected_fail
46        dg-test $test "" $test_flags
47    }
48
49    set shouldfail 0
50}
51
52# All done.
53dg-finish
54