Ignore:
Timestamp:
Jul 9, 2013, 5:51:43 PM (7 years ago)
Author:
marius@…
Message:

Added makefile and fixed tcl path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc13-tests/tests/test.tcl

    r107883 r107933  
    2222set arguments ""
    2323set test_name ""
     24set color_out ""
     25set tcl ""
     26set err ""
     27
     28# Get tclsh path.
     29set autoconf ../Mk/macports.autoconf.mk
     30set fp [open $autoconf r]
     31while {[gets $fp line] != -1} {
     32    if {[string match "TCLSH*" $line] != 0} {
     33        set tcl [lrange [split $line " "] 1 1]
     34    }
     35}
    2436
    2537proc print_help {arg} {
     
    3345        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
    3446        puts "  -t TEST    : run a specific test"
     47        puts "  -nocolor   : disable color output (for automatic testing)"
    3548        puts "  -l         : print the list of available tests"
    3649        puts "  -h, -help  : print this message\n"
     
    6881        print_help tests
    6982        exit 0
     83    } elseif { $arg == "-nocolor" } {
     84        set color_out "no"
    7085    }
    7186}
     
    7691    cd test/$test_name
    7792
    78     set result [eval exec tclsh test.tcl $arguments]
     93    set result [eval exec $tcl test.tcl $arguments]
    7994    puts $result
    8095
     
    8398        cd test/$test
    8499   
    85         set result [eval exec tclsh test.tcl $arguments]
     100        set result [eval exec $tcl test.tcl $arguments]
    86101        set total [lrange [split $result "\t"] 2 2]
    87102        set pass [lrange [split $result "\t"] 4 4]
    88         set fail [lrange [split $result "\t"] 8 8]
     103        set skip [lrange [split $result "\t"] 6 6]
     104        set fail [lrange [split $result "\t\n"] 8 8]
     105
     106        # Check for errors.
     107        if { $fail != 0 || $skip != 0 } {
     108            set err "yes"
     109        }
    89110
    90111        set out ""
    91         if { $fail != 0 } {
     112        if { ($fail != 0 || $skip != 0) && $color_out == "" } {
    92113            # Color failed tests.
    93             append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " \x1b\[0m" $test
     114            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " \x1b\[0m" $test
    94115        } else {
    95             append out "Total:" $total " Passed:" $pass " Failed:" $fail " " $test
     116            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " " $test
    96117        }
    97118        puts $out
     
    100121    }
    101122}
     123
     124# Set return value
     125if {$err != ""} {
     126    return 1
     127} else {
     128    return 0
     129}
Note: See TracChangeset for help on using the changeset viewer.