From fa7241ac10bf9b47c3d20d557fdca0aa0a468484 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 9 Apr 2022 15:42:10 -0700 Subject: test: add round-trip-test for atobm & bmtoa Signed-off-by: Alan Coopersmith --- Makefile.am | 2 ++ configure.ac | 1 + test/round-trip-test.in | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 test/round-trip-test.in diff --git a/Makefile.am b/Makefile.am index 5b2a060..f6f411f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -74,6 +74,8 @@ dist_appdefault_DATA = \ app-defaults/Bitmap-nocase \ app-defaults/Bitmap +TESTS = test/round-trip-test + MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL diff --git a/configure.ac b/configure.ac index ee246bf..50b57dc 100644 --- a/configure.ac +++ b/configure.ac @@ -68,4 +68,5 @@ AC_SUBST(appdefaultdir) AC_CONFIG_FILES([Makefile man/Makefile]) +AC_CONFIG_FILES([test/round-trip-test], [chmod +x test/round-trip-test]) AC_OUTPUT diff --git a/test/round-trip-test.in b/test/round-trip-test.in new file mode 100644 index 0000000..788ac2e --- /dev/null +++ b/test/round-trip-test.in @@ -0,0 +1,27 @@ +#! /bin/sh + +prefix="@prefix@" +builddir="@builddir@" +BITMAP_SRC="${srcdir}/bitmaps" +BITMAP_INC="@includedir@/X11/bitmaps" + +error_count=0 +for bm in ${BITMAP_SRC}/* ${BITMAP_INC}/* ; do + if [ -f ${bm} ] ; then + echo ${bm} + bmbase="$(basename ${bm})" + ${builddir}/bmtoa "${bm}" > bma.out + error_count=$(( error_count + $? )) + ${builddir}/atobm -name "${bmbase}" bma.out > abm.out + error_count=$(( error_count + $? )) + ${builddir}/bmtoa abm.out > bma.out.2 + error_count=$(( error_count + $? )) + cmp bma.out bma.out.2 + if [[ $? != 0 ]] ; then + exit 1 + fi + rm abm.out bma.out bma.out.2 + fi +done + +exit $error_count -- cgit v1.2.3