[141366] trunk/base/src

raimue at macports.org raimue at macports.org
Sat Dec 12 01:13:41 PST 2015


Revision: 141366
          https://trac.macports.org/changeset/141366
Author:   raimue at macports.org
Date:     2015-10-16 07:05:11 -0700 (Fri, 16 Oct 2015)
Log Message:
-----------
Unify test.tcl files into a single script at src/tests/test.tcl

Modified Paths:
--------------
    trunk/base/src/macports1.0/Makefile.in
    trunk/base/src/package1.0/Makefile.in
    trunk/base/src/port1.0/Makefile.in

Added Paths:
-----------
    trunk/base/src/tests/
    trunk/base/src/tests/test.tcl

Removed Paths:
-------------
    trunk/base/src/macports1.0/tests/test.tcl
    trunk/base/src/package1.0/tests/test.tcl
    trunk/base/src/port1.0/tests/test.tcl

Modified: trunk/base/src/macports1.0/Makefile.in
===================================================================
--- trunk/base/src/macports1.0/Makefile.in	2015-10-16 13:40:35 UTC (rev 141365)
+++ trunk/base/src/macports1.0/Makefile.in	2015-10-16 14:05:11 UTC (rev 141366)
@@ -18,7 +18,7 @@
 pkgIndex.tcl: $(SRCS)
 
 test::
-	$(TCLSH) $(srcdir)/tests/test.tcl -nocolor
+	$(TCLSH) $(srcdir)/../tests/test.tcl -nocolor
 
 distclean:: clean
 	rm -f macports_autoconf.tcl macports_test_autoconf.tcl ${SHLIB_NAME}

Deleted: trunk/base/src/macports1.0/tests/test.tcl
===================================================================
--- trunk/base/src/macports1.0/tests/test.tcl	2015-10-16 13:40:35 UTC (rev 141365)
+++ trunk/base/src/macports1.0/tests/test.tcl	2015-10-16 14:05:11 UTC (rev 141366)
@@ -1,147 +0,0 @@
-# Global vars
-set arguments {}
-set test_name ""
-set color_out ""
-set tcl ""
-set err ""
-
-# Get tclsh path.
-set autoconf ../../Mk/macports.autoconf.mk
-set fp [open $autoconf r]
-while {[gets $fp line] != -1} {
-    if {[string match "TCLSH*" $line] != 0} {
-        set tcl [lrange [split $line " "] 1 1]
-    }
-}
-
-proc print_help {arg} {
-    if {$arg eq "tests"} {
-        puts "The list of available tests is:"
-        cd tests
-        set test_suite [glob *.test]
-        foreach test $test_suite {
-            puts [puts -nonewline "  "]$test
-        }
-    } else {
-        puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
-        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
-        puts "  -t TEST    : run a specific test"
-        puts "  -nocolor   : disable color output (for automatic testing)"
-        puts "  -l         : print the list of available tests"
-        puts "  -h, -help  : print this message\n"
-    }
-}
-
-# Process args
-foreach arg $argv {
-    if {$arg eq "-h" || $arg eq "-help"} {
-        print_help ""
-        exit 0
-    } elseif {$arg eq "-debug"} {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set level [lindex $argv $index]
-        if {$level >= 0 && $level <= 3} {
-            lappend arguments "-debug" $level
-        } else {
-            puts "Invalid debug level."
-            exit 1
-        }
-    } elseif {$arg eq "-t"} {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set test_name [lindex $argv $index]
-        set no 0
-        cd tests
-        set test_suite [glob *.test]
-        foreach test $test_suite {
-            if {$test_name ne $test} {
-                incr no
-            }
-        }
-        if {$no == [llength $test_suite]} {
-            print_help tests
-            exit 1
-        }
-    } elseif {$arg eq "-l"} {
-        print_help tests
-        exit 0
-    } elseif {$arg eq "-nocolor"} {
-        set color_out "no"
-    }
-}
-
-
-# Run tests
-if {$test_name ne ""} {
-    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
-    puts $result
-} else {
-    cd tests
-    set test_suite [glob *.test]
-
-    foreach test $test_suite {
-        set result [exec -ignorestderr $tcl $test {*}$arguments]
-        set lastline [lindex [split $result "\n"] end]
-
-        if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
-                set lastline [lindex [split $result "\n"] 0]
-                set errmsg [lindex [split $result "\n"] 2]
-            } else {
-                set lastline [lindex [split $result "\n"] end-2]
-                set errmsg [lindex [split $result "\n"] end]
-            }
-        }
-
-        set splitresult [split $lastline "\t"]
-        set total [lindex $splitresult 2]
-        set pass [lindex $splitresult 4]
-        set skip [lindex $splitresult 6]
-        set fail [lindex $splitresult 8]
-
-        # Format output
-        if {$total < 10} {
-            set total "0${total}"
-        }
-        if {$pass < 10} {
-            set pass "0${pass}"
-        }
-        if {$skip < 10} {
-            set skip "0${skip}"
-        }
-        if {$fail < 10} {
-            set fail "0${fail}"
-        }
-
-        # Check for errors.
-        if {$fail != 0} {
-            set err "yes"
-        }
-
-        set out ""
-        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
-            # Color failed tests.
-            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
-        } else {
-            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  " $test
-        }
-
-        # Print results and constrints for auto-skipped tests.
-        puts $out
-        if {$skip != 0} {
-            set out "    Constraint: "
-            append out [string trim $errmsg "\t {}"]
-            puts $out
-        }
-        if {$fail != 0} {
-            set end [expr {[string first $test $result 0] - 1}]
-            puts [string range $result 0 $end]
-        }
-    }
-}
-
-# Return 1 if errors were found.
-if {$err ne ""} {
-    exit 1
-}
-
-return 0

Modified: trunk/base/src/package1.0/Makefile.in
===================================================================
--- trunk/base/src/package1.0/Makefile.in	2015-10-16 13:40:35 UTC (rev 141365)
+++ trunk/base/src/package1.0/Makefile.in	2015-10-16 14:05:11 UTC (rev 141366)
@@ -23,7 +23,7 @@
 
 test::
 	-$(prefix)/bin/port sync
-	$(TCLSH) $(srcdir)/tests/test.tcl -nocolor
+	$(TCLSH) $(srcdir)/../tests/test.tcl -nocolor
 
 install:: all
 	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"

Deleted: trunk/base/src/package1.0/tests/test.tcl
===================================================================
--- trunk/base/src/package1.0/tests/test.tcl	2015-10-16 13:40:35 UTC (rev 141365)
+++ trunk/base/src/package1.0/tests/test.tcl	2015-10-16 14:05:11 UTC (rev 141366)
@@ -1,147 +0,0 @@
-# Global vars
-set arguments {}
-set test_name ""
-set color_out ""
-set tcl ""
-set err ""
-
-# Get tclsh path.
-set autoconf ../../Mk/macports.autoconf.mk
-set fp [open $autoconf r]
-while {[gets $fp line] != -1} {
-    if {[string match "TCLSH*" $line] != 0} {
-        set tcl [lrange [split $line " "] 1 1]
-    }
-}
-
-proc print_help {arg} {
-    if {$arg eq "tests"} {
-        puts "The list of available tests is:"
-        cd tests
-        set test_suite [glob *.test]
-        foreach test $test_suite {
-            puts [puts -nonewline "  "]$test
-        }
-    } else {
-        puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
-        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
-        puts "  -t TEST    : run a specific test"
-        puts "  -nocolor   : disable color output (for automatic testing)"
-        puts "  -l         : print the list of available tests"
-        puts "  -h, -help  : print this message\n"
-    }
-}
-
-# Process args
-foreach arg $argv {
-    if {$arg eq "-h" || $arg eq "-help"} {
-        print_help ""
-        exit 0
-    } elseif {$arg eq "-debug"} {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set level [lindex $argv $index]
-        if {$level >= 0 && $level <= 3} {
-            lappend arguments "-debug" $level
-        } else {
-            puts "Invalid debug level."
-            exit 1
-        }
-    } elseif {$arg eq "-t"} {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set test_name [lindex $argv $index]
-        set no 0
-        cd tests
-        set test_suite [glob *.test]
-        foreach test $test_suite {
-            if {$test_name ne $test} {
-                incr no
-            }
-        }
-        if {$no == [llength $test_suite]} {
-            print_help tests
-            exit 1
-        }
-    } elseif {$arg eq "-l"} {
-        print_help tests
-        exit 0
-    } elseif {$arg eq "-nocolor"} {
-        set color_out "no"
-    }
-}
-
-
-# Run tests
-if {$test_name ne ""} {
-    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
-    puts $result
-} else {
-    cd tests
-    set test_suite [glob *.test]
-
-    foreach test $test_suite {
-        set result [exec -ignorestderr $tcl $test {*}$arguments]
-        set lastline [lindex [split $result "\n"] end]
-
-        if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
-                set lastline [lindex [split $result "\n"] 0]
-                set errmsg [lindex [split $result "\n"] 2]
-            } else {
-                set lastline [lindex [split $result "\n"] end-2]
-                set errmsg [lindex [split $result "\n"] end]
-            }
-        }
-
-        set splitresult [split $lastline "\t"]
-        set total [lindex $splitresult 2]
-        set pass [lindex $splitresult 4]
-        set skip [lindex $splitresult 6]
-        set fail [lindex $splitresult 8]
-
-        # Format output
-        if {$total < 10} {
-            set total "0${total}"
-        }
-        if {$pass < 10} {
-            set pass "0${pass}"
-        }
-        if {$skip < 10} {
-            set skip "0${skip}"
-        }
-        if {$fail < 10} {
-            set fail "0${fail}"
-        }
-
-        # Check for errors.
-        if {$fail != 0} {
-            set err "yes"
-        }
-
-        set out ""
-        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
-            # Color failed tests.
-            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
-        } else {
-            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  " $test
-        }
-
-        # Print results and constrints for auto-skipped tests.
-        puts $out
-        if {$skip != 0} {
-            set out "    Constraint: "
-            append out [string trim $errmsg "\t {}"]
-            puts $out
-        }
-        if {$fail != 0} {
-            set end [expr {[string first $test $result 0] - 1}]
-            puts [string range $result 0 $end]
-        }
-    }
-}
-
-# Return 1 if errors were found.
-if {$err ne ""} {
-    exit 1
-}
-
-return 0

Modified: trunk/base/src/port1.0/Makefile.in
===================================================================
--- trunk/base/src/port1.0/Makefile.in	2015-10-16 13:40:35 UTC (rev 141365)
+++ trunk/base/src/port1.0/Makefile.in	2015-10-16 14:05:11 UTC (rev 141366)
@@ -41,4 +41,4 @@
 	$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${INSTALLDIR}"
 
 test::
-	$(TCLSH) $(srcdir)/tests/test.tcl -nocolor
+	$(TCLSH) $(srcdir)/../tests/test.tcl -nocolor

Deleted: trunk/base/src/port1.0/tests/test.tcl
===================================================================
--- trunk/base/src/port1.0/tests/test.tcl	2015-10-16 13:40:35 UTC (rev 141365)
+++ trunk/base/src/port1.0/tests/test.tcl	2015-10-16 14:05:11 UTC (rev 141366)
@@ -1,147 +0,0 @@
-# Global vars
-set arguments {}
-set test_name ""
-set color_out ""
-set tcl ""
-set err ""
-
-# Get tclsh path.
-set autoconf ../../Mk/macports.autoconf.mk
-set fp [open $autoconf r]
-while {[gets $fp line] != -1} {
-    if {[string match "TCLSH*" $line] != 0} {
-        set tcl [lrange [split $line " "] 1 1]
-    }
-}
-
-proc print_help {arg} {
-    if {$arg eq "tests"} {
-        puts "The list of available tests is:"
-        cd tests
-        set test_suite [glob *.test]
-        foreach test $test_suite {
-            puts [puts -nonewline "  "]$test
-        }
-    } else {
-        puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
-        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
-        puts "  -t TEST    : run a specific test"
-        puts "  -nocolor   : disable color output (for automatic testing)"
-        puts "  -l         : print the list of available tests"
-        puts "  -h, -help  : print this message\n"
-    }
-}
-
-# Process args
-foreach arg $argv {
-    if {$arg eq "-h" || $arg eq "-help"} {
-        print_help ""
-        exit 0
-    } elseif {$arg eq "-debug"} {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set level [lindex $argv $index]
-        if {$level >= 0 && $level <= 3} {
-            lappend arguments "-debug" $level
-        } else {
-            puts "Invalid debug level."
-            exit 1
-        }
-    } elseif {$arg eq "-t"} {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set test_name [lindex $argv $index]
-        set no 0
-        cd tests
-        set test_suite [glob *.test]
-        foreach test $test_suite {
-            if {$test_name ne $test} {
-                incr no
-            }
-        }
-        if {$no == [llength $test_suite]} {
-            print_help tests
-            exit 1
-        }
-    } elseif {$arg eq "-l"} {
-        print_help tests
-        exit 0
-    } elseif {$arg eq "-nocolor"} {
-        set color_out "no"
-    }
-}
-
-
-# Run tests
-if {$test_name ne ""} {
-    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
-    puts $result
-} else {
-    cd tests
-    set test_suite [glob *.test]
-
-    foreach test $test_suite {
-        set result [exec -ignorestderr $tcl $test {*}$arguments]
-        set lastline [lindex [split $result "\n"] end]
-
-        if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
-                set lastline [lindex [split $result "\n"] 0]
-                set errmsg [lindex [split $result "\n"] 2]
-            } else {
-                set lastline [lindex [split $result "\n"] end-2]
-                set errmsg [lindex [split $result "\n"] end]
-            }
-        }
-
-        set splitresult [split $lastline "\t"]
-        set total [lindex $splitresult 2]
-        set pass [lindex $splitresult 4]
-        set skip [lindex $splitresult 6]
-        set fail [lindex $splitresult 8]
-
-        # Format output
-        if {$total < 10} {
-            set total "0${total}"
-        }
-        if {$pass < 10} {
-            set pass "0${pass}"
-        }
-        if {$skip < 10} {
-            set skip "0${skip}"
-        }
-        if {$fail < 10} {
-            set fail "0${fail}"
-        }
-
-        # Check for errors.
-        if {$fail != 0} {
-            set err "yes"
-        }
-
-        set out ""
-        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
-            # Color failed tests.
-            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
-        } else {
-            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  " $test
-        }
-
-        # Print results and constrints for auto-skipped tests.
-        puts $out
-        if {$skip != 0} {
-            set out "    Constraint: "
-            append out [string trim $errmsg "\t {}"]
-            puts $out
-        }
-        if {$fail != 0} {
-            set end [expr {[string first $test $result 0] - 1}]
-            puts [string range $result 0 $end]
-        }
-    }
-}
-
-# Return 1 if errors were found.
-if {$err ne ""} {
-    exit 1
-}
-
-return 0

Copied: trunk/base/src/tests/test.tcl (from rev 141365, trunk/base/src/macports1.0/tests/test.tcl)
===================================================================
--- trunk/base/src/tests/test.tcl	                        (rev 0)
+++ trunk/base/src/tests/test.tcl	2015-10-16 14:05:11 UTC (rev 141366)
@@ -0,0 +1,147 @@
+# Global vars
+set arguments {}
+set test_name ""
+set color_out ""
+set tcl ""
+set err ""
+
+# Get tclsh path.
+set autoconf ../../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+    if {[string match "TCLSH*" $line] != 0} {
+        set tcl [lrange [split $line " "] 1 1]
+    }
+}
+
+proc print_help {arg} {
+    if {$arg eq "tests"} {
+        puts "The list of available tests is:"
+        cd tests
+        set test_suite [glob *.test]
+        foreach test $test_suite {
+            puts [puts -nonewline "  "]$test
+        }
+    } else {
+        puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
+        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
+        puts "  -t TEST    : run a specific test"
+        puts "  -nocolor   : disable color output (for automatic testing)"
+        puts "  -l         : print the list of available tests"
+        puts "  -h, -help  : print this message\n"
+    }
+}
+
+# Process args
+foreach arg $argv {
+    if {$arg eq "-h" || $arg eq "-help"} {
+        print_help ""
+        exit 0
+    } elseif {$arg eq "-debug"} {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set level [lindex $argv $index]
+        if {$level >= 0 && $level <= 3} {
+            lappend arguments "-debug" $level
+        } else {
+            puts "Invalid debug level."
+            exit 1
+        }
+    } elseif {$arg eq "-t"} {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set test_name [lindex $argv $index]
+        set no 0
+        cd tests
+        set test_suite [glob *.test]
+        foreach test $test_suite {
+            if {$test_name ne $test} {
+                incr no
+            }
+        }
+        if {$no == [llength $test_suite]} {
+            print_help tests
+            exit 1
+        }
+    } elseif {$arg eq "-l"} {
+        print_help tests
+        exit 0
+    } elseif {$arg eq "-nocolor"} {
+        set color_out "no"
+    }
+}
+
+
+# Run tests
+if {$test_name ne ""} {
+    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
+    puts $result
+} else {
+    cd tests
+    set test_suite [glob *.test]
+
+    foreach test $test_suite {
+        set result [exec -ignorestderr $tcl $test {*}$arguments]
+        set lastline [lindex [split $result "\n"] end]
+
+        if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
+            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
+                set lastline [lindex [split $result "\n"] 0]
+                set errmsg [lindex [split $result "\n"] 2]
+            } else {
+                set lastline [lindex [split $result "\n"] end-2]
+                set errmsg [lindex [split $result "\n"] end]
+            }
+        }
+
+        set splitresult [split $lastline "\t"]
+        set total [lindex $splitresult 2]
+        set pass [lindex $splitresult 4]
+        set skip [lindex $splitresult 6]
+        set fail [lindex $splitresult 8]
+
+        # Format output
+        if {$total < 10} {
+            set total "0${total}"
+        }
+        if {$pass < 10} {
+            set pass "0${pass}"
+        }
+        if {$skip < 10} {
+            set skip "0${skip}"
+        }
+        if {$fail < 10} {
+            set fail "0${fail}"
+        }
+
+        # Check for errors.
+        if {$fail != 0} {
+            set err "yes"
+        }
+
+        set out ""
+        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
+            # Color failed tests.
+            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
+        } else {
+            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  " $test
+        }
+
+        # Print results and constrints for auto-skipped tests.
+        puts $out
+        if {$skip != 0} {
+            set out "    Constraint: "
+            append out [string trim $errmsg "\t {}"]
+            puts $out
+        }
+        if {$fail != 0} {
+            set end [expr {[string first $test $result 0] - 1}]
+            puts [string range $result 0 $end]
+        }
+    }
+}
+
+# Return 1 if errors were found.
+if {$err ne ""} {
+    exit 1
+}
+
+return 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151212/d63b1cec/attachment-0001.html>


More information about the macports-changes mailing list