dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: remove unused "testcnt" mechanism


From: Jacob Bachmeyer
Subject: PATCH: remove unused "testcnt" mechanism
Date: Thu, 13 Dec 2018 18:26:16 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 MultiZilla/1.8.3.4e SeaMonkey/1.1.17 Mnenhy/0.7.6.0

Put simply, this feature was never used and has significant limitations, like not being able to report *what* is missing, only that *something* is missing. The comment also indicates that the maintenance burden of using this feature was expected to be fairly high, and the manual does not mention it at all. (Searching dejagnu.texi for "testcnt" produces 0 hits.) I stumbled across this while doing other work and decided to remove it, as it has not been used since it was last changed in 1994 if it was ever used at all.

You might reasonably ask how I can be certain that this feature was never used. That is how I found it: I thought that the way Emacs highlighted that code "looked funny" and read it more closely. In two places where an array entry is intended to be read, the name of the array and entry are instead substituted due to a missing "$" on the overall reference. The result of this is a Tcl error if testcnt is actually set to a nonzero value. The only way that this bug could still be in the code is if no one reported it. The only way this bug could have gone unreported this long is that no one uses this feature. (There also appears to be rather nasty logic error, with the effect that the "testcnt" value from the tool init file is actually ignored.)

You can prove this yourself by adding "set testcnt 5" to testsuite/lib/libdejagnu.exp from commit 874edd44fc41aff555b8cc39d91b6576095135df (current "master" HEAD as of this writing) and running the testsuite. It aborts with a Tcl error: expected integer but got "test_counts(FAIL,total)"

This feature has been completely broken for 24 years with no complaints... I think we can remove it. :-)

----
ChangeLog entry:
        * lib/framework.exp (log_summary): Remove "testcnt" mechanism.
        This was an effort to support verifying the number of tests
        reported by a testsuite.  Unfortunately, it was difficult to use
        properly and was never used since its introduction in 1993/1994.
        * testsuite/lib/libsup.exp: Remove obsolete "testcnt" variable.
----
patch:
----
diff --git a/lib/framework.exp b/lib/framework.exp
index 5879ea6..f48d3f5 100644
--- a/lib/framework.exp
+++ b/lib/framework.exp
@@ -403,7 +403,6 @@ proc log_summary { args } {
    global mailing_list
    global current_target_name
    global test_counts
-    global testcnt

    if { [llength $args] == 0 } {
        set which "count"
@@ -417,38 +416,6 @@ proc log_summary { args } {
        clone_output "\n\t\t=== $tool Summary ===\n"
    }

-    # If the tool set `testcnt', it wants us to do a sanity check on the
-    # total count, so compare the reported number of testcases with the
-    # expected number.  Maintaining an accurate count in `testcnt' isn't easy
-    # so it's not clear how often this will be used.
-    if {[info exists testcnt]} {
-       if { $testcnt > 0 } {
-           set totlcnt 0
-           # total all the testcases reported
-           foreach x { FAIL PASS XFAIL KFAIL XPASS KPASS UNTESTED UNRESOLVED 
UNSUPPORTED } {
-               incr totlcnt test_counts($x,$which)
-           }
-           set testcnt test_counts(total,$which)
-
-           if { $testcnt>$totlcnt || $testcnt<$totlcnt } {
-               if { $testcnt > $totlcnt } {
-                   set mismatch "unreported  [expr {$testcnt - $totlcnt}]"
-               }
-               if { $testcnt < $totlcnt } {
-                   set mismatch "misreported [expr {$totlcnt - $testcnt}]"
-               }
-           } else {
-               verbose "# of testcases run         $testcnt"
-           }
-
-           if {[info exists mismatch]} {
-               clone_output "### ERROR: totals do not equal number of testcases 
run"
-               clone_output "### ERROR: # of testcases expected    $testcnt"
-               clone_output "### ERROR: # of testcases reported    $totlcnt"
-               clone_output "### ERROR: # of testcases $mismatch\n"
-           }
-       }
-    }
    foreach x { PASS FAIL XPASS XFAIL KPASS KFAIL UNRESOLVED UNTESTED 
UNSUPPORTED } {
        set val $test_counts($x,$which)
        if { $val > 0 } {
diff --git a/testsuite/lib/libsup.exp b/testsuite/lib/libsup.exp
index 4d167e1..bd9c034 100644
--- a/testsuite/lib/libsup.exp
+++ b/testsuite/lib/libsup.exp
@@ -43,7 +43,6 @@ proc make_defaults_file { defs } {
    puts $fd "set target_triplet $target_triplet"
    puts $fd "set target_os $target_os"
    puts $fd "set target_cpu $target_cpu"
-    puts $fd "set testcnt 0"
    puts $fd "set warncnt 0"
    puts $fd "set errcnt 0"
    puts $fd "set passcnt 0"
----


-- Jacob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]