INN commit: trunk (4 files)

INN Commit rra at isc.org
Wed Sep 3 17:27:01 UTC 2014


    Date: Wednesday, September 3, 2014 @ 10:27:01
  Author: iulius
Revision: 9670

add getc-tap-harness support script to keep INN in sync with C TAP Harness

Added:
  trunk/support/getc-tap-harness
Modified:
  trunk/MANIFEST
  trunk/doc/pod/hacking.pod
  trunk/doc/pod/news.pod

--------------------------+
 MANIFEST                 |    1 
 doc/pod/hacking.pod      |   31 ++---
 doc/pod/news.pod         |    8 +
 support/getc-tap-harness |  260 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 286 insertions(+), 14 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2014-09-03 17:18:22 UTC (rev 9669)
+++ MANIFEST	2014-09-03 17:27:01 UTC (rev 9670)
@@ -761,6 +761,7 @@
 support/config.sub                    Canonicalize system type for libtool
 support/fixconfig.in                  Config file path fixup script
 support/fixscript.in                  Interpreter path fixup script
+support/getc-tap-harness              Get the latest files from C TAP Harness
 support/getrra-c-util                 Get the latest files from rra-c-util
 support/indent                        A mostly working wrapper around indent
 support/install-sh                    Installation utility

Modified: doc/pod/hacking.pod
===================================================================
--- doc/pod/hacking.pod	2014-09-03 17:18:22 UTC (rev 9669)
+++ doc/pod/hacking.pod	2014-09-03 17:27:01 UTC (rev 9670)
@@ -659,23 +659,26 @@
 
 =item *
 
-Make sure that the latest upstream version of the C TAP Harness package
-is used for the test suite driver.  It is available from
-L<http://www.eyrie.org/~eagle/software/c-tap-harness/>.  The file
-F<tests/runtests.c> should be updated, as well as the files in the
-F<tests/tap> directory.  Parts specific to INN should be kept during
-an update (especially sections relative to LIBTEST_NEW_FORMAT because
-the test suite has not yet been updated to use the new format of C
-TAP Harness).
+Make sure that the latest upstream version of the C TAP Harness
+package is used for the test suite driver.  It is available at
+L<http://www.eyrie.org/~eagle/software/c-tap-harness/>, and can be
+easily synchronized with the script F<support/getc-tap-harness>; just
+run it, have a look at the resulting changes in INN source code and,
+if everything seems all right, commit these changes.
 
+Parts specific to INN should be kept during an update (especially
+sections relative to LIBTEST_NEW_FORMAT because the test suite has not
+yet been fully updated to use the new format of C TAP Harness).
+
 =item *
 
-Make sure that the latest upstream version of the files maintained in the
-rra-c-util package that INN uses are in sync with upstream.  These files
-are available at L<http://www.eyrie.org/~eagle/software/rra-c-util/>
-and can be easily synchronized with the script F<support/getrra-c-util>;
-just run it, have a look at the resulting changes in INN source code and,
-if everything seems all right, commit these changes.
+Make sure that the latest upstream version of the files
+maintained in the rra-c-util package that INN uses are the
+ones shipped with the release.  These files are available at
+L<http://www.eyrie.org/~eagle/software/rra-c-util/> and can be easily
+synchronized with the script F<support/getrra-c-util>; just run it, have
+a look at the resulting changes in INN source code and, if everything
+seems all right, commit these changes.
 
 =item *
 

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2014-09-03 17:18:22 UTC (rev 9669)
+++ doc/pod/news.pod	2014-09-03 17:27:01 UTC (rev 9670)
@@ -168,6 +168,14 @@
 For security reasons, use of the flawed SSLv2 protocol is now disabled
 for TLS sessions with B<nnrpd>.
 
+=item *
+
+The INN test suite driver is now fully synchronized with the upstream
+version of the C TAP Harness package maintained by Russ Allbery.
+Keeping the INN test suite driver up-to-date will be possible thanks
+to a new B<getc-tap-harness> script in the F<support> directory that
+automatically fetches the latest upstream changes.
+
 =back
 
 =head1 Changes in 2.5.5

Added: support/getc-tap-harness
===================================================================
--- support/getc-tap-harness	                        (rev 0)
+++ support/getc-tap-harness	2014-09-03 17:27:01 UTC (rev 9670)
@@ -0,0 +1,260 @@
+#!/bin/sh
+
+##  $Id$
+##
+##  Synchronize INN files maintained in c-tap-harness with upstream.
+##
+##  This script downloads the latest version of the files maintained
+##  in the C TAP Harness package that INN uses for its test driver suite.
+##  These files are available at
+##  <http://www.eyrie.org/~eagle/software/c-tap-harness/>.
+##
+##  Running this script permits to keep up-to-date the INN test driver suite
+##  by automatically fetching the latest version of the upstream files, and
+##  putting them in the expected location in the INN source code.
+##  The name of the files that have been modified since the last run of the
+##  script are written to standard output.  Have a look at the changes and,
+##  if all looks right, commit the changes.
+
+##  URL where the files can be downloaded.
+URL_START="http://git.eyrie.org/?p=devel/c-tap-harness.git;a=blob_plain;hb=HEAD;f="
+
+##  This function downloads the files and copies them to the expected
+##  location in the INN source code, after having performed a few minimal
+##  changes to integrate them in the INN build system.
+##  If a file is not found in upstream or has been modified since the last
+##  run of the script, write it on standard output.
+##
+##  This function expects the following arguments:
+##    $1 - full path of the file to download in the upstream package
+##    $2 - directory where the file should be copied in INN source code
+##    $3 - name of the file in INN source code
+download ()
+{
+  TEMP=$3.tmp
+
+  rm -f ${TEMP}
+  wget -q "${URL_START}$1" -O ${TEMP}
+
+  if [ ! -s "${TEMP}" ]
+  then
+    echo "File $1 does not exist in upstream package"
+  else
+    if [ "$2" = "tests" ] || [ "$2" = "tests/tap" ]
+    then
+      # Add the SVN Id keyword at the beginning of source code files,
+      # and update the path of included C header files.
+      # Changes in shell scripts and C files are not the same.
+      # Also, do not modify the README file.
+      if [ "$3" = "libtap.sh" ]
+      then
+        sed -i -e "1 i \\
+# \$Id\$\\
+#" \
+               ${TEMP}
+      elif [ "$3" != "README" ]
+      then
+        sed -i -e '1 s/$/ $Id$\n */' \
+               -e 's/^#include <tests\/tap\//#include <tap\//g' \
+               ${TEMP}
+      fi
+    fi
+
+    # Specific additions to a few files.
+    if [ "$3" = "basic.c" ]
+    then
+      sed -i -e "55 i \\
+/* Specific to the integration of C TAP Harness in INN. */\\
+#ifndef LIBTEST_NEW_FORMAT\\
+# include \"inn/messages.h\"\\
+# include \"inn/libinn.h\"\\
+\\
+void\\
+test_init(int count)\\
+{\\
+    plan(count);\\
+}\\
+\\
+void\\
+ok(int n UNUSED, int success)\\
+{\\
+    new_ok(success, NULL);\\
+}\\
+\\
+void\\
+skip(int n UNUSED, const char *reason)\\
+{\\
+    new_skip(reason);\\
+}\\
+\\
+void\\
+ok_block(int n UNUSED, int count, int success)\\
+{\\
+    new_ok_block(count, success, NULL);\\
+}\\
+\\
+void\\
+skip_block(int n UNUSED, int count, const char *reason)\\
+{\\
+    new_skip_block(count, reason);\\
+}\\
+\\
+void\\
+ok_int(int n UNUSED, int wanted, int seen)\\
+{\\
+    is_int(wanted, seen, NULL);\\
+}\\
+\\
+void\\
+ok_string(int n UNUSED, const char *wanted, const char *seen)\\
+{\\
+    is_string(wanted, seen, NULL);\\
+}\\
+\\
+/* A global buffer into which message_log_buffer stores error messages. */\\
+char *errors = NULL;\\
+\\
+/*\\
+ *  An error handler that appends all errors to the errors global.  Used by\\
+ *  error_capture.\\
+ */\\
+static void\\
+message_log_buffer(int len, const char *fmt, va_list args, int error UNUSED)\\
+{\\
+    char *message;\\
+\\
+    message = xmalloc(len + 1);\\
+    vsnprintf(message, len + 1, fmt, args);\\
+    if (errors == NULL) {\\
+        errors = concat(message, \"\\\n\", (char *) 0);\\
+    } else {\\
+        char *new_errors;\\
+\\
+        new_errors = concat(errors, message, \"\\\n\", (char *) 0);\\
+        free(errors);\\
+        errors = new_errors;\\
+    }\\
+    free(message);\\
+}\\
+\\
+/*\\
+ *  Turn on the capturing of errors.  Errors will be stored in the global\\
+ *  errors variable where they can be checked by the test suite.  Capturing is\\
+ *  turned off with errors_uncapture.\\
+ */\\
+void\\
+errors_capture(void)\\
+{\\
+    if (errors != NULL) {\\
+        free(errors);\\
+        errors = NULL;\\
+    }\\
+    message_handlers_warn(1, message_log_buffer);\\
+    message_handlers_notice(1, message_log_buffer);\\
+}\\
+\\
+/*\\
+ *  Turn off the capturing of errors again.\\
+ */\\
+void\\
+errors_uncapture(void)\\
+{\\
+    message_handlers_warn(1, message_log_stderr);\\
+    message_handlers_notice(1, message_log_stdout);\\
+}\\
+#endif\\
+" \
+             -e "150 i \\
+#ifndef LIBINN_H" \
+             -e "184 i \\
+#endif" \
+             -e 's/^ok.int /new_ok(int /g' \
+             -e 's/^skip.const /new_skip(const /g' \
+             -e 's/^ok_block.unsigned /new_ok_block(unsigned /g' \
+             -e 's/^skip_block.unsigned /new_skip_block(unsigned /g' \
+             ${TEMP}
+    fi
+
+    if [ "$3" = "basic.h" ]
+    then
+      sed -i -e "74 i \\
+#ifndef LIBTEST_NEW_FORMAT\\
+/* Specific to the integration of C TAP Harness in INN. */\\
+void ok(int n, int success);\\
+int new_ok(int success, const char *format, ...)\\
+        __attribute__((__format__(printf, 2, 3)));\\
+void ok_int(int n, int wanted, int seen);\\
+void ok_string(int n, const char *wanted, const char *seen);\\
+int okv(int success, const char *format, va_list args);\\
+void skip(int n, const char *reason);\\
+void new_skip(const char *reason, ...)\\
+        __attribute__((__format__(printf, 1, 2)));\\
+void ok_block(int n, int count, int success);\\
+int new_ok_block(unsigned long count, int success, const char *format, ...)\\
+        __attribute__((__format__(printf, 3, 4)));\\
+void skip_block(int n, int count, const char *reason);\\
+void new_skip_block(unsigned long count, const char *reason, ...)\\
+        __attribute__((__format__(printf, 2, 3)));\\
+\\
+void test_init(int count);\\
+\\
+/* A global buffer into which errors_capture stores errors. */\\
+extern char *errors;\\
+\\
+/* Turn on capturing of errors with errors_capture.  Errors reported by warn\\
+ * will be stored in the global errors variable.  Turn this off again with\\
+ * errors_uncapture.  Caller is responsible for freeing errors when done.\\
+ */\\
+void errors_capture(void);\\
+void errors_uncapture(void);\\
+#else\\
+# define ok new_ok\\
+# define skip new_skip\\
+# define ok_block new_ok_block\\
+# define skip_block new_skip_block" \
+             -e "88 i \\
+#endif" \
+             ${TEMP}
+    fi
+
+    if [ "$3" = "float.c" ]
+    then
+      sed -i -e "49 i \\
+#ifndef LIBTEST_NEW_FORMAT\\
+/* Specific to the integration of C TAP Harness in INN. */\\
+void\\
+ok_double(int n UNUSED, double wanted, double seen)\\
+{\\
+    is_double(wanted, seen, 0.01, NULL);\\
+}\\
+#endif\\
+" \
+             ${TEMP}
+    fi
+
+    if [ "$3" = "float.h" ]
+    then
+      sed -i -e "37 i \\
+#ifndef LIBTEST_NEW_FORMAT\\
+/* Specific to the integration of C TAP Harness in INN. */\\
+void ok_double(int n, double wanted, double seen);\\
+#endif" \
+             ${TEMP}
+    fi
+
+    mv -f ${TEMP} ../$2/$3
+    svn status ../$2/$3
+  fi
+}
+
+##  Synchronize the test driver suite from upstream.
+download tests/runtests.c tests runtests.c
+download tests/tap/basic.c tests/tap basic.c
+download tests/tap/basic.h tests/tap basic.h
+download tests/tap/float.c tests/tap float.c
+download tests/tap/float.h tests/tap float.h
+download tests/tap/libtap.sh tests/tap libtap.sh
+download tests/tap/macros.h tests/tap macros.h
+
+##  Synchronize the README file from upstream.
+download docs/writing-tests tests README


Property changes on: trunk/support/getc-tap-harness
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native
Added: svn:executable
   + *



More information about the inn-committers mailing list