Debian Codegraph @

libphobos/testsuite/libphobos.unittest/unittest.exp

raw
1 # Copyright (C) 2021-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 compiler, expected output, and return code.
22 set 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.
31 dg-init
32
33 # Gather a list of all tests.
34 set tests [lsort [find $srcdir/$subdir *.d]]
35
36 # Main loop.
37 foreach 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 libphobos_test_name "[dg-trim-dirname $srcdir $test] $test_flags"
46 set shouldfail $expected_fail
47 dg-runtest $test "" $test_flags
48 set libphobos_test_name ""
49 }
50
51 set shouldfail 0
52 }
53
54 # All done.
55 dg-finish