[138951] trunk/base/src

raimue at macports.org raimue at macports.org
Fri Jul 24 15:27:30 PDT 2015


Revision: 138951
          https://trac.macports.org/changeset/138951
Author:   raimue at macports.org
Date:     2015-07-24 15:27:30 -0700 (Fri, 24 Jul 2015)
Log Message:
-----------
base: sync test.tcl scripts with each other

Modified 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/tests/test.tcl
===================================================================
--- trunk/base/src/macports1.0/tests/test.tcl	2015-07-24 22:16:30 UTC (rev 138950)
+++ trunk/base/src/macports1.0/tests/test.tcl	2015-07-24 22:27:30 UTC (rev 138951)
@@ -15,7 +15,7 @@
 }
 
 proc print_help {arg} {
-    if { $arg eq "tests" } {
+    if {$arg eq "tests"} {
         puts "The list of available tests is:"
         cd tests
         set test_suite [glob *.test]
@@ -34,19 +34,19 @@
 
 # Process args
 foreach arg $argv {
-    if { $arg eq "-h" || $arg eq "-help" } {
+    if {$arg eq "-h" || $arg eq "-help"} {
         print_help ""
         exit 0
-    } elseif { $arg eq "-debug" } {
+    } 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
+        if {$level >= 0 && $level <= 3} {
+            lappend arguments "-debug" $level
         } else {
             puts "Invalid debug level."
             exit 1
         }
-    } elseif { $arg eq "-t" } {
+    } elseif {$arg eq "-t"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set test_name [lindex $argv $index]
         set no 0
@@ -74,7 +74,6 @@
 if {$test_name ne ""} {
     set result [exec -ignorestderr $tcl $test_name {*}$arguments]
     puts $result
-
 } else {
     cd tests
     set test_suite [glob *.test]
@@ -84,8 +83,13 @@
         set lastline [lindex [split $result "\n"] end]
 
         if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            set lastline [lindex [split $result "\n"] end-2]
-            set errmsg [lindex [split $result "\n"] end]
+            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"]
@@ -95,10 +99,18 @@
         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}"}
+        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} {

Modified: trunk/base/src/package1.0/tests/test.tcl
===================================================================
--- trunk/base/src/package1.0/tests/test.tcl	2015-07-24 22:16:30 UTC (rev 138950)
+++ trunk/base/src/package1.0/tests/test.tcl	2015-07-24 22:27:30 UTC (rev 138951)
@@ -15,7 +15,7 @@
 }
 
 proc print_help {arg} {
-    if { $arg eq "tests" } {
+    if {$arg eq "tests"} {
         puts "The list of available tests is:"
         cd tests
         set test_suite [glob *.test]
@@ -54,7 +54,7 @@
         set test_suite [glob *.test]
         foreach test $test_suite {
             if {$test_name ne $test} {
-                set no [expr {$no + 1}]
+                incr no
             }
         }
         if {$no == [llength $test_suite]} {

Modified: trunk/base/src/port1.0/tests/test.tcl
===================================================================
--- trunk/base/src/port1.0/tests/test.tcl	2015-07-24 22:16:30 UTC (rev 138950)
+++ trunk/base/src/port1.0/tests/test.tcl	2015-07-24 22:27:30 UTC (rev 138951)
@@ -54,7 +54,7 @@
         set test_suite [glob *.test]
         foreach test $test_suite {
             if {$test_name ne $test} {
-                set no [expr {$no + 1}]
+                incr no
             }
         }
         if {$no == [llength $test_suite]} {
@@ -83,8 +83,13 @@
         set lastline [lindex [split $result "\n"] end]
 
         if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            set lastline [lindex [split $result "\n"] end-2]
-            set errmsg [lindex [split $result "\n"] end]
+            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"]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150724/605f3863/attachment.html>


More information about the macports-changes mailing list