Imported Upstream version 1.5.3 upstream/1.5.3
authorJinWang An <jinwang.an@samsung.com>
Thu, 23 Dec 2021 05:11:08 +0000 (14:11 +0900)
committerJinWang An <jinwang.an@samsung.com>
Thu, 23 Dec 2021 05:11:08 +0000 (14:11 +0900)
24 files changed:
ChangeLog
Makefile.in
NEWS
README
aclocal.m4
build-aux/ar-lib
build-aux/compile
build-aux/missing
build-aux/test-driver
configure
configure.ac
gl/lib/Makefile.in
lib/Makefile.am
lib/Makefile.in
lib/pipeline.c
man/Makefile.in
tests/Makefile.in
tests/argstr.c
tests/basic.c
tests/exec.c
tests/inspect.c
tests/pump.c
tests/read.c
tests/redirect.c

index 4be5522e064f231a6cd794b3159f54412c8be0b4..3e709d8da0d93f69ee9ac0d0df0640ae65ec2300 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2020-08-13  Colin Watson  <cjwatson@debian.org>
+
+       Version: 1.5.3
+
+       * lib/Makefile.am (libpipeline_la_LDFLAGS): Bump -version-info to 6:3:5.
+
+2020-08-03  Colin Watson  <cjwatson@debian.org>
+
+       Port tests to the modern Check API
+
+       Fixes Savannah bug #58883.
+
+       * configure.ac: Test for check >= 0.9.10.
+       * tests/argstr.c, tests/basic.c, tests/exec.c, tests/inspect.c,
+       tests/pump.c, tests/read.c, tests/redirect.c: Replace uses of
+       fail_unless and fail_if with appropriate ck_assert_* calls.  In most
+       cases these now use more specific equality etc. tests rather than just
+       passing arbitrary predicates.
+       * README: Document updated dependency.
+       * NEWS: Document this.
+
+2020-07-05  Colin Watson  <cjwatson@debian.org>
+
+       Fix handling of read/write errors
+
+       safe_read and safe_write return size_t and define SAFE_READ_ERROR and
+       SAFE_WRITE_ERROR as error return values.  We had previously been
+       assigning their result to a signed value.  As a result, whether
+       passthrough, pipeline_pump, and get_block would detect read/write errors
+       was implementation-defined.
+
+       * lib/pipeline.c (passthrough, get_block): Assign safe_read return value
+       to a size_t rather than a signed integer type, and check for
+       SAFE_READ_ERROR rather than negative values.
+       (pipeline_pump): Assign safe_write return value to a size_t rather than
+       an ssize_t, and check for SAFE_WRITE_ERROR rather than negative values.
+       * NEWS: Document this.
+
 2020-01-01  Colin Watson  <cjwatson@debian.org>
 
        Version: 1.5.2
index 4bb158c7b6348e0289f37b9600c37457b57b007e..7a9cda399faaf541f44884d875b091ca84a70276 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -214,8 +214,8 @@ am__recursive_targets = \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
        cscope distdir distdir-am dist dist-all distcheck
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
-       $(LISP)config.h.in
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
+       config.h.in
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
 # *not* preserved.
@@ -1379,6 +1379,10 @@ dist-xz: distdir
        tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
        $(am__post_remove_distdir)
 
+dist-zstd: distdir
+       tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
+       $(am__post_remove_distdir)
+
 dist-tarZ: distdir
        @echo WARNING: "Support for distribution archives compressed with" \
                       "legacy program 'compress' is deprecated." >&2
@@ -1421,6 +1425,8 @@ distcheck: dist
          eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
+       *.tar.zst*) \
+         zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
        esac
        chmod -R a-w $(distdir)
        chmod u+w $(distdir)
@@ -1598,7 +1604,7 @@ uninstall-am:
        am--refresh check check-am clean clean-cscope clean-generic \
        clean-libtool cscope cscopelist-am ctags ctags-am dist \
        dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
-       dist-tarZ dist-xz dist-zip distcheck distclean \
+       dist-tarZ dist-xz dist-zip dist-zstd distcheck distclean \
        distclean-generic distclean-hdr distclean-libtool \
        distclean-tags distcleancheck distdir distuninstallcheck dvi \
        dvi-am html html-am info info-am install install-am \
diff --git a/NEWS b/NEWS
index c02c2c15e5a258214b1a327cf1139006a041468c..d69a917449bca425a3bd36668744d373924d2f78 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+libpipeline 1.5.3 (13 August 2020)
+==================================
+
+Fix implementation-defined behaviour while handling read/write errors.
+
+Port tests to the modern Check API.
+
 libpipeline 1.5.2 (1 January 2020)
 ==================================
 
diff --git a/README b/README
index 5c95427db52a456f9aa15a8ea4f1b671f1c46804..17880abe304be0eccaea6a221455ce9f325f7756 100644 (file)
--- a/README
+++ b/README
@@ -19,7 +19,7 @@ need these separate packages installed before configuring libpipeline in
 order to run its test suite:
 
   pkg-config (http://www.freedesktop.org/wiki/Software/pkg-config)
-  check (http://check.sourceforge.net/)
+  check >= 0.9.10 (http://check.sourceforge.net/)
 
 See the INSTALL file for general installation instructions.
 
index ccc95f955c2712f56422b684978ecad0bec4e8e8..36f2e97a814fc698e46a7e9a05030538fe800e51 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,9 +20,9 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
+
 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
 dnl
@@ -63,7 +63,7 @@ dnl
 dnl See the "Since" comment for each macro you use to see what version
 dnl of the macros you require.
 m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29])
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
     [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
 ])dnl PKG_PREREQ
@@ -164,7 +164,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
 pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
 
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -174,11 +174,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.])
 
 if test $pkg_failed = yes; then
-       AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-        else 
+        else
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
@@ -195,7 +195,7 @@ installed software in a non-standard prefix.
 _PKG_TEXT])[]dnl
         ])
 elif test $pkg_failed = untried; then
-       AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
        m4_default([$4], [AC_MSG_FAILURE(
 [The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -750,7 +750,7 @@ AC_DEFUN([AM_XGETTEXT_OPTION],
   XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
 ])
 
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -765,7 +765,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.16.1], [],
+m4_if([$1], [1.16.2], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -781,12 +781,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.16.1])dnl
+[AM_AUTOMAKE_VERSION([1.16.2])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+# Copyright (C) 2011-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -848,7 +848,7 @@ AC_SUBST([AR])dnl
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -900,7 +900,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -931,7 +931,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1122,7 +1122,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1161,7 +1161,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   done
   if test $am_rc -ne 0; then
     AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
-    for automatic dependency tracking.  Try re-running configure with the
+    for automatic dependency tracking.  If GNU make was not used, consider
+    re-running the configure script with MAKE="gmake" (or whatever is
+    necessary).  You can also try re-running configure with the
     '--disable-dependency-tracking' option to at least be able to build
     the package (albeit without support for automatic dependency tracking).])
   fi
@@ -1188,7 +1190,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1385,7 +1387,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1406,7 +1408,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2018 Free Software Foundation, Inc.
+# Copyright (C) 2003-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1428,7 +1430,7 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1463,7 +1465,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1506,7 +1508,7 @@ AC_SUBST([am__quote])])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1545,7 +1547,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1574,7 +1576,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1621,7 +1623,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1640,7 +1642,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1721,7 +1723,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1781,7 +1783,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1809,7 +1811,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2018 Free Software Foundation, Inc.
+# Copyright (C) 2006-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1828,7 +1830,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2018 Free Software Foundation, Inc.
+# Copyright (C) 2004-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 0baa4f607608a8e07a0e2be8ae0735791a9b1a68..1e9388e2ae3aee28242b809b701bd9bc8bdc97e6 100755 (executable)
@@ -2,9 +2,9 @@
 # Wrapper for Microsoft lib.exe
 
 me=ar-lib
-scriptversion=2012-03-01.08; # UTC
+scriptversion=2019-07-04.01; # UTC
 
-# Copyright (C) 2010-2018 Free Software Foundation, Inc.
+# Copyright (C) 2010-2020 Free Software Foundation, Inc.
 # Written by Peter Rosin <peda@lysator.liu.se>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -53,7 +53,7 @@ func_file_conv ()
          MINGW*)
            file_conv=mingw
            ;;
-         CYGWIN*)
+         CYGWIN* | MSYS*)
            file_conv=cygwin
            ;;
          *)
@@ -65,7 +65,7 @@ func_file_conv ()
        mingw)
          file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
          ;;
-       cygwin)
+       cygwin | msys)
          file=`cygpath -m "$file" || echo "$file"`
          ;;
        wine)
@@ -224,10 +224,11 @@ elif test -n "$extract"; then
       esac
     done
   else
-    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
-    do
-      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
-    done
+    $AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \
+      | while read member
+        do
+          $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
+        done
   fi
 
 elif test -n "$quick$replace"; then
index 99e50524b3bade179355469777b4d664bcd5c964..23fcba011321a3a2b3b94a8abb13201dbdd1faa5 100755 (executable)
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -53,7 +53,7 @@ func_file_conv ()
          MINGW*)
            file_conv=mingw
            ;;
-         CYGWIN*)
+         CYGWIN* | MSYS*)
            file_conv=cygwin
            ;;
          *)
@@ -67,7 +67,7 @@ func_file_conv ()
        mingw/*)
          file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
          ;;
-       cygwin/*)
+       cygwin/* | msys/*)
          file=`cygpath -m "$file" || echo "$file"`
          ;;
        wine/*)
index 625aeb11897a2221d5cda1d55b6866d61d21f660..8d0eaad250fc1ea8f3728338c1b016596cedfc60 100755 (executable)
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
index b8521a482e2b79eaf6fbd7db6725d78091b47299..89dba1e075cd371918d8ffa3bfd2051bbab0b370 100755 (executable)
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+# Copyright (C) 2011-2020 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
index 357fb2f2694b099793a6faf5579634504dc1f7ab..018e4e6c74a6a68fbe973683818fc438fb0f599a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libpipeline 1.5.2.
+# Generated by GNU Autoconf 2.69 for libpipeline 1.5.3.
 #
 # Report bugs to <cjwatson@debian.org>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libpipeline'
 PACKAGE_TARNAME='libpipeline'
-PACKAGE_VERSION='1.5.2'
-PACKAGE_STRING='libpipeline 1.5.2'
+PACKAGE_VERSION='1.5.3'
+PACKAGE_STRING='libpipeline 1.5.3'
 PACKAGE_BUGREPORT='cjwatson@debian.org'
 PACKAGE_URL=''
 
@@ -2064,7 +2064,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libpipeline 1.5.2 to adapt to many kinds of systems.
+\`configure' configures libpipeline 1.5.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2135,7 +2135,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libpipeline 1.5.2:";;
+     short | recursive ) echo "Configuration of libpipeline 1.5.3:";;
    esac
   cat <<\_ACEOF
 
@@ -2266,7 +2266,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libpipeline configure 1.5.2
+libpipeline configure 1.5.3
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2975,7 +2975,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libpipeline $as_me 1.5.2, which was
+It was created by libpipeline $as_me 1.5.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3865,7 +3865,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libpipeline'
- VERSION='1.5.2'
+ VERSION='1.5.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16032,19 +16032,19 @@ $as_echo "no" >&6; }
 fi
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CHECK" >&5
-$as_echo_n "checking for CHECK... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for check >= 0.9.10" >&5
+$as_echo_n "checking for check >= 0.9.10... " >&6; }
 
 if test -n "$CHECK_CFLAGS"; then
     pkg_cv_CHECK_CFLAGS="$CHECK_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.4\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "check >= 0.9.4") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.10\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "check >= 0.9.10") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_CHECK_CFLAGS=`$PKG_CONFIG --cflags "check >= 0.9.4" 2>/dev/null`
+  pkg_cv_CHECK_CFLAGS=`$PKG_CONFIG --cflags "check >= 0.9.10" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -16056,12 +16056,12 @@ if test -n "$CHECK_LIBS"; then
     pkg_cv_CHECK_LIBS="$CHECK_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.4\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "check >= 0.9.4") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.10\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "check >= 0.9.10") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_CHECK_LIBS=`$PKG_CONFIG --libs "check >= 0.9.4" 2>/dev/null`
+  pkg_cv_CHECK_LIBS=`$PKG_CONFIG --libs "check >= 0.9.10" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -16073,7 +16073,7 @@ fi
 
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -16082,16 +16082,16 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               CHECK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "check >= 0.9.4" 2>&1`
+               CHECK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "check >= 0.9.10" 2>&1`
         else
-               CHECK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "check >= 0.9.4" 2>&1`
+               CHECK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "check >= 0.9.10" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$CHECK_PKG_ERRORS" >&5
 
        run_tests=no
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
        run_tests=no
 else
@@ -28664,7 +28664,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libpipeline $as_me 1.5.2, which was
+This file was extended by libpipeline $as_me 1.5.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -28730,7 +28730,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libpipeline config.status 1.5.2
+libpipeline config.status 1.5.3
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -29828,7 +29828,9 @@ $as_echo X/"$am_mf" |
     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "Something went wrong bootstrapping makefile fragments
-    for automatic dependency tracking.  Try re-running configure with the
+    for automatic dependency tracking.  If GNU make was not used, consider
+    re-running the configure script with MAKE=\"gmake\" (or whatever is
+    necessary).  You can also try re-running configure with the
     '--disable-dependency-tracking' option to at least be able to build
     the package (albeit without support for automatic dependency tracking).
 See \`config.log' for more details" "$LINENO" 5; }
index 2ea49c68571a66d462105e0d532f787f35366e2b..c4188ad993599b5683d8f00d78c9f81d2e7c525a 100644 (file)
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
 m4_pattern_forbid([^PIPELINE_])
 
 # Initialise and check we're in the correct directory.
-AC_INIT([libpipeline], [1.5.2], [cjwatson@debian.org])
+AC_INIT([libpipeline], [1.5.3], [cjwatson@debian.org])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
 AM_MAINTAINER_MODE
@@ -55,7 +55,7 @@ AC_PROG_LN_S
 AM_PROG_AR
 LT_INIT([disable-static])
 AC_DEFINE_UNQUOTED([SHELL], ["$SHELL"], [A POSIX shell interpreter.])
-PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [run_tests=yes], [run_tests=no])
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.10], [run_tests=yes], [run_tests=no])
 AM_CONDITIONAL([RUN_TESTS], [test "x$run_tests" = xyes])
 
 # Check for various header files and associated libraries.
index d7b9af651a400e6136694ca1b340eecfe0e9351b..1af1c4dd2c0c8328235488847fd3d63e388865d9 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 8c58f9d118d945c527351b261cdfea9d9980d716..222ef0645cb736f487c9b3027117cd5544cd8a09 100644 (file)
@@ -40,7 +40,7 @@ libpipeline_la_LIBADD = ../gl/lib/libgnu.la $(LTLIBOBJS)
 libpipeline_la_LDFLAGS = \
        -export-symbols-regex '^(pipecmd|pipeline)_' \
        -no-undefined \
-       -version-info 6:2:5
+       -version-info 6:3:5
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libpipeline.pc
index 05480dddbceb546114d05410cd9faef102398cae..cc72977ddc7890a84ccf9c1be4fbfba8f6829d67 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1124,7 +1124,7 @@ libpipeline_la_LIBADD = ../gl/lib/libgnu.la $(LTLIBOBJS)
 libpipeline_la_LDFLAGS = \
        -export-symbols-regex '^(pipecmd|pipeline)_' \
        -no-undefined \
-       -version-info 6:2:5
+       -version-info 6:3:5
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libpipeline.pc
index 31c12270cb2720f7f282f9ac43bb174e999d7e89..04dced7c0a2a9eee236e1191a602fb0ab77bd54c 100644 (file)
@@ -375,8 +375,13 @@ static void passthrough (void *data _GL_UNUSED)
 {
        for (;;) {
                char buffer[4096];
-               int r = safe_read (STDIN_FILENO, buffer, 4096);
-               if (r <= 0)
+               size_t r = safe_read (STDIN_FILENO, buffer, 4096);
+               if (r == SAFE_READ_ERROR)
+                       /* TODO: Function commands have no way to signal
+                        * errors.
+                        */
+                       break;
+               if (r == 0)
                        break;
                if (full_write (STDOUT_FILENO, buffer,
                                (size_t) r) < (size_t) r)
@@ -2043,7 +2048,7 @@ void pipeline_pump (pipeline *p, ...)
                for (i = 0; i < argc; ++i) {
                        const char *block;
                        size_t peek_size;
-                       ssize_t w;
+                       size_t w;
                        size_t minpos;
 
                        if (!pieces[i]->source || pieces[i]->infd == -1)
@@ -2072,7 +2077,7 @@ void pipeline_pump (pipeline *p, ...)
                                w = safe_write (pieces[i]->infd,
                                                block + pos[i],
                                                peek_size - pos[i]);
-                               if (w >= 0)
+                               if (w != SAFE_WRITE_ERROR)
                                        break;
                                if (errno == EAGAIN) {
                                        w = 0;
@@ -2170,7 +2175,7 @@ static const char *get_block (pipeline *p, size_t *len, int peek)
        size_t readstart = 0, retstart = 0;
        size_t space = p->bufmax;
        size_t toread = *len;
-       ssize_t r;
+       size_t r;
 
        if (p->buffer && p->peek_offset) {
                if (p->peek_offset >= toread) {
@@ -2204,7 +2209,7 @@ static const char *get_block (pipeline *p, size_t *len, int peek)
 
        assert (p->outfd != -1);
        r = safe_read (p->outfd, p->buffer + readstart, toread);
-       if (r == -1)
+       if (r == SAFE_READ_ERROR)
                return NULL;
        p->buflen = readstart + r;
        if (peek)
index 9730d4067b8aa85d01c2c28b0e202d8cd783b062..f8ee67d515bf5794f1e3403ba3d7cc7648d16595 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 6a75fb35dbd0c733e2f2b9d6989a9910b539ec1f..6ba479800411c89f9fcc2f6f1bb92519d4d8dfdd 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 4dd912adf4d6c5768176b458ce0e5e5617abbc51..f64997f1be6e6d85d82af8283e10b7251bfff557 100644 (file)
@@ -37,9 +37,9 @@ START_TEST (test_argstr_trivial)
        pipecmd *cmd;
 
        cmd = pipecmd_new_argstr ("/bin/simple");
-       fail_unless (!strcmp (cmd->name, "/bin/simple"));
-       fail_unless (cmd->u.process.argc == 1);
-       fail_unless (!strcmp (cmd->u.process.argv[0], "simple"));
+       ck_assert_str_eq (cmd->name, "/bin/simple");
+       ck_assert_int_eq (cmd->u.process.argc, 1);
+       ck_assert_str_eq (cmd->u.process.argv[0], "simple");
        pipecmd_free (cmd);
 }
 END_TEST
@@ -50,11 +50,11 @@ START_TEST (test_argstr_torture)
 
        cmd = pipecmd_new_argstr
                ("x' \\' \\$\\'\\\"\" \\'\\$\\\"\\\\ \" \\\"");
-       fail_unless (!strcmp (cmd->name, "x \\"));
-       fail_unless (cmd->u.process.argc == 3);
-       fail_unless (!strcmp (cmd->u.process.argv[0], "x \\"));
-       fail_unless (!strcmp (cmd->u.process.argv[1], "$'\" \\'$\"\\ "));
-       fail_unless (!strcmp (cmd->u.process.argv[2], "\""));
+       ck_assert_str_eq (cmd->name, "x \\");
+       ck_assert_int_eq (cmd->u.process.argc, 3);
+       ck_assert_str_eq (cmd->u.process.argv[0], "x \\");
+       ck_assert_str_eq (cmd->u.process.argv[1], "$'\" \\'$\"\\ ");
+       ck_assert_str_eq (cmd->u.process.argv[2], "\"");
        pipecmd_free (cmd);
 }
 END_TEST
@@ -64,10 +64,10 @@ START_TEST (test_argstr_exec)
        pipecmd *cmd;
 
        cmd = pipecmd_new_argstr ("exec /bin/foo bar");
-       fail_unless (!strcmp (cmd->name, "/bin/foo"));
-       fail_unless (cmd->u.process.argc == 2);
-       fail_unless (!strcmp (cmd->u.process.argv[0], "foo"));
-       fail_unless (!strcmp (cmd->u.process.argv[1], "bar"));
+       ck_assert_str_eq (cmd->name, "/bin/foo");
+       ck_assert_int_eq (cmd->u.process.argc, 2);
+       ck_assert_str_eq (cmd->u.process.argv[0], "foo");
+       ck_assert_str_eq (cmd->u.process.argv[1], "bar");
        pipecmd_free (cmd);
 }
 END_TEST
index 245933ce0d79df3eb89c87a981f261c278b888dd..01a0e01d21c5f7e78f1987e168268b2d8d10be59 100644 (file)
@@ -42,9 +42,9 @@ START_TEST (test_basic_status)
        pipeline *p;
 
        p = pipeline_new_command_args ("true", (void *) 0);
-       fail_unless (pipeline_run (p) == 0, "true did not return 0");
+       ck_assert_msg (pipeline_run (p) == 0, "true did not return 0");
        p = pipeline_new_command_args ("false", (void *) 0);
-       fail_if (pipeline_run (p) == 0, "false returned 0");
+       ck_assert_msg (pipeline_run (p) != 0, "false returned 0");
 }
 END_TEST
 
@@ -55,27 +55,27 @@ START_TEST (test_basic_args)
 
        p = pipeline_new_command_args ("echo", "foo", (void *) 0);
        pipeline_want_out (p, -1);
-       fail_unless (pipecmd_get_nargs (pipeline_get_command (p, 0)) == 2,
-                    "Number of arguments != 2");
+       ck_assert_msg (pipecmd_get_nargs (pipeline_get_command (p, 0)) == 2,
+                      "Number of arguments != 2");
        pipeline_start (p);
        line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "foo\n"),
-                    "Incorrect output from 'echo foo': '%s'", line);
-       fail_unless (pipeline_wait (p) == 0, "'echo foo' did not return 0");
+       ck_assert_ptr_ne (line, NULL);
+       ck_assert_msg (!strcmp (line, "foo\n"),
+                      "Incorrect output from 'echo foo': '%s'", line);
+       ck_assert_msg (pipeline_wait (p) == 0, "'echo foo' did not return 0");
        pipeline_free (p);
 
        p = pipeline_new_command_args ("echo", "foo", "bar", (void *) 0);
        pipeline_want_out (p, -1);
-       fail_unless (pipecmd_get_nargs (pipeline_get_command (p, 0)) == 3,
-                    "Number of arguments != 3");
+       ck_assert_msg (pipecmd_get_nargs (pipeline_get_command (p, 0)) == 3,
+                      "Number of arguments != 3");
        pipeline_start (p);
        line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "foo bar\n"),
-                    "Incorrect output from 'echo foo bar': '%s'", line);
-       fail_unless (pipeline_wait (p) == 0,
-                    "'echo foo bar' did not return 0");
+       ck_assert_ptr_ne (line, NULL);
+       ck_assert_msg (!strcmp (line, "foo bar\n"),
+                      "Incorrect output from 'echo foo bar': '%s'", line);
+       ck_assert_msg (pipeline_wait (p) == 0,
+                      "'echo foo bar' did not return 0");
        pipeline_free (p);
 }
 END_TEST
@@ -91,12 +91,12 @@ START_TEST (test_basic_pipeline)
        pipeline_want_out (p, -1);
        pipeline_start (p);
        line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "bar\n"),
-                    "Incorrect output from 'echo foo | sed -e s/foo/bar/': "
-                    "'%s'", line);
-       fail_unless (pipeline_wait (p) == 0,
-                    "'echo foo | sed -e 's/foo/bar/' did not return 0");
+       ck_assert_ptr_ne (line, NULL);
+       ck_assert_msg (!strcmp (line, "bar\n"),
+                      "Incorrect output from 'echo foo | sed -e s/foo/bar/': "
+                      "'%s'", line);
+       ck_assert_msg (pipeline_wait (p) == 0,
+                      "'echo foo | sed -e 's/foo/bar/' did not return 0");
        pipeline_free (p);
 }
 END_TEST
@@ -112,11 +112,11 @@ START_TEST (test_basic_wait_all)
        pipeline_command_args (p, SHELL, "-c", "exit 3", (void *) 0);
        pipeline_command_args (p, "true", (void *) 0);
        pipeline_start (p);
-       fail_unless (pipeline_wait_all (p, &statuses, &n_statuses) == 127);
-       fail_unless (n_statuses == 3);
-       fail_unless (statuses[0] == 2 * 256);
-       fail_unless (statuses[1] == 3 * 256);
-       fail_unless (statuses[2] == 0);
+       ck_assert_int_eq (pipeline_wait_all (p, &statuses, &n_statuses), 127);
+       ck_assert_int_eq (n_statuses, 3);
+       ck_assert_int_eq (statuses[0], 2 * 256);
+       ck_assert_int_eq (statuses[1], 3 * 256);
+       ck_assert_int_eq (statuses[2], 0);
        pipeline_free (p);
        free (statuses);
 }
@@ -128,24 +128,20 @@ START_TEST (test_basic_setenv)
 
        p = pipeline_new_command_args (SHELL, "-c", "exit $TEST1", (void *) 0);
        pipecmd_setenv (pipeline_get_command (p, 0), "TEST1", "10");
-       fail_unless (pipeline_run (p) == 10, "TEST1 not set properly");
+       ck_assert_int_eq (pipeline_run (p), 10);
 }
 END_TEST
 
 START_TEST (test_basic_unsetenv)
 {
        pipeline *p;
-       const char *line;
 
        setenv ("TEST2", "foo", 1);
 
        p = pipeline_new_command_args (SHELL, "-c", "echo $TEST2", (void *) 0);
        pipeline_want_out (p, -1);
        pipeline_start (p);
-       line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "foo\n"),
-                    "control returned '%s', expected 'foo\n'", line);
+       ck_assert_str_eq (pipeline_readline (p), "foo\n");
        pipeline_wait (p);
        pipeline_free (p);
 
@@ -153,10 +149,7 @@ START_TEST (test_basic_unsetenv)
        pipecmd_unsetenv (pipeline_get_command (p, 0), "TEST2");
        pipeline_want_out (p, -1);
        pipeline_start (p);
-       line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "\n"),
-                    "unsetenv failed: returned '%s', expected '\n'", line);
+       ck_assert_str_eq (pipeline_readline (p), "\n");
        pipeline_wait (p);
        pipeline_free (p);
 }
@@ -165,7 +158,6 @@ END_TEST
 START_TEST (test_basic_clearenv)
 {
        pipeline *p, *p2;
-       const char *line1, *line2;
 
        setenv ("TEST3", "foo", 1);
 
@@ -173,60 +165,28 @@ START_TEST (test_basic_clearenv)
                                       (void *) 0);
        pipeline_want_out (p, -1);
        pipeline_start (p);
-       line1 = pipeline_readline (p);
-       fail_unless (line1 != NULL);
-       fail_unless (!strcmp (line1, "foo\n"),
-                    "control returned first line '%s', expected 'foo\n'",
-                    line1);
-       line2 = pipeline_readline (p);
-       fail_unless (line2 != NULL);
-       fail_unless (!strcmp (line2, "\n"),
-                    "control returned second line '%s', expected '\n'",
-                    line2);
+       ck_assert_str_eq (pipeline_readline (p), "foo\n");
+       ck_assert_str_eq (pipeline_readline (p), "\n");
        pipeline_wait (p);
 
        pipecmd_clearenv (pipeline_get_command (p, 0));
        pipeline_start (p);
-       line1 = pipeline_readline (p);
-       fail_unless (line1 != NULL);
-       fail_unless (!strcmp (line1, "\n"),
-                    "clearenv failed: returned first line '%s', expected '\n'",
-                    line1);
-       line2 = pipeline_readline (p);
-       fail_unless (line2 != NULL);
-       fail_unless (!strcmp (line2, "\n"),
-                    "clearenv returned second line '%s', expected '\n'",
-                    line2);
+       ck_assert_str_eq (pipeline_readline (p), "\n");
+       ck_assert_str_eq (pipeline_readline (p), "\n");
        pipeline_wait (p);
 
        pipecmd_setenv (pipeline_get_command (p, 0), "TEST4", "bar");
        pipeline_start (p);
-       line1 = pipeline_readline (p);
-       fail_unless (line1 != NULL);
-       fail_unless (!strcmp (line1, "\n"),
-                    "clearenv+setenv failed: returned first line '%s', expected '\n'",
-                    line1);
-       line2 = pipeline_readline (p);
-       fail_unless (line2 != NULL);
-       fail_unless (!strcmp (line2, "bar\n"),
-                    "clearenv+setenv returned second line '%s', expected 'bar\n'",
-                    line2);
+       ck_assert_str_eq (pipeline_readline (p), "\n");
+       ck_assert_str_eq (pipeline_readline (p), "bar\n");
        pipeline_wait (p);
 
        p2 = pipeline_new ();
        pipeline_command (p2, pipecmd_dup (pipeline_get_command (p, 0)));
        pipeline_want_out (p2, -1);
        pipeline_start (p2);
-       line1 = pipeline_readline (p2);
-       fail_unless (line1 != NULL);
-       fail_unless (!strcmp (line1, "\n"),
-                    "clearenv+setenv+dup failed: returned first line '%s', expected '\n'",
-                    line1);
-       line2 = pipeline_readline (p2);
-       fail_unless (line2 != NULL);
-       fail_unless (!strcmp (line2, "bar\n"),
-                    "clearenv+setenv+dup returned second line '%s', expected 'bar\n'",
-                    line2);
+       ck_assert_str_eq (pipeline_readline (p2), "\n");
+       ck_assert_str_eq (pipeline_readline (p2), "bar\n");
        pipeline_wait (p2);
        pipeline_free (p2);
        pipeline_free (p);
@@ -245,16 +205,14 @@ START_TEST (test_basic_chdir)
        pipeline_want_out (p, -1);
        pipeline_start (p);
        raw_line = xstrdup (pipeline_readline (p));
-       fail_unless (raw_line != NULL);
+       ck_assert_ptr_ne (raw_line, NULL);
        line = xstrdup (raw_line);
        end = line + strlen (line);
        if (end > line && *(end - 1) == '\n')
                *(end - 1) = '\0';
        child_base = base_name (line);
        expected_base = base_name (temp_dir);
-       fail_unless (!strcmp (child_base, expected_base),
-                    "child base name was '%s', expected '%s'",
-                    child_base, expected_base);
+       ck_assert_str_eq (child_base, expected_base);
        free (expected_base);
        free (child_base);
        free (line);
@@ -273,21 +231,19 @@ START_TEST (test_basic_fchdir)
 
        p = pipeline_new_command_args ("pwd", (void *) 0);
        temp_dir_fd = open (temp_dir, O_RDONLY | O_DIRECTORY);
-       fail_unless (temp_dir_fd >= 0);
+       ck_assert_int_ge (temp_dir_fd, 0);
        pipecmd_fchdir (pipeline_get_command (p, 0), temp_dir_fd);
        pipeline_want_out (p, -1);
        pipeline_start (p);
        raw_line = xstrdup (pipeline_readline (p));
-       fail_unless (raw_line != NULL);
+       ck_assert_ptr_ne (raw_line, NULL);
        line = xstrdup (raw_line);
        end = line + strlen (line);
        if (end > line && *(end - 1) == '\n')
                *(end - 1) = '\0';
        child_base = base_name (line);
        expected_base = base_name (temp_dir);
-       fail_unless (!strcmp (child_base, expected_base),
-                    "child base name was '%s', expected '%s'",
-                    child_base, expected_base);
+       ck_assert_str_eq (child_base, expected_base);
        free (expected_base);
        free (child_base);
        free (line);
@@ -311,7 +267,7 @@ START_TEST (test_basic_pre_exec)
 
        p = pipeline_new_command_args (SHELL, "-c", "exit $TEST1", (void *) 0);
        pipecmd_pre_exec (pipeline_get_command (p, 0), pre_exec, NULL, NULL);
-       fail_unless (pipeline_run (p) == 10, "TEST1 not set properly");
+       ck_assert_msg (pipeline_run (p) == 10, "TEST1 not set properly");
 }
 END_TEST
 
@@ -319,7 +275,6 @@ START_TEST (test_basic_sequence)
 {
        pipeline *p;
        pipecmd *cmd1, *cmd2, *cmd3, *seq;
-       const char *line;
 
        p = pipeline_new ();
        cmd1 = pipecmd_new_args ("echo", "foo", (void *) 0);
@@ -330,9 +285,7 @@ START_TEST (test_basic_sequence)
        pipeline_command_args (p, "xargs", (void *) 0);
        pipeline_want_out (p, -1);
        pipeline_start (p);
-       line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "foo bar baz\n"));
+       ck_assert_str_eq (pipeline_readline (p), "foo bar baz\n");
        pipeline_wait (p);
        pipeline_free (p);
 }
index 00563b85a18967d3bf1cd23f45aab812134f49b5..3407e52952496905e39a402307bf557386b394ed 100644 (file)
@@ -72,11 +72,11 @@ START_TEST (test_exec_process)
                        return;
                }
 
-               fail_unless (WIFEXITED (status));
+               ck_assert_int_ne (WIFEXITED (status), 0);
                if (i < 2)
-                       fail_unless (WEXITSTATUS (status) == i);
+                       ck_assert_int_eq (WEXITSTATUS (status), i);
                else
-                       fail_if (WEXITSTATUS (status) == 0);
+                       ck_assert_int_ne (WEXITSTATUS (status), 0);
 
                pipecmd_free (cmd);
        }
@@ -115,8 +115,8 @@ START_TEST (test_exec_function)
                        return;
                }
 
-               fail_unless (WIFEXITED (status));
-               fail_unless (WEXITSTATUS (status) == i);
+               ck_assert_int_ne (WIFEXITED (status), 0);
+               ck_assert_int_eq (WEXITSTATUS (status), i);
 
                pipecmd_free (cmd);
        }
index 28264750138c412b836f9ef4f5fc61b9f1c3899c..68f0ae6f5eddd9c554b1b635c342b106dbd2a31e 100644 (file)
@@ -43,14 +43,14 @@ START_TEST (test_inspect_command)
 
        cmd = pipecmd_new ("foo");
        str = pipecmd_tostring (cmd);
-       fail_unless (!strcmp (str, "foo"));
+       ck_assert_str_eq (str, "foo");
        free (str);
        pipecmd_free (cmd);
 
        cmd = pipecmd_new_args ("foo", "bar", "baz quux", (void *) 0);
        str = pipecmd_tostring (cmd);
        /* TODO: not ideal representation of commands with metacharacters */
-       fail_unless (!strcmp (str, "foo bar baz quux"));
+       ck_assert_str_eq (str, "foo bar baz quux");
        free (str);
        pipecmd_free (cmd);
 }
@@ -64,10 +64,10 @@ START_TEST (test_inspect_pipeline)
        p = pipeline_new ();
        pipeline_command_args (p, "foo", "bar", (void *) 0);
        pipeline_command_args (p, "grep", "baz", "quux", (void *) 0);
-       fail_unless (pipeline_get_ncommands (p) == 2);
+       ck_assert_int_eq (pipeline_get_ncommands (p), 2);
        pipecmd_setenv (pipeline_get_command (p, 1), "KEY", "value");
        str = pipeline_tostring (p);
-       fail_unless (!strcmp (str, "foo bar | KEY=value grep baz quux"));
+       ck_assert_str_eq (str, "foo bar | KEY=value grep baz quux");
        free (str);
        pipeline_free (p);
 }
@@ -103,9 +103,9 @@ START_TEST (test_inspect_pid)
        pipeline_want_out (p, -1);
        pipeline_start (p);
        line = pipeline_readline (p);
-       fail_unless (line != NULL);
+       ck_assert_ptr_ne (line, NULL);
        pid = (pid_t) atol (line);
-       fail_unless (pid == pipeline_get_pid (p, 0), "pids match");
+       ck_assert_msg (pid == pipeline_get_pid (p, 0), "pids match");
        /* Note that this test may hang if pipeline_get_pid does not work.
         * We might be able to fix this by calling setsid at the start of
         * the test and then killing the process group, but I'm not sure if
@@ -119,8 +119,8 @@ START_TEST (test_inspect_pid)
                kill (pid, SIGTERM);
                status = pipeline_wait (p);
 
-               fail_unless (status == 128 + SIGTERM,
-                            "pid_helper did not indicate SIGTERM");
+               ck_assert_msg (status == 128 + SIGTERM,
+                              "pid_helper did not indicate SIGTERM");
        }
        pipeline_free (p);
 }
index 0cb7c3e397a154870a393a545f60ee68d375c8a6..62f39f322a75b6f3ff781b95cffabb3ea3f70242 100644 (file)
 
 const char *program_name = "pump";
 
-static void fail_unless_files_equal (const char *left, const char *right)
+static void assert_files_equal (const char *left, const char *right)
 {
        pipeline *diff = pipeline_new_command_args
                ("diff", "-u", left, right, (void *) 0);
-       int ret = pipeline_run (diff);
-       fail_unless (ret == 0);
+       ck_assert_int_eq (pipeline_run (diff), 0);
 }
 
 START_TEST (test_pump_connect_attaches_correctly)
@@ -52,17 +51,17 @@ START_TEST (test_pump_connect_attaches_correctly)
        pipeline *three = pipeline_new ();
 
        pipeline_connect (one, two, three, (void *) 0);
-       fail_unless (one->redirect_out == REDIRECT_FD);
-       fail_unless (one->want_out < 0);
-       fail_unless (one->want_outfile == NULL);
-       fail_unless (two->source == one);
-       fail_unless (two->redirect_in == REDIRECT_FD);
-       fail_unless (two->want_in < 0);
-       fail_unless (two->want_infile == NULL);
-       fail_unless (three->source == one);
-       fail_unless (three->redirect_in == REDIRECT_FD);
-       fail_unless (three->want_in < 0);
-       fail_unless (three->want_infile == NULL);
+       ck_assert_int_eq (one->redirect_out, REDIRECT_FD);
+       ck_assert_int_le (one->want_out, 0);
+       ck_assert_ptr_eq (one->want_outfile, NULL);
+       ck_assert_ptr_eq (two->source, one);
+       ck_assert_int_eq (two->redirect_in, REDIRECT_FD);
+       ck_assert_int_le (two->want_in, 0);
+       ck_assert_ptr_eq (two->want_infile, NULL);
+       ck_assert_ptr_eq (three->source, one);
+       ck_assert_int_eq (three->redirect_in, REDIRECT_FD);
+       ck_assert_int_le (three->want_in, 0);
+       ck_assert_ptr_eq (three->want_infile, NULL);
 
        pipeline_free (three);
        pipeline_free (two);
@@ -100,12 +99,10 @@ START_TEST (test_pump_tee)
        pipeline_want_outfile (sink_function, function_outfile);
        pipeline_connect (source, sink_process, sink_function, (void *) 0);
        pipeline_pump (source, sink_process, sink_function, (void *) 0);
-       fail_unless (pipeline_wait (source) == 0, "source did not return 0");
-       fail_unless (pipeline_wait (sink_process) == 0,
-                    "process sink did not return 0");
-       fail_unless (pipeline_wait (sink_function) == 0,
-                    "function sink did not return 0");
-       fail_unless_files_equal (process_outfile, function_outfile);
+       ck_assert_int_eq (pipeline_wait (source), 0);
+       ck_assert_int_eq (pipeline_wait (sink_process), 0);
+       ck_assert_int_eq (pipeline_wait (sink_function), 0);
+       assert_files_equal (process_outfile, function_outfile);
 
        free (function_outfile);
        free (process_outfile);
index 79186d3c7d55201d9fa4db8928021d770f9fc3f2..85327ed555c674db19453217c67b0453a159d234 100644 (file)
@@ -83,8 +83,7 @@ START_TEST (test_read_long_line)
                }
        }
        pipeline_free (p);
-       fail_unless (!strcmp (read_result, expected_output),
-               "Returned string doesn't match the input.");
+       ck_assert_str_eq (read_result, expected_output);
 
        free (read_result);
        read_result = NULL;
@@ -103,8 +102,7 @@ START_TEST (test_read_long_line)
                }
        }
        pipeline_free (p);
-       fail_unless (!strcmp (read_result, expected_output),
-               "Returned string doesn't match the input.");
+       ck_assert_str_eq (read_result, expected_output);
 
        free (testfile);
        free (expected_output);
@@ -132,7 +130,6 @@ START_TEST (test_read_readline_slow)
 {
        pipeline *p;
        pipecmd *cmd;
-       const char *line;
 
        p = pipeline_new ();
        cmd = pipecmd_new_function ("slow_line_helper", slow_line_helper,
@@ -140,8 +137,7 @@ START_TEST (test_read_readline_slow)
        pipeline_command (p, cmd);
        pipeline_want_out (p, -1);
        pipeline_start (p);
-       line = pipeline_readline (p);
-       fail_unless (!strcmp (line, "a line\n"));
+       ck_assert_str_eq (pipeline_readline (p), "a line\n");
        pipeline_free (p);
 }
 END_TEST
index d01a4623521416424edff0c05640844a513dbcfe..940b086638932e2b7ab5581f7a61d64e0859bc7e 100644 (file)
@@ -42,7 +42,6 @@ START_TEST (test_redirect_files)
        int fd;
        FILE *fh;
        pipeline *p;
-       const char *line;
 
        fd = mkstemp (template);
        if (fd < 0) {
@@ -57,9 +56,7 @@ START_TEST (test_redirect_files)
        pipeline_want_infile (p, template);
        pipeline_want_out (p, -1);
        pipeline_start (p);
-       line = pipeline_readline (p);
-       fail_unless (line != NULL);
-       fail_unless (!strcmp (line, "test data out\n"));
+       ck_assert_str_eq (pipeline_readline (p), "test data out\n");
 
        fclose (fh);
        unlink (template);
@@ -79,11 +76,11 @@ START_TEST (test_redirect_outfile)
        p = pipeline_new_command_args ("echo", "test", (void *) 0);
        outfile = xasprintf ("%s/test", temp_dir);
        pipeline_want_outfile (p, outfile);
-       fail_unless (pipeline_run (p) == 0);
+       ck_assert_int_eq (pipeline_run (p), 0);
        fh = fopen (outfile, "r");
-       fail_unless (fh != NULL);
-       fail_unless (fgets (line, 5, fh) != NULL);
-       fail_unless (!strcmp (line, "test"));
+       ck_assert_ptr_ne (fh, NULL);
+       ck_assert_ptr_ne (fgets (line, 5, fh), NULL);
+       ck_assert_str_eq (line, "test");
 
        fclose (fh);
        free (outfile);