summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/params/params.exp
blob: b80f26354aba37cd7f9855ec61ba3c6b85bf7840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (C) 2016-2018 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

# GCC testsuite that uses the `dg.exp' driver.

# Load support procs.
load_lib gcc-dg.exp

# Initialize `dg'.
dg-init

proc param_run_test { param_name param_value } {
    global srcdir
    global subdir

    dg-runtest $srcdir/$subdir/blocksort-part.c "-O3 --param $param_name=$param_value" ""
}

set options_file "$objdir/../../params.options"
if { [info exists TESTING_IN_BUILD_TREE] == 0 } {
  return
}

set fd [open $options_file r]
set text [read $fd]
close $fd

# Main loop.
foreach params [split $text "\n"] {
    set parts [split $params "="]
    set name [string trim [lindex $parts 0] '"']
    set values [split [lindex $parts 1] ","]
    if { [llength $values] == 3 } {
	set default [lindex $values 0]
	set min [lindex $values 1]
	set max [lindex $values 2]
	set int_max "INT_MAX"

	if { $min != -1 } {
	    param_run_test $name $min
	}
	if { $max != $min && $max > 0 && $max != $int_max } {
	    param_run_test $name $max
	}
    }
    if { [llength $values] == 5 } {
	foreach v $values {
	    param_run_test $name $v
	}
    }
}

# All done.
dg-finish