dejagnu
[Top][All Lists]
Advanced

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

PATCH: remove runtest_start procedure


From: Jacob Bachmeyer
Subject: PATCH: remove runtest_start procedure
Date: Thu, 13 Dec 2018 23:32:59 -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

This patch builds on the previous patch "supply useful default for RUNTEST in DejaGnu testsuite" and further cleans up the runtest tool init file. Since the test in runtest_start had an inverted condition (the "which" procedure returns zero only on failure), I am confident that it was never called. This patch moves that sanity check to top-level and changes a failure to an immediate fatal error. An additional sanity check to ensure that Expect is available is also added, since the DejaGnu testsuite cannot be expected to produce meaningful results if either of those are missing.

The ChangeLog entry lists some other minor changes also included.

----
ChangeLog entry:
        * testsuite/lib/runtest.exp: Remove "runtest_start" procedure and
        move its sanity check that $RUNTEST can be found to top-level.
        Add similar check to ensure that $EXPECT can be found.
        Make failure of either sanity check an immediate fatal error.
        Also fix sanity checks; the sense of the test was inverted.
        Remove Tcl syntactic sugar "then" words from "if" commands.
        Improve error messages for sanity checks to indicate which
        critical tool was not found.
        Remove useless "global RUNTEST" command at top-level.
        (runtest_version): Brace "if" conditional expression.
----
patch:
----
diff --git a/testsuite/lib/runtest.exp b/testsuite/lib/runtest.exp
index 399e174..67643b4 100644
--- a/testsuite/lib/runtest.exp
+++ b/testsuite/lib/runtest.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2016 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016, 2018 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
@@ -18,16 +18,24 @@

# This file was written by Rob Savoye <address@hidden>.

-global RUNTEST
-if {![info exists RUNTEST]} then {
+if { ![info exists RUNTEST] } {
    set RUNTEST [file join [file dirname [testsuite file -source -top]] runtest]
}

-if {![info exists EXPECT]} {
+if { ![info exists EXPECT] } {
    set EXPECT [findfile $base_dir/../../expect/expect 
$base_dir/../../expect/expect expect]
    verbose "EXPECT defaulting to $EXPECT" 2
}

+if { [which $RUNTEST] == 0 } {
+    perror "Can't find RUNTEST = $RUNTEST"
+    exit 2
+}
+if { [which $EXPECT] == 0 } {
+    perror "Can't find EXPECT = $EXPECT"
+    exit 2
+}
+
#
# runtest_version -- extract and print the version number
#
@@ -35,7 +43,7 @@ proc runtest_version { } {
    global RUNTEST

    catch {exec $RUNTEST -V} tmp
-    if [info exists tmp] then {
+    if { [info exists tmp] } {
        clone_output "$tmp\n"
    }
}
@@ -51,14 +59,3 @@ proc runtest_load { arg } {
#
proc runtest_exit { } {
}
-
-#
-# runtest_start -- start everything
-#
-proc runtest_start { } {
-    global RUNTEST
-
-    if {[which $RUNTEST] != 0} then {
-       perror "Can't find $RUNTEST"
-    }
-}
----


-- Jacob



reply via email to

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