dejagnu
[Top][All Lists]
Advanced

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

PATCH: Improve default_procs.tcl


From: Jacob Bachmeyer
Subject: PATCH: Improve default_procs.tcl
Date: Thu, 06 Dec 2018 19:05:07 -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

Here are some more improvements. I am still considering the possibility of removing the temporary "sum_file": the libs.exp driver erases the temporary file unconditionally, the stubs in default_procs.tcl do not use it at all, and the clone_output procedure in framework.exp first tests if $sum_file is an empty string and ignores it if so.

----
ChangeLog entries:
        * testsuite/runtest.all/default_procs.tcl (lib_ret_test): Tidy.
        (run_tests): Replace implicit "eval" with explicit "eval".  Tidy.
        (verbose): Remove unnecessary quotes.
----
patch:
----
diff --git a/testsuite/runtest.all/default_procs.tcl 
b/testsuite/runtest.all/default_procs.tcl
index d98cc21..c5e4099 100644
--- a/testsuite/runtest.all/default_procs.tcl
+++ b/testsuite/runtest.all/default_procs.tcl
@@ -20,13 +20,10 @@ proc lib_pat_test { cmd arglist pattern } {
# this tests a proc for a returned value
proc lib_ret_test { cmd arglist val } {
    catch { eval [list $cmd] $arglist } result
-#    catch "set result [$cmd $arg]" output
-#    set result "$cmd [eval $arg]
    puts "CMD(lib_ret_test) was: $cmd $arglist"
    puts "RESULT(lib_ret_test) was: $result"
-#    puts "OUTPUT(lib_ret_test) was: $output"

-    if { $result == $val } {
+    if { $result eq $val } {
        return 1
    } else {
        return 0
@@ -39,20 +36,20 @@ proc lib_ret_test { cmd arglist val } {
# test proc is something like lib_pat_test or lib_ret_test.
#
proc run_tests { tests } {
-    foreach i "$tests" {
-       set result [ [lindex $i 0] "[lindex $i 1]" "[lindex $i 2]" "[lindex $i 
3]" ]
+    foreach test $tests {
+       set result [eval [lrange $test 0 3]]
        switch -- $result {
            "-1" {
-               puts "ERRORED: [lindex $i 4]"
+               puts "ERRORED: [lindex $test 4]"
            }
            "1" {
-               puts "PASSED: [lindex $i 4]"
+               puts "PASSED: [lindex $test 4]"
            }
            "0" {
-               puts "FAILED: [lindex $i 4]"
+               puts "FAILED: [lindex $test 4]"
            }
            default {
-               puts "BAD VALUE: [lindex $i 4]"
+               puts "BAD VALUE: [lindex $test 4]"
            }
        }
    }
@@ -90,5 +87,5 @@ proc unsupported { msg } {
    puts "NOTSUPPORTED: $msg"
}
proc verbose { args } {
-    puts "[lindex $args 0]"
+    puts [lindex $args 0]
}
----


-- Jacob



reply via email to

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