view gcc/testsuite/gcc.dg/params/params.exp @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line source

# 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