autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] Minor testsuite size reduction.


From: Eric Blake
Subject: [PATCH] Minor testsuite size reduction.
Date: Wed, 21 Jul 2010 07:58:16 -0600

* lib/autotest/general.m4 (AT_INIT) <serial testing>: Ensure
at_jobs is 1.
(AT_SETUP, AT_CLEANUP): Factor initialization code...
(AT_INIT) <at_fn_group_banner>: ...into new function.
Based in part on suggestion by Ralf Wildenhues.

Signed-off-by: Eric Blake <address@hidden>
---

Shaves 90k (3%) off the size of autoconf's testsuite!

 ChangeLog               |    9 +++++++++
 lib/autotest/general.m4 |   36 +++++++++++++++++++++++++-----------
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2544b76..aba6597 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-21  Eric Blake  <address@hidden>
+
+       Minor testsuite size reduction.
+       * lib/autotest/general.m4 (AT_INIT) <serial testing>: Ensure
+       at_jobs is 1.
+       (AT_SETUP, AT_CLEANUP): Factor initialization code...
+       (AT_INIT) <at_fn_group_banner>: ...into new function.
+       Based in part on suggestion by Ralf Wildenhues.
+
 2010-07-20  Eric Blake  <address@hidden>

        Close job control fd before running tests.
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 4acdb9d..09c4f6e 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1108,7 +1108,7 @@ AS_ERROR([testsuite directory setup failed])
 # to avoid hitting zsh 4.x exit status bugs.

 AS_FUNCTION_DESCRIBE([at_fn_group_prepare], [],
-[Prepare running a test group.])
+[Prepare for running a test group.])
 at_fn_group_prepare ()
 {
   # The directory for additional per-group helper files.
@@ -1158,6 +1158,24 @@ at_fn_group_prepare ()
   fi
 }

+AS_FUNCTION_DESCRIBE([at_fn_group_banner], [[ORDINAL LINE DESC PAD [BANNER]]],
+[Declare the test group ORDINAL, located at LINE with group description
+DESC, and residing under BANNER.  Use PAD to align the status column.])
+at_fn_group_banner ()
+{
+  at_setup_line="$[2]"
+  test -n "$[5]" && at_fn_banner $[5]
+  at_desc="$[3]"
+  case $[1] in
+    [[0-9]])      at_desc_line="  $[1]: ";;
+    [[0-9][0-9]]) at_desc_line=" $[1]: " ;;
+    [*])          at_desc_line="$[1]: "  ;;
+  esac
+  AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"])
+  $at_quiet AS_ECHO_N(["$at_desc_line"])
+  echo "#                             -*- compilation -*-" >> "$at_group_log"
+}
+
 AS_FUNCTION_DESCRIBE([at_fn_group_postprocess], [],
 [Perform cleanup after running a test group.])
 at_fn_group_postprocess ()
@@ -1440,6 +1458,7 @@ dnl           kill -13 $$
   wait
 else
   # Run serially, avoid forks and other potential surprises.
+  at_jobs=1
   for at_group in $at_groups; do
     at_fn_group_prepare
     if cd "$at_group_dir" &&
@@ -1821,14 +1840,10 @@ m4_define([AT_ordinal], m4_incr(AT_ordinal))
 m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
 m4_divert_push([TEST_GROUPS])dnl
 [#AT_START_]AT_ordinal
address@hidden:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
-at_setup_line='m4_defn([AT_line])'
-m4_if(AT_banner_ordinal, [0], [], [at_fn_banner AT_banner_ordinal
-])dnl
-at_desc="AS_ESCAPE(m4_dquote(m4_defn([AT_description])))"
-at_desc_line=m4_format(["%3d: $at_desc%*s"], AT_ordinal,
-  m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])
-$at_quiet AS_ECHO_N(["$at_desc_line"])
+at_fn_group_banner AT_ordinal 'm4_defn([AT_line])' \
+  "AS_ESCAPE(m4_dquote(m4_defn([AT_description])))" m4_format(["%*s"],
+  m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])m4_if(
+  AT_banner_ordinal, [0], [], [ AT_banner_ordinal])
 m4_divert_push([TEST_SCRIPT])dnl
 ])

@@ -1910,9 +1925,8 @@ m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);
 )dnl
 m4_divert_pop([TEST_SCRIPT])dnl Back to TEST_GROUPS
 AT_xfail
-echo "#                             -*- compilation -*-" >> "$at_group_log"
 (
-  AS_ECHO(["AT_ordinal. m4_defn([AT_line]): testing $at_desc ..."])
+  AS_ECHO(["AT_ordinal. $at_setup_line: testing $at_desc ..."])
   $at_traceon
 m4_undivert([TEST_SCRIPT])dnl Insert the code here
   set +x
-- 
1.7.1.1




reply via email to

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