Welcome to mirror list, hosted at ThFree Co, Russian Federation.

passfail.exp « lib « testsuite « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0a01f4816cd9b29e5bea2874ab0e9605787ef9ad (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
# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
#
# Permission to use, copy, modify, and distribute this software
# is freely granted, provided that this notice is preserved.
#

# newlib_pass_fail_all compiles and runs all the source files in the
# test directory. If flag is -x, then the sources whose basenames are
# listed in exclude_list are not compiled and run.

proc newlib_pass_fail_all { flag exclude_list } {
    global srcdir objdir subdir runtests

    foreach fullsrcfile [glob -nocomplain $srcdir/$subdir/*.c] {
	set srcfile "[file tail $fullsrcfile]"
	# If we're only testing specific files and this isn't one of them, skip it.
	if ![runtest_file_p $runtests $srcfile] then {
	    continue
	}

	# Exclude tests listed in exclude_list.
	if { $flag == "-x" } then {
	    if {[lsearch $exclude_list "$srcfile"] != -1} then {
		continue
	    }
	}
	newlib_pass_fail "$srcfile"
    }
}

# newlib_pass_fail takes the basename of a test source file, which it
# compiles and runs.

proc newlib_pass_fail { srcfile } {
    global srcdir objdir subdir

    set fullsrcfile "$srcdir/$subdir/$srcfile"

    set test_driver "$objdir/testsuite/[file rootname $srcfile].x"

    set comp_output [newlib_target_compile "$fullsrcfile" "$test_driver" "executable" ""]

    if { $comp_output != "" } {
	fail "Failed to compile $fullsrcfile.\n"
	fail "$fullsrcfile"
    } else {
	pass "Compiled $fullsrcfile.\n"
	set result [newlib_load $test_driver ""]
	set status [lindex $result 0]
	$status "$fullsrcfile"
    }
}