1# Copyright (C) 2016-2018 Free Software Foundation, Inc.
2#
3# This file is part of GCC.
4#
5# GCC is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3, or (at your option)
8# any later version.
9#
10# GCC is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with GCC; see the file COPYING3.  If not see
17# <http://www.gnu.org/licenses/>.
18
19# GCC testsuite that uses the `dg.exp' driver.
20
21# Load support procs.
22load_lib gcc-dg.exp
23
24# Initialize `dg'.
25dg-init
26
27proc param_run_test { param_name param_value } {
28    global srcdir
29    global subdir
30
31    dg-runtest $srcdir/$subdir/blocksort-part.c "-O3 --param $param_name=$param_value" ""
32}
33
34set options_file "$objdir/../../params.options"
35if { [info exists TESTING_IN_BUILD_TREE] == 0 } {
36  return
37}
38
39set fd [open $options_file r]
40set text [read $fd]
41close $fd
42
43# Main loop.
44foreach params [split $text "\n"] {
45    set parts [split $params "="]
46    set name [string trim [lindex $parts 0] '"']
47    set values [split [lindex $parts 1] ","]
48    if { [llength $values] == 3 } {
49	set default [lindex $values 0]
50	set min [lindex $values 1]
51	set max [lindex $values 2]
52	set int_max "INT_MAX"
53
54	if { $min != -1 } {
55	    param_run_test $name $min
56	}
57	if { $max != $min && $max > 0 && $max != $int_max } {
58	    param_run_test $name $max
59	}
60    }
61    if { [llength $values] == 5 } {
62	foreach v $values {
63	    param_run_test $name $v
64	}
65    }
66}
67
68# All done.
69dg-finish
70