From 3361135e97b138b67fcf47ebdbdc5f2d61ebfb2b Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 6 Apr 2022 02:21:46 +0000 Subject: [PATCH] changed some test cases to use the TAP protocol --- hawk/Makefile.in | 41 +++--- hawk/ac/ar-lib | 17 ++- hawk/ac/compile | 6 +- hawk/ac/depcomp | 2 +- hawk/ac/install-sh | 13 +- hawk/ac/missing | 2 +- hawk/ac/test-driver | 2 +- hawk/aclocal.m4 | 50 ++++--- hawk/bin/Makefile.in | 5 +- hawk/configure | 20 +-- hawk/configure.ac | 2 + hawk/lib/Makefile.in | 9 +- hawk/mod/Makefile.in | 5 +- hawk/samples/Makefile.in | 5 +- hawk/t/Makefile.am | 2 +- hawk/t/Makefile.in | 7 +- hawk/t/t-001.c | 81 ++++++----- hawk/t/t-002.c | 19 ++- hawk/t/t-003.c | 11 +- hawk/t/t-004.c | 15 +- hawk/t/t-005.c | 67 ++++----- hawk/t/t-006.c | 17 ++- hawk/t/t.h | 21 --- hawk/t/tap.h | 291 +++++++++++++++++++++++++++++++++++++++ hawk/tools/Makefile.in | 5 +- 25 files changed, 471 insertions(+), 244 deletions(-) delete mode 100644 hawk/t/t.h create mode 100644 hawk/t/tap.h diff --git a/hawk/Makefile.in b/hawk/Makefile.in index 57fce4b2..f4259c15 100644 --- a/hawk/Makefile.in +++ b/hawk/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -169,9 +169,9 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \ $(top_srcdir)/ac/compile $(top_srcdir)/ac/config.guess \ $(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \ $(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \ - $(top_srcdir)/pkgs/hawk.spec.in ac/ar-lib ac/compile \ - ac/config.guess ac/config.sub ac/depcomp ac/install-sh \ - ac/ltmain.sh ac/missing + $(top_srcdir)/ac/tap-driver.sh $(top_srcdir)/pkgs/hawk.spec.in \ + ac/ar-lib ac/compile ac/config.guess ac/config.sub ac/depcomp \ + ac/install-sh ac/ltmain.sh ac/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -353,7 +353,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -604,10 +603,6 @@ 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 @@ -650,8 +645,6 @@ 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) @@ -829,18 +822,18 @@ 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-lzip dist-shar dist-tarZ \ - dist-xz dist-zip dist-zstd distcheck distclean \ - distclean-generic distclean-libtool distclean-local \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-libtool distclean-local distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am .PRECIOUS: Makefile diff --git a/hawk/ac/ar-lib b/hawk/ac/ar-lib index 1e9388e2..0baa4f60 100755 --- a/hawk/ac/ar-lib +++ b/hawk/ac/ar-lib @@ -2,9 +2,9 @@ # Wrapper for Microsoft lib.exe me=ar-lib -scriptversion=2019-07-04.01; # UTC +scriptversion=2012-03-01.08; # UTC -# Copyright (C) 2010-2020 Free Software Foundation, Inc. +# Copyright (C) 2010-2018 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN* | MSYS*) + CYGWIN*) file_conv=cygwin ;; *) @@ -65,7 +65,7 @@ func_file_conv () mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin | msys) + cygwin) file=`cygpath -m "$file" || echo "$file"` ;; wine) @@ -224,11 +224,10 @@ elif test -n "$extract"; then esac done else - $AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \ - | while read member - do - $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? - done + $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member + do + $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? + done fi elif test -n "$quick$replace"; then diff --git a/hawk/ac/compile b/hawk/ac/compile index 23fcba01..99e50524 100755 --- a/hawk/ac/compile +++ b/hawk/ac/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN* | MSYS*) + CYGWIN*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/* | msys/*) + cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/hawk/ac/depcomp b/hawk/ac/depcomp index 6b391623..65cbf709 100755 --- a/hawk/ac/depcomp +++ b/hawk/ac/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 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 diff --git a/hawk/ac/install-sh b/hawk/ac/install-sh index 20d8b2ea..8175c640 100755 --- a/hawk/ac/install-sh +++ b/hawk/ac/install-sh @@ -451,18 +451,7 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && - { test -z "$stripcmd" || { - # Create $dsttmp read-write so that cp doesn't create it read-only, - # which would cause strip to fail. - if test -z "$doit"; then - : >"$dsttmp" # No need to fork-exec 'touch'. - else - $doit touch "$dsttmp" - fi - } - } && - $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # diff --git a/hawk/ac/missing b/hawk/ac/missing index 8d0eaad2..625aeb11 100755 --- a/hawk/ac/missing +++ b/hawk/ac/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/hawk/ac/test-driver b/hawk/ac/test-driver index 89dba1e0..b8521a48 100755 --- a/hawk/ac/test-driver +++ b/hawk/ac/test-driver @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 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 diff --git a/hawk/aclocal.m4 b/hawk/aclocal.m4 index 6cac91f3..31af506d 100644 --- a/hawk/aclocal.m4 +++ b/hawk/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.2 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ 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'.])]) -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,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.2], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +51,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.2])dnl +[AM_AUTOMAKE_VERSION([1.16.1])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-2020 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ AC_SUBST([AR])dnl # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -201,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -392,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -431,9 +431,7 @@ 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. 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 + for automatic dependency tracking. 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 @@ -460,7 +458,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -657,7 +655,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-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -678,7 +676,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -699,7 +697,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -742,7 +740,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -781,7 +779,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -810,7 +808,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -857,7 +855,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -876,7 +874,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -957,7 +955,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1017,7 +1015,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1045,7 +1043,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2020 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1064,7 +1062,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2020 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/hawk/bin/Makefile.in b/hawk/bin/Makefile.in index 7c30563c..83bec953 100644 --- a/hawk/bin/Makefile.in +++ b/hawk/bin/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -329,7 +329,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/hawk/configure b/hawk/configure index ef1bdf0a..32674068 100755 --- a/hawk/configure +++ b/hawk/configure @@ -786,7 +786,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -889,7 +888,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1142,15 +1140,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1288,7 +1277,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1441,7 +1430,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -4573,6 +4561,8 @@ unknown) esac + + # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -26116,9 +26106,7 @@ $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. 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 + for automatic dependency tracking. 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; } diff --git a/hawk/configure.ac b/hawk/configure.ac index b12c7b7d..5825be32 100644 --- a/hawk/configure.ac +++ b/hawk/configure.ac @@ -13,6 +13,8 @@ dnl initialize automake AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects foreign]) AM_PROG_AR +AC_REQUIRE_AUX_FILE([tap-driver.sh]) + dnl enable silent rules if automake supports them. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])]) dnl m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/hawk/lib/Makefile.in b/hawk/lib/Makefile.in index 4398049b..ce848513 100644 --- a/hawk/lib/Makefile.in +++ b/hawk/lib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -394,8 +394,8 @@ am__pkginclude_HEADERS_DIST = hawk.h hawk-arr.h hawk-chr.h hawk-cmn.h \ hawk-sed.h hawk-std.h hawk-tre.h hawk-unpack.h hawk-xma.h \ Hawk.hpp HawkStd.hpp HEADERS = $(pkginclude_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ - hawk-cfg.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)hawk-cfg.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. @@ -566,7 +566,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/hawk/mod/Makefile.in b/hawk/mod/Makefile.in index 112da930..6b989b06 100644 --- a/hawk/mod/Makefile.in +++ b/hawk/mod/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -416,7 +416,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/hawk/samples/Makefile.in b/hawk/samples/Makefile.in index 0a0e2ebc..e2515d70 100644 --- a/hawk/samples/Makefile.in +++ b/hawk/samples/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -351,7 +351,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/hawk/t/Makefile.am b/hawk/t/Makefile.am index f52871cb..2fa6416f 100644 --- a/hawk/t/Makefile.am +++ b/hawk/t/Makefile.am @@ -54,7 +54,7 @@ t_006_CFLAGS = $(CFLAGS_COMMON) t_006_LDFLAGS = $(LDFLAGS_COMMON) t_006_LDADD = $(LIBADD_COMMON) - +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/ac/tap-driver.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) TEST_EXTENSIONS = .hawk diff --git a/hawk/t/Makefile.in b/hawk/t/Makefile.in index 25638227..25f54476 100644 --- a/hawk/t/Makefile.in +++ b/hawk/t/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -397,7 +397,6 @@ am__set_TESTS_bases = \ RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log -LOG_DRIVER = $(SHELL) $(top_srcdir)/ac/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ @@ -557,7 +556,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -609,6 +607,7 @@ t_006_CPPFLAGS = $(CPPFLAGS_COMMON) t_006_CFLAGS = $(CFLAGS_COMMON) t_006_LDFLAGS = $(LDFLAGS_COMMON) t_006_LDADD = $(LIBADD_COMMON) +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/ac/tap-driver.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) TEST_EXTENSIONS = .hawk HAWK_LOG_COMPILER = ../bin/hawk diff --git a/hawk/t/t-001.c b/hawk/t/t-001.c index 3522a1b5..5a3bf553 100644 --- a/hawk/t/t-001.c +++ b/hawk/t/t-001.c @@ -2,10 +2,12 @@ #include #include -#include "t.h" +#include "tap.h" int main () { + no_plan(); + { union { hawk_uint16_t u16; @@ -15,20 +17,22 @@ int main () x.arr[0] = 0x11; x.arr[1] = 0x22; + /* printf("x.u16 = 0x%04x\n", x.u16); printf("htole16(x.u16) = 0x%04x\n", hawk_htole16(x.u16)); printf("htobe16(x.u16) = 0x%04x\n", hawk_htobe16(x.u16)); + */ - T_ASSERT1 (x.u16 != hawk_htole16(x.u16) || x.u16 != hawk_htobe16(x.u16), "u16 endian conversion #0"); - T_ASSERT1 (x.u16 == hawk_le16toh(hawk_htole16(x.u16)), "u16 endian conversion #1"); - T_ASSERT1 (x.u16 == hawk_be16toh(hawk_htobe16(x.u16)), "u16 endian conversion #2"); - T_ASSERT1 (x.u16 == hawk_ntoh16(hawk_hton16(x.u16)), "u16 endian conversion #3"); + OK (x.u16 != hawk_htole16(x.u16) || x.u16 != hawk_htobe16(x.u16), "u16 endian conversion #0"); + OK (x.u16 == hawk_le16toh(hawk_htole16(x.u16)), "u16 endian conversion #1"); + OK (x.u16 == hawk_be16toh(hawk_htobe16(x.u16)), "u16 endian conversion #2"); + OK (x.u16 == hawk_ntoh16(hawk_hton16(x.u16)), "u16 endian conversion #3"); #define X_CONST (0x1122) - T_ASSERT1 (X_CONST != HAWK_CONST_HTOLE16(X_CONST) || X_CONST != HAWK_CONST_HTOBE16(X_CONST), "u16 constant endian conversion #0"); - T_ASSERT1 (X_CONST == HAWK_CONST_LE16TOH(HAWK_CONST_HTOLE16(X_CONST)), "u16 constant endian conversion #1"); - T_ASSERT1 (X_CONST == HAWK_CONST_BE16TOH(HAWK_CONST_HTOBE16(X_CONST)), "u16 constant endian conversion #2"); - T_ASSERT1 (X_CONST == HAWK_CONST_NTOH16(HAWK_CONST_HTON16(X_CONST)), "u16 constant endian conversion #3"); + OK (X_CONST != HAWK_CONST_HTOLE16(X_CONST) || X_CONST != HAWK_CONST_HTOBE16(X_CONST), "u16 constant endian conversion #0"); + OK (X_CONST == HAWK_CONST_LE16TOH(HAWK_CONST_HTOLE16(X_CONST)), "u16 constant endian conversion #1"); + OK (X_CONST == HAWK_CONST_BE16TOH(HAWK_CONST_HTOBE16(X_CONST)), "u16 constant endian conversion #2"); + OK (X_CONST == HAWK_CONST_NTOH16(HAWK_CONST_HTON16(X_CONST)), "u16 constant endian conversion #3"); #undef X_CONST } @@ -44,20 +48,22 @@ int main () x.arr[2] = 0x33; x.arr[3] = 0x44; + /* printf("x.u32 = 0x%08x\n", (unsigned int)x.u32); printf("htole32(x.u32) = 0x%08x\n", (unsigned int)hawk_htole32(x.u32)); printf("htobe32(x.u32) = 0x%08x\n", (unsigned int)hawk_htobe32(x.u32)); + */ - T_ASSERT1 (x.u32 != hawk_htole32(x.u32) || x.u32 != hawk_htobe32(x.u32), "u32 endian conversion #0"); - T_ASSERT1 (x.u32 == hawk_le32toh(hawk_htole32(x.u32)), "u32 endian conversion #1"); - T_ASSERT1 (x.u32 == hawk_be32toh(hawk_htobe32(x.u32)), "u32 endian conversion #2"); - T_ASSERT1 (x.u32 == hawk_ntoh32(hawk_hton32(x.u32)), "u32 endian conversion #3"); + OK (x.u32 != hawk_htole32(x.u32) || x.u32 != hawk_htobe32(x.u32), "u32 endian conversion #0"); + OK (x.u32 == hawk_le32toh(hawk_htole32(x.u32)), "u32 endian conversion #1"); + OK (x.u32 == hawk_be32toh(hawk_htobe32(x.u32)), "u32 endian conversion #2"); + OK (x.u32 == hawk_ntoh32(hawk_hton32(x.u32)), "u32 endian conversion #3"); #define X_CONST (0x11223344) - T_ASSERT1 (X_CONST != HAWK_CONST_HTOLE32(X_CONST) || X_CONST != HAWK_CONST_HTOBE32(X_CONST), "u32 constant endian conversion #0"); - T_ASSERT1 (X_CONST == HAWK_CONST_LE32TOH(HAWK_CONST_HTOLE32(X_CONST)), "u32 constant endian conversion #1"); - T_ASSERT1 (X_CONST == HAWK_CONST_BE32TOH(HAWK_CONST_HTOBE32(X_CONST)), "u32 constant endian conversion #2"); - T_ASSERT1 (X_CONST == HAWK_CONST_NTOH32(HAWK_CONST_HTON32(X_CONST)), "u32 constant endian conversion #3"); + OK (X_CONST != HAWK_CONST_HTOLE32(X_CONST) || X_CONST != HAWK_CONST_HTOBE32(X_CONST), "u32 constant endian conversion #0"); + OK (X_CONST == HAWK_CONST_LE32TOH(HAWK_CONST_HTOLE32(X_CONST)), "u32 constant endian conversion #1"); + OK (X_CONST == HAWK_CONST_BE32TOH(HAWK_CONST_HTOBE32(X_CONST)), "u32 constant endian conversion #2"); + OK (X_CONST == HAWK_CONST_NTOH32(HAWK_CONST_HTON32(X_CONST)), "u32 constant endian conversion #3"); #undef X_CONST } @@ -77,20 +83,22 @@ int main () x.arr[6] = 0x77; x.arr[7] = 0x88; + /* printf("x.u64 = 0x%016llx\n", (unsigned long long)x.u64); printf("htole64(x.u64) = 0x%016llx\n", (unsigned long long)hawk_htole64(x.u64)); printf("htobe64(x.u64) = 0x%016llx\n", (unsigned long long)hawk_htobe64(x.u64)); + */ - T_ASSERT1 (x.u64 != hawk_htole64(x.u64) || x.u64 != hawk_htobe64(x.u64), "u64 endian conversion #0"); - T_ASSERT1 (x.u64 == hawk_le64toh(hawk_htole64(x.u64)), "u64 endian conversion #1"); - T_ASSERT1 (x.u64 == hawk_be64toh(hawk_htobe64(x.u64)), "u64 endian conversion #2"); - T_ASSERT1 (x.u64 == hawk_ntoh64(hawk_hton64(x.u64)), "u64 endian conversion #3"); + OK (x.u64 != hawk_htole64(x.u64) || x.u64 != hawk_htobe64(x.u64), "u64 endian conversion #0"); + OK (x.u64 == hawk_le64toh(hawk_htole64(x.u64)), "u64 endian conversion #1"); + OK (x.u64 == hawk_be64toh(hawk_htobe64(x.u64)), "u64 endian conversion #2"); + OK (x.u64 == hawk_ntoh64(hawk_hton64(x.u64)), "u64 endian conversion #3"); #define X_CONST (((hawk_uint64_t)0x11223344 << 32) | (hawk_uint64_t)0x55667788) - T_ASSERT1 (X_CONST != HAWK_CONST_HTOLE64(X_CONST) || X_CONST != HAWK_CONST_HTOBE64(X_CONST), "u64 constant endian conversion #0"); - T_ASSERT1 (X_CONST == HAWK_CONST_LE64TOH(HAWK_CONST_HTOLE64(X_CONST)), "u64 constant endian conversion #1"); - T_ASSERT1 (X_CONST == HAWK_CONST_BE64TOH(HAWK_CONST_HTOBE64(X_CONST)), "u64 constant endian conversion #2"); - T_ASSERT1 (X_CONST == HAWK_CONST_NTOH64(HAWK_CONST_HTON64(X_CONST)), "u64 constant endian conversion #3"); + OK (X_CONST != HAWK_CONST_HTOLE64(X_CONST) || X_CONST != HAWK_CONST_HTOBE64(X_CONST), "u64 constant endian conversion #0"); + OK (X_CONST == HAWK_CONST_LE64TOH(HAWK_CONST_HTOLE64(X_CONST)), "u64 constant endian conversion #1"); + OK (X_CONST == HAWK_CONST_BE64TOH(HAWK_CONST_HTOBE64(X_CONST)), "u64 constant endian conversion #2"); + OK (X_CONST == HAWK_CONST_NTOH64(HAWK_CONST_HTON64(X_CONST)), "u64 constant endian conversion #3"); #undef X_CONST } #endif @@ -120,6 +128,7 @@ int main () x.arr[14] = 0xff; x.arr[15] = 0xfa; + /* printf("x.u128 = 0x%016llx%016llx\n", (unsigned long long)(hawk_uint64_t)(x.u128 >> 64), (unsigned long long)(hawk_uint64_t)(x.u128 >> 0)); tmp = hawk_htole128(x.u128); @@ -127,23 +136,21 @@ int main () tmp = hawk_htobe128(x.u128); printf("htobe128(tmp) = 0x%016llx%016llx\n", (unsigned long long)(hawk_uint64_t)(tmp >> 64), (unsigned long long)(hawk_uint64_t)(tmp >> 0)); + */ - T_ASSERT1 (x.u128 != hawk_htole128(x.u128) || x.u128 != hawk_htobe128(x.u128), "u128 endian conversion #0"); - T_ASSERT1 (x.u128 == hawk_le128toh(hawk_htole128(x.u128)), "u128 endian conversion #1"); - T_ASSERT1 (x.u128 == hawk_be128toh(hawk_htobe128(x.u128)), "u128 endian conversion #2"); - T_ASSERT1 (x.u128 == hawk_ntoh128(hawk_hton128(x.u128)), "u128 endian conversion #3"); + OK (x.u128 != hawk_htole128(x.u128) || x.u128 != hawk_htobe128(x.u128), "u128 endian conversion #0"); + OK (x.u128 == hawk_le128toh(hawk_htole128(x.u128)), "u128 endian conversion #1"); + OK (x.u128 == hawk_be128toh(hawk_htobe128(x.u128)), "u128 endian conversion #2"); + OK (x.u128 == hawk_ntoh128(hawk_hton128(x.u128)), "u128 endian conversion #3"); #define X_CONST (((hawk_uint128_t)0x11223344 << 96) | ((hawk_uint128_t)0x55667788 << 64) | ((hawk_uint128_t)0x99aabbcc << 32) | ((hawk_uint128_t)0xddeefffa)) - T_ASSERT1 (X_CONST != HAWK_CONST_HTOLE128(X_CONST) || X_CONST != HAWK_CONST_HTOBE128(X_CONST), "u128 constant endian conversion #0"); - T_ASSERT1 (X_CONST == HAWK_CONST_LE128TOH(HAWK_CONST_HTOLE128(X_CONST)), "u128 constant endian conversion #1"); - T_ASSERT1 (X_CONST == HAWK_CONST_BE128TOH(HAWK_CONST_HTOBE128(X_CONST)), "u128 constant endian conversion #2"); - T_ASSERT1 (X_CONST == HAWK_CONST_NTOH128(HAWK_CONST_HTON128(X_CONST)), "u128 constant endian conversion #3"); + OK (X_CONST != HAWK_CONST_HTOLE128(X_CONST) || X_CONST != HAWK_CONST_HTOBE128(X_CONST), "u128 constant endian conversion #0"); + OK (X_CONST == HAWK_CONST_LE128TOH(HAWK_CONST_HTOLE128(X_CONST)), "u128 constant endian conversion #1"); + OK (X_CONST == HAWK_CONST_BE128TOH(HAWK_CONST_HTOBE128(X_CONST)), "u128 constant endian conversion #2"); + OK (X_CONST == HAWK_CONST_NTOH128(HAWK_CONST_HTON128(X_CONST)), "u128 constant endian conversion #3"); #undef X_CONST } #endif - return 0; - -oops: - return -1; + return exit_status(); } diff --git a/hawk/t/t-002.c b/hawk/t/t-002.c index 21171507..9a0817f2 100644 --- a/hawk/t/t-002.c +++ b/hawk/t/t-002.c @@ -2,20 +2,22 @@ #include #include -#include "t.h" +#include "tap.h" int main () { int i, j; hawk_oow_t v; - printf ("QSE_OOW_BITS => %d, sizeof(hawk_oow_t)=%d\n", (int)HAWK_OOW_BITS, (int)sizeof(hawk_oow_t)); + no_plan (); + + /*printf ("QSE_OOW_BITS => %d, sizeof(hawk_oow_t)=%d\n", (int)HAWK_OOW_BITS, (int)sizeof(hawk_oow_t));*/ for (i = 0; i < HAWK_OOW_BITS; i++) { v = ((hawk_oow_t)1 << i); j = hawk_get_pos_of_msb_set_pow2(v); - printf ("msb(pow2) %d %d ==> %llx\n", i, j, (long long int)v); - T_ASSERT1 (i == j, "msb(pow2) position tester"); + /*printf ("msb(pow2) %d %d ==> %llx\n", i, j, (long long int)v);*/ + OK (i == j, "msb(pow2) position tester"); } for (i = 0; i < HAWK_OOW_BITS; i++) @@ -23,13 +25,10 @@ int main () v = ((hawk_oow_t)1 << i); v |= 1; j = hawk_get_pos_of_msb_set(v); - printf ("msb %d %d ==> %llx\n", i, j, (long long int)v); - T_ASSERT1 (i == j, "msb position tester"); + /*printf ("msb %d %d ==> %llx\n", i, j, (long long int)v);*/ + OK (i == j, "msb position tester"); } - return 0; - -oops: - return -1; + return exit_status(); } diff --git a/hawk/t/t-003.c b/hawk/t/t-003.c index ec1e0f6e..57dcb152 100644 --- a/hawk/t/t-003.c +++ b/hawk/t/t-003.c @@ -4,7 +4,7 @@ #include #include #include -#include "t.h" +#include "tap.h" static int put_bchars (hawk_fmtout_t* fmtout, const hawk_bch_t* c, hawk_oow_t len) { @@ -56,6 +56,8 @@ int main () hawk_uch_t x[] = { 'A', L'\uBB33', L'\uBB34', L'\uBB35', 'Q', '\0' }; hawk_ooi_t cnt; + no_plan (); + setlocale (LC_ALL, NULL); cnt = bfmt_out ("[%s %d %020X %ls %s %w %.*lk]\n", "test", 10, 0x1232, x, "code", x, HAWK_SIZEOF_UCH_T * 3, x); @@ -69,10 +71,7 @@ int main () #else # error UNSUPPORTED UCH SIZE #endif - T_ASSERT1 (cnt == EXPECTED_LEN, "bfmt_out test #1"); + OK (cnt == EXPECTED_LEN, "bfmt_out test #1"); - return 0; - -oops: - return -1; + return exit_status(); } diff --git a/hawk/t/t-004.c b/hawk/t/t-004.c index bf4ee4ae..4d9a1cc7 100644 --- a/hawk/t/t-004.c +++ b/hawk/t/t-004.c @@ -1,7 +1,7 @@ #include #include #include -#include "t.h" +#include "tap.h" int main () { @@ -10,6 +10,7 @@ int main () #if 0 hawk_uch_t ufmt2[] = { '%', '0', '5', 'd', ' ', '%', '-', '9', 'h', 's', ' ', '%','O','\0' }; #endif + no_plan (); hawk = hawk_openstd(0, HAWK_NULL); if (!hawk) @@ -19,23 +20,19 @@ int main () } hawk_seterrbfmt (hawk, HAWK_NULL, HAWK_EINVAL, "%d %ld %s %hs", 10, 20L, "hawk", "hawk"); - T_ASSERT1 (hawk_comp_oocstr_bcstr(hawk_geterrmsg(hawk), "10 20 hawk hawk", 0) == 0, "hawk seterrbfmt #1"); + OK (hawk_comp_oocstr_bcstr(hawk_geterrmsg(hawk), "10 20 hawk hawk", 0) == 0, "hawk seterrbfmt #1"); hawk_logbfmt (hawk, HAWK_LOG_STDERR, "[%js]\n", hawk_geterrmsg(hawk)); hawk_seterrufmt (hawk, HAWK_NULL, HAWK_EINVAL, ufmt1, 9923, "hawk"); - T_ASSERT1 (hawk_comp_oocstr_bcstr(hawk_geterrmsg(hawk), "09923 hawk ", 0) == 0, "hawk seterrufmt #1"); + OK (hawk_comp_oocstr_bcstr(hawk_geterrmsg(hawk), "09923 hawk ", 0) == 0, "hawk seterrufmt #1"); hawk_logbfmt (hawk, HAWK_LOG_STDERR, "[%js]\n", hawk_geterrmsg(hawk)); #if 0 hawk_seterrufmt (hawk, HAWK_NULL, HAWK_EINVAL, ufmt2, 9923, "hawk", HAWK_SMPTR_TO_OOP(0x12345678)); - T_ASSERT1 (hawk_comp_oocstr_bcstr(hawk_geterrmsg(hawk), "09923 hawk #\\p12345678", 0) == 0, "hawk seterrufmt #1"); + OK (hawk_comp_oocstr_bcstr(hawk_geterrmsg(hawk), "09923 hawk #\\p12345678", 0) == 0, "hawk seterrufmt #1"); hawk_logbfmt (hawk, HAWK_LOG_STDERR, "[%js]\n", hawk_geterrmsg(hawk)); #endif hawk_close (hawk); - return 0; - -oops: - if (hawk) hawk_close (hawk); - return -1; + return exit_status(); } diff --git a/hawk/t/t-005.c b/hawk/t/t-005.c index d3783942..e9f6e896 100644 --- a/hawk/t/t-005.c +++ b/hawk/t/t-005.c @@ -3,7 +3,9 @@ #include #include #include -#include "t.h" +#include "tap.h" + +#define OK_X(test) OK(test, #test) static void* sys_alloc (hawk_mmgr_t* mmgr, hawk_oow_t size) { @@ -28,7 +30,7 @@ static hawk_mmgr_t sys_mmgr = HAWK_NULL }; -static int test1 (void) +static void test1 (void) { hawk_becs_t* b; hawk_gem_t g; @@ -37,25 +39,22 @@ static int test1 (void) b = hawk_becs_open(&g, 0, 5); hawk_becs_cat (b, "hello"); - T_ASSERT0 (hawk_becs_getlen(b) == 5); + OK_X (hawk_becs_getlen(b) == 5); hawk_becs_cat (b, "hello again"); - T_ASSERT0 (hawk_becs_getlen(b) == 16); + OK_X (hawk_becs_getlen(b) == 16); hawk_becs_del (b, 11, 3); - T_ASSERT0 (hawk_becs_getlen(b) == 13); - T_ASSERT0 (HAWK_BECS_CHAR(b, 12) == 'n'); - T_ASSERT0 (HAWK_BECS_CHAR(b, 13) == '\0'); + OK_X (hawk_becs_getlen(b) == 13); + OK_X (HAWK_BECS_CHAR(b, 12) == 'n'); + OK_X (HAWK_BECS_CHAR(b, 13) == '\0'); printf ("[%s]\n", HAWK_BECS_PTR(b)); hawk_becs_close (b); return 0; - -oops: - return -1; } -static int test2 (void) +static void test2 (void) { const hawk_uch_t src[8] = {'a','b','c','d','e','f','g','h'}; const hawk_uch_t sxx[6] = {'0','1','2', '\0'}; @@ -64,19 +63,16 @@ static int test2 (void) hawk_oow_t q, i; q = hawk_copy_uchars_to_ucstr(dst, HAWK_COUNTOF(dst), src, 7); - T_ASSERT0 (q == HAWK_COUNTOF(dst) - 1); - T_ASSERT0 (dst[HAWK_COUNTOF(dst) - 1] == '\0'); - for (i = 0; i < q; i++) T_ASSERT0 (dst[i] == src[i]); + OK_X (q == HAWK_COUNTOF(dst) - 1); + OK_X (dst[HAWK_COUNTOF(dst) - 1] == '\0'); + for (i = 0; i < q; i++) OK_X (dst[i] == src[i]); q = hawk_copy_ucstr_to_uchars(dst, HAWK_COUNTOF(dst), sxx); - T_ASSERT0 (q == 3); - T_ASSERT0 (dst[q] == src[q]); - for (i = 0; i < q; i++) T_ASSERT0 (dst[i] == sxx[i]); + OK_X (q == 3); + OK_X (dst[q] == src[q]); + for (i = 0; i < q; i++) OK_X (dst[i] == sxx[i]); return 0; - -oops: - return -1; } hawk_bch_t* subst (hawk_bch_t* buf, hawk_oow_t bsz, const hawk_bcs_t* ident, void* ctx) @@ -92,37 +88,34 @@ hawk_bch_t* subst (hawk_bch_t* buf, hawk_oow_t bsz, const hawk_bcs_t* ident, voi return buf; } -static int test3 (void) +static void test3 (void) { hawk_bch_t buf[512], * ptr; hawk_oow_t n; n = hawk_subst_for_bcstr_to_bcstr (buf, HAWK_COUNTOF(buf), "user=${USER},group=${GROUP}", subst, HAWK_NULL); - T_ASSERT0 (n == 21); - T_ASSERT0 (hawk_count_bcstr(buf) == 21); - T_ASSERT0 (hawk_comp_bcstr(buf, "user=sam,group=coders", 0) == 0); + OK_X (n == 21); + OK_X (hawk_count_bcstr(buf) == 21); + OK_X (hawk_comp_bcstr(buf, "user=sam,group=coders", 0) == 0); n = hawk_subst_for_bcstr_to_bcstr(HAWK_SUBST_NOBUF, 0, "USERNAME=${USER},GROUPNAME=${GROUP}", subst, HAWK_NULL); - T_ASSERT0 (n == 29); + OK_X (n == 29); ptr = malloc(n + 1); n = hawk_subst_for_bcstr_to_bcstr(ptr, n + 1, "USERNAME=${USER},GROUPNAME=${GROUP}", subst, HAWK_NULL); - T_ASSERT0 (n == 29); - T_ASSERT0 (hawk_count_bcstr(ptr) == 29); - T_ASSERT0 (hawk_comp_bcstr(ptr, "USERNAME=sam,GROUPNAME=coders", 0) == 0); + OK_X (n == 29); + OK_X (hawk_count_bcstr(ptr) == 29); + OK_X (hawk_comp_bcstr(ptr, "USERNAME=sam,GROUPNAME=coders", 0) == 0); free (ptr); return 0; - -oops: - return -1; } int main () { - if (test1() <= -1) goto oops; - if (test2() <= -1) goto oops; - if (test3() <= -1) goto oops; - return 0; + no_plan(); -oops: - return -1; + test1(); + test2(); + test3(); + + return exit_status(); } diff --git a/hawk/t/t-006.c b/hawk/t/t-006.c index a41fc5dc..c0fc638a 100644 --- a/hawk/t/t-006.c +++ b/hawk/t/t-006.c @@ -1,7 +1,7 @@ #include #include -#include "t.h" +#include "tap.h" struct @@ -110,6 +110,8 @@ int main () int i; char buf1[64], buf2[64]; + no_plan(); + for (i = 0; i < HAWK_COUNTOF(tab); i++) { sprintf (buf1, "add - index %d", i); @@ -121,17 +123,14 @@ int main () y.nsec = tab[i].ns2; hawk_add_ntime (&z, &x, &y); - T_ASSERT1 (z.sec == tab[i].add_s, buf1); - T_ASSERT1 (z.nsec == tab[i].add_ns, buf1); + OK (z.sec == tab[i].add_s, buf1); + OK (z.nsec == tab[i].add_ns, buf1); hawk_sub_ntime (&z, &x, &y); - T_ASSERT1 (z.sec == tab[i].sub_s, buf2); - T_ASSERT1 (z.nsec == tab[i].sub_ns, buf2); + OK (z.sec == tab[i].sub_s, buf2); + OK (z.nsec == tab[i].sub_ns, buf2); } - return 0; - -oops: - return -1; + return exit_status(); } diff --git a/hawk/t/t.h b/hawk/t/t.h deleted file mode 100644 index 9fb72d2c..00000000 --- a/hawk/t/t.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _HAWK_T_T_H_ -#define _HAWK_T_T_H_ - -#include - -#if defined(__STDC_VERSION__) && (__STDC_VERSION__>=199901L) -# define T_ASSERT_FAIL0() printf("FAILURE in %s:%s[%d]\n", __FILE__, __func__, (int)__LINE__) -# define T_ASSERT_FAIL1(msg1) printf("FAILURE in %s:%s[%d] - %s\n", __FILE__, __func__, (int)__LINE__, msg1) -# define T_ASSERT_FAIL2(msg1,msg2) printf("FAILURE in %s:%s[%d] - %s - %s\n", __FILE__, __func__, (int)__LINE__, msg1, msg2) -#else -# define T_ASSERT_FAIL0() printf("FAILURE in %s[%d]\n", __FILE__, (int)__LINE__) -# define T_ASSERT_FAIL1(msg1) printf("FAILURE in %s[%d] - %s\n", __FILE__, (int)__LINE__, msg1) -# define T_ASSERT_FAIL2(msg1,msg2) printf("FAILURE in %s[%d] - %s - %s\n", __FILE__, (int)__LINE__, msg1, msg2) -#endif - -#define T_ASSERT0(test) do { if (!(test)) { T_ASSERT_FAIL0(); goto oops; } } while(0) -#define T_ASSERT1(test,msg1) do { if (!(test)) { T_ASSERT_FAIL1(msg1); goto oops; } } while(0) -#define T_ASSERT2(test,msg1,msg2) do { if (!(test)) { T_ASSERT_FAIL2(msg1,msg2); goto oops; } } while(0) - - -#endif diff --git a/hawk/t/tap.h b/hawk/t/tap.h new file mode 100644 index 00000000..7f968b00 --- /dev/null +++ b/hawk/t/tap.h @@ -0,0 +1,291 @@ +/* +** tap4embedded : http://github.com/fperrad/tap4embedded +** +** Copyright (C) 2016-2017 Francois Perrad. +** +** tap4embedded is free software; you can redistribute it and/or modify it +** under the terms of the Artistic License 2.0 +*/ + +#ifndef TAP_H +#define TAP_H + +#ifndef TAP_PUTCHAR +#include +#define TAP_PUTCHAR(c) fputc((c), stdout) +#define TAP_FLUSH() fflush(stdout) +#endif + +#ifndef TAP_FLUSH +#define TAP_FLUSH() +#endif + +#if defined(__unix__) || defined(_WIN32) || defined(_WIN64) +#include +#define TAP_EXIT(n) exit(n) +#else +#define TAP_EXIT(n) +#endif + +#if defined(__bool_true_false_are_defined) || defined(__cplusplus) +#define TAP_BOOL bool +#define TAP_TRUE true +#define TAP_FALSE false +#else +#define TAP_BOOL char +#define TAP_TRUE 1 +#define TAP_FALSE 0 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern void plan(unsigned int nb); +extern void no_plan(void); +extern void skip_all(const char *reason); +extern void done_testing(unsigned int nb); +extern void bail_out(const char *reason); +extern void ok(const char *file, unsigned int line, TAP_BOOL test, const char *name); +extern void todo(const char *reason, unsigned int count); +extern void skip(const char *reason, unsigned int count); +extern void todo_skip(const char *reason); +extern void skip_rest(const char *reason); +extern void diag (const char *msg); +extern int exit_status (void); + +#define OK(test, name) ok(__FILE__, __LINE__, (test), (name)) +#define NOK(test, name) ok(__FILE__, __LINE__, !(test), (name)) +#define PASS(name) ok(__FILE__, __LINE__, TAP_TRUE, (name)) +#define FAIL(name) ok(__FILE__, __LINE__, TAP_FALSE, (name)) + +#ifndef TAP_NO_IMPL + +typedef struct { + unsigned int curr_test; + unsigned int expected_tests; + unsigned int todo_upto; + const char *todo_reason; + TAP_BOOL have_plan; + TAP_BOOL no_plan; + TAP_BOOL have_output_plan; + TAP_BOOL done_testing; + TAP_BOOL is_passing; +} tap_t; + +tap_t tap; + +void putstr(const char *msg) { + TAP_BOOL need_begin = TAP_FALSE; + for (; *msg != '\0'; msg++) { + if (need_begin) { + TAP_PUTCHAR('#'); + TAP_PUTCHAR(' '); + need_begin = TAP_FALSE; + } + TAP_PUTCHAR(*msg); + if (*msg == '\n') { + need_begin = TAP_TRUE; + } + } +} + +void putuint (unsigned int n) { + char buf[8 * sizeof(unsigned int) + 1]; + char *ptr = &buf[sizeof(buf) - 1]; + *ptr = '\0'; + do { + char c = '0' + (n % 10u); + --ptr; + *ptr = c; + n /= 10u; + } while (n != 0u); + putstr(ptr); +} + +void not_yet_plan(void) { + if (tap.have_plan) { + putstr("You tried to plan twice\n"); + TAP_FLUSH(); + TAP_EXIT(-1); + } +} + +void plan(unsigned int nb) { + not_yet_plan(); + putstr("1.."); + putuint(nb); + TAP_PUTCHAR('\n'); + tap.expected_tests = nb; + tap.have_plan = TAP_TRUE; + tap.have_output_plan = TAP_TRUE; + tap.is_passing = TAP_TRUE; +} + +void no_plan(void) { + not_yet_plan(); + tap.have_plan = TAP_TRUE; + tap.no_plan = TAP_TRUE; + tap.is_passing = TAP_TRUE; +} + +void skip_all(const char *reason) { + not_yet_plan(); + putstr("1..0 # SKIP "); + putstr(reason); + TAP_PUTCHAR('\n'); + tap.curr_test = 1u; + tap.expected_tests = 1u; + tap.have_plan = TAP_TRUE; + tap.have_output_plan = TAP_TRUE; + tap.is_passing = TAP_TRUE; + TAP_FLUSH(); +} + +void done_testing(unsigned int nb) { + if (tap.done_testing) { + putstr("done_testing() was already called\n"); + } + else { + tap.done_testing = TAP_TRUE; + if ((tap.expected_tests != nb) && (tap.expected_tests != 0u)) { + putstr("# Looks like you planned "); + putuint(tap.expected_tests); + putstr(" tests but ran "); + putuint(nb); + TAP_PUTCHAR('.'); + TAP_PUTCHAR('\n'); + } + else { + tap.expected_tests = nb; + } + if (! tap.have_output_plan) { + putstr("1.."); + putuint(nb); + TAP_PUTCHAR('\n'); + tap.have_output_plan = TAP_TRUE; + } + if ((tap.expected_tests != tap.curr_test) || (tap.curr_test == 0u)) { + tap.is_passing = TAP_FALSE; + } + putstr("# Done with tap4embedded.\n"); + } + TAP_FLUSH(); +} + +void bail_out(const char *reason) { + putstr("Bail out!"); + if (reason != NULL) { + TAP_PUTCHAR(' '); + TAP_PUTCHAR(' '); + putstr(reason); + } + TAP_PUTCHAR('\n'); + TAP_FLUSH(); + TAP_EXIT(-1); +} + +void need_plan(void) { + if (! tap.have_plan) { + putstr("You tried to run a test without a plan\n"); + TAP_FLUSH(); + TAP_EXIT(-1); + } +} + +void ok(const char *file, unsigned int line, TAP_BOOL test, const char *name) { + need_plan(); + ++tap.curr_test; + if (! test) { + putstr("not "); + } + putstr("ok "); + putuint(tap.curr_test); + if (name != NULL) { + putstr(" - "); + putstr(name); + } + if ((tap.todo_reason != NULL) && (tap.todo_upto >= tap.curr_test)) { + putstr(" # TODO # "); + putstr(tap.todo_reason); + } + TAP_PUTCHAR('\n'); + if (! test) { + putstr("# Failed"); + if (tap.todo_upto >= tap.curr_test) { + putstr(" (TODO)"); + } + else { + tap.is_passing = TAP_FALSE; + } + putstr(" test ("); + putstr(file); + putstr(" at line "); + putuint(line); + putstr(")\n"); + } +} + +void todo(const char *reason, unsigned int count) { + tap.todo_upto = tap.curr_test + count; + tap.todo_reason = reason; +} + +void skip(const char *reason, unsigned int count) { + unsigned int i; + need_plan(); + for (i = 0u; i < count; i++) { + ++tap.curr_test; + putstr("ok "); + putuint(tap.curr_test); + putstr(" - # skip"); + if (reason != NULL) { + TAP_PUTCHAR(' '); + putstr(reason); + } + TAP_PUTCHAR('\n'); + } +} + +void todo_skip(const char *reason) { + need_plan(); + ++tap.curr_test; + putstr("not ok "); + putuint(tap.curr_test); + putstr(" - # TODO & SKIP"); + if (reason != NULL) { + TAP_PUTCHAR(' '); + putstr(reason); + } + TAP_PUTCHAR('\n'); +} + +void skip_rest(const char *reason) { + skip(reason, tap.expected_tests - tap.curr_test); +} + +void diag (const char *msg) { + TAP_PUTCHAR('#'); + TAP_PUTCHAR(' '); + putstr(msg); + TAP_PUTCHAR('\n'); +} + +int exit_status (void) { + if (! tap.done_testing) { + done_testing(tap.curr_test); + } +#if defined(EXIT_SUCCESS) && defined(EXIT_FAILURE) + return tap.is_passing ? EXIT_SUCCESS : EXIT_FAILURE; +#else + return tap.is_passing ? 0 : -1; +#endif +} + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/hawk/tools/Makefile.in b/hawk/tools/Makefile.in index 0dad1bfe..d6d3f2f4 100644 --- a/hawk/tools/Makefile.in +++ b/hawk/tools/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -328,7 +328,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@