diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7513e07a65307d48bf759bf3cf6ac39a1b839b91..838384a722044e572a520979aded0110dc5dc419 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,7 +42,7 @@ check-commits: - .fdo.ci-fairy stage: prep script: - - ci-fairy check-commits --signed-off-by --junit-xml=results.xml + - ci-fairy check-commits --junit-xml=results.xml except: - master@xorg/app/bitmap variables: diff --git a/Makefile.am b/Makefile.am index 4e44ade776078abc5b05155a7550e8abde239faa..f6f411fdb61581a99a1c163cbaa11c7282718fe8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,19 +51,19 @@ EXTRA_DIST = autogen.sh README.md bitmapdir = $(includedir)/X11/bitmaps dist_bitmap_DATA = \ - Dashes \ - Down \ - Excl \ - FlipHoriz \ - FlipVert \ - Fold \ - Left \ - Right \ - RotateLeft \ - RotateRight \ - Stipple \ - Term \ - Up + bitmaps/Dashes \ + bitmaps/Down \ + bitmaps/Excl \ + bitmaps/FlipHoriz \ + bitmaps/FlipVert \ + bitmaps/Fold \ + bitmaps/Left \ + bitmaps/Right \ + bitmaps/RotateLeft \ + bitmaps/RotateRight \ + bitmaps/Stipple \ + bitmaps/Term \ + bitmaps/Up # App default files (*.ad) DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults @@ -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/atobm.c b/atobm.c index 44fdcdafb2cfab4cbeeb9d2ad04f0402e809eb51..7d25906b46f9f4aa95bebba8ab03439d176a33d6 100644 --- a/atobm.c +++ b/atobm.c @@ -238,12 +238,12 @@ doit (FILE *fp, newline++; } - if (newline == cp + 1) continue; + if (newline == cp) continue; *newline = '\0'; len = strlen (cp); - if (width == 0) { + if (head == NULL) { width = len; padded = ((width & 7) != 0); bytes_per_scanline = (len + 7) / 8; @@ -257,7 +257,7 @@ doit (FILE *fp, fprintf (stderr, "%s: line %d is %d characters wide instead of %d\n", ProgramName, lineno, len, width); - return; + goto bail; } if (slist->used + 1 >= slist->allocated) { @@ -266,8 +266,7 @@ doit (FILE *fp, if (!slist) { fprintf (stderr, "%s: unable to allocate scan list\n", ProgramName); - free(old); - return; + goto bail; } } @@ -308,5 +307,11 @@ doit (FILE *fp, } } printf (" };\n"); + bail: + for (slist = head; slist != NULL; slist = head) { + head = slist->next; + free(slist->scanlines); + free(slist); + } return; } diff --git a/Dashes b/bitmaps/Dashes similarity index 100% rename from Dashes rename to bitmaps/Dashes diff --git a/Down b/bitmaps/Down similarity index 100% rename from Down rename to bitmaps/Down diff --git a/Excl b/bitmaps/Excl similarity index 100% rename from Excl rename to bitmaps/Excl diff --git a/FlipHoriz b/bitmaps/FlipHoriz similarity index 100% rename from FlipHoriz rename to bitmaps/FlipHoriz diff --git a/FlipVert b/bitmaps/FlipVert similarity index 100% rename from FlipVert rename to bitmaps/FlipVert diff --git a/Fold b/bitmaps/Fold similarity index 100% rename from Fold rename to bitmaps/Fold diff --git a/Left b/bitmaps/Left similarity index 100% rename from Left rename to bitmaps/Left diff --git a/Right b/bitmaps/Right similarity index 100% rename from Right rename to bitmaps/Right diff --git a/RotateLeft b/bitmaps/RotateLeft similarity index 100% rename from RotateLeft rename to bitmaps/RotateLeft diff --git a/RotateRight b/bitmaps/RotateRight similarity index 100% rename from RotateRight rename to bitmaps/RotateRight diff --git a/Stipple b/bitmaps/Stipple similarity index 100% rename from Stipple rename to bitmaps/Stipple diff --git a/Term b/bitmaps/Term similarity index 100% rename from Term rename to bitmaps/Term diff --git a/Up b/bitmaps/Up similarity index 100% rename from Up rename to bitmaps/Up diff --git a/configure.ac b/configure.ac index ee246bf4386ceea39f838f180c24b0f8d74517b8..50b57dc06b1237dd6c556e40aa8c0ced968b53a0 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 0000000000000000000000000000000000000000..788ac2eb2139cc8980004db0bbcb22b33c0cdcd7 --- /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