autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] another shell function, this time to group failure code


From: Paolo Bonzini
Subject: [PATCH] another shell function, this time to group failure code
Date: Fri, 5 Oct 2007 09:53:19 +0200

Here is some more effort to speed up autotest (I want to switch to git for
my own projects, and I wanted to test how cool it is for contributors to
use it...).  Overall, this thread remove ~20% of the size of the autoconf
testsuite script (both lines and bytes) and speeds up autotest by 25-30%.

I also tested the series on a dummy testsuite with 70 occurrences of

  AT_SETUP
  foo=:
  AT_CHECK($foo)
  AT_CLEANUP

There, the benefits are smaller (around 10%) but coupled with a 10%
*run-time* performance improvement.

This patch uses shell functions to trim the code that is executed in case
of failure and remove an m4 iteration.

2007-10-04  Paolo Bonzini  <address@hidden>

        * general.m4 (AT_INIT): Add at_log_failure shell function.
        (_AT_CHECK): Use it.
---
 ChangeLog               |    5 +++++
 lib/autotest/general.m4 |   18 +++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index bdfb18f..beed88c 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -232,6 +232,14 @@ at_filter_trace ()
   return $[1]
 }
 
+at_log_failure ()
+{
+  for file
+   do AS_ECHO(["$file:"]); sed 's/^/> /' "$file"; done
+  echo 1 > "$at_status_file"
+  exit 1
+}
+
 # Load the config file.
 for at_file in atconfig atlocal
 do
@@ -1199,7 +1207,7 @@ $1])])# AT_COPYRIGHT
 # The group is testing what DESCRIPTION says.
 m4_define([AT_SETUP],
 [m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])])
-m4_ifdef([AT_capture_files], [m4_undefine([AT_capture_files])])
+m4_define([AT_capture_files], [])
 m4_define([AT_line], AT_LINE)
 m4_define([AT_xfail], [at_xfail=no])
 m4_define([AT_description], m4_quote($1))
@@ -1529,11 +1537,7 @@ m4_if([$2], [ignore],
    *) AS_ECHO(["$at_srcdir/AT_LINE: exit code was $at_status, expected 
m4_default([$2], [0])"])
       at_failed=:;;])
 esac
-AS_IF($at_failed, [$5
-  m4_ifdef([AT_capture_files],
-    [for file in AT_capture_files
-     do AS_ECHO(["$file:"]); sed 's/^/> /' "$file"; done])
-  echo 1 > "$at_status_file"
-  exit 1], [$6])
+AS_IF($at_failed, [$5], [$6])
+$at_failed && at_log_failure AT_capture_files
 $at_traceon
 ])# _AT_CHECK
-- 
1.5.2.4





reply via email to

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