kn@ informed me offlist that archivers/zstd tests fail when run with
ports_privsep. Diving into this revealed 3 issues:

1. some tests fail because of a warning from xz/lzma when run with
   ports_privsep, e.g.:

       xz: tmp.xz: Cannot set the file group: Operation not permitted
       gmake[1]: *** [Makefile:307: zstd-playTests] Error 2

   This is fixed by ignoring warnings by xz/lzma (-Q flag). This issue
   was unnoticed as it is not seen when running 'make test' as a regular
   user. Solution has been discussed with upstream.

2. some tests use 'head -c', which is not supported by OpenBSD. kn@
   suggested using 'dd'. This issue was unnoticed as the specific tests
   expected garbled input, which it received.

3. the third one is funny as I'm pretty sure this wasn't an issue before
   (I upgrade my machine this morning to the most recent snapshot).
   A test fails with:

       zstd: --list does not support reading from standard input
       gmake[1]: *** [Makefile:307: zstd-playTests] Error 1
       in ===>  zstd --list/-l single frame tests

   Adding set -x and set +x around that block, shows:

       ../programs/zstd tmp1 tmp2 tmp3
       ../programs/zstd -l tmp1.zst tmp2.zst tmp3.zst

   Running the specific commands on the cli work as advertised. Fix is
   unexpected: replacing TEST_TARGET by something in do-test. Comparing
   output of `make -n _internal-test' shows a different directory in the
   start and a bunch of variables (not) being passed. Nothing exciting
   that explains the described behaviour.

--- do-test     Sat Jun 30 20:57:09 2018
+++ test_target Sat Jun 30 20:53:03 2018
@@ -31,5 +31,5 @@ cd /tmp/ports/pobj/zstd-1.3.5/zstd-1.3.5 && exec  /usr
 : /tmp/ports/pobj/zstd-1.3.5 /tmp/ports/pobj/zstd-1.3.5/.check-wrkdir_stamp 
/tmp/ports/pobj/zstd-1.3.5/.extract_done /tmp/ports/pobj/zstd-1.3.5/.patch_done 
/tmp/ports/pobj/zstd-1.3.5/.configure_done  
/tmp/ports/pobj/zstd-1.3.5/fake-amd64/.install_started 
/tmp/ports/pobj/zstd-1.3.5/.build_done /tmp/ports/pobj/zstd-1.3.5/.test_done  
/tmp/ports/packages/amd64/all/zstd-1.3.5.tgz 
/tmp/ports/packages/amd64/ftp/zstd-1.3.5.tgz 
/tmp/ports/packages/amd64/cdrom/zstd-1.3.5.tgz 
/tmp/ports/packages/amd64/cache/zstd-1.3.5.tgz  
/tmp/ports/pobj/zstd-1.3.5/.distpatch_done 
/tmp/ports/pobj/zstd-1.3.5/.prepatch_done 
/tmp/ports/pobj/zstd-1.3.5/fake-amd64/.fake_done  
/tmp/ports/pobj/zstd-1.3.5/.check-wrkdir_stamp  
/tmp/ports/pobj/zstd-1.3.5/.extract_started 
/tmp/ports/pobj/zstd-1.3.5/.dep-devel-gmake     
/home/code/ports/update/amd64/zstd-1.3.5  
/tmp/ports/pobj/zstd-1.3.5/.dep-archivers-lz4 
/tmp/ports/pobj/zstd-1.3.5/.dep-archivers-xz 
/tmp/ports/pobj/zstd-1.3.5/.dep-archivers-lz4 
/tmp/ports/pobj/zstd-1.3.5/.dep-archivers-xz  
/tmp/ports/pobj/zstd-1.3.5/.buildwantlibs 
/tmp/ports/pobj/zstd-1.3.5/.runwantlibs- /tmp/ports/pobj/zstd-1.3.5/.spec-c 
/tmp/ports/pobj/zstd-1.3.5/.spec-lz4 /tmp/ports/pobj/zstd-1.3.5/.spec-lzma 
/tmp/ports/pobj/zstd-1.3.5/.spec-pthread /tmp/ports/pobj/zstd-1.3.5/.spec-z 
/tmp/ports/pobj/zstd-1.3.5/.spec-c /tmp/ports/pobj/zstd-1.3.5/.spec-lz4 
/tmp/ports/pobj/zstd-1.3.5/.spec-lzma /tmp/ports/pobj/zstd-1.3.5/.spec-pthread 
/tmp/ports/pobj/zstd-1.3.5/.spec-z 
/tmp/ports/pobj/zstd-1.3.5/zstd-1.3.5/_build/runtime_params 
/tmp/ports/pobj/zstd-1.3.5/zstd-1.3.5/.ninja_log 
 touch /tmp/ports/pobj/zstd-1.3.5/.build_done
 echo "===>  Regression tests for zstd-1.3.5"
-cd /home/code/ports/archivers/zstd && exec 3>&1 && exit `exec 4>&1 1>&3;  
(exec; set +e; PKGPATH=archivers/zstd  make do-test;  echo $? >&4) 2>&1 |  tee 
/tmp/ports/pobj/zstd-1.3.5/test.log`
+cd /tmp/ports/pobj/zstd-1.3.5/zstd-1.3.5 && exec 3>&1 && exit `exec 4>&1 1>&3; 
 (exec; set +e;  /usr/bin/env -i CC="cc"  CFLAGS="-O2 -pipe  "  
CPPFLAGS="-I/tmp/ports/pobj/zstd-1.3.5/zstd-1.3.5/lib -I/usr/local/include"  
CXX="c++"  CXXFLAGS="-O2 -pipe  "  LDFLAGS="-L/usr/local/lib"  
LIBzstd_VERSION="1.1" PORTSDIR="/home/code/ports" LIBTOOL="/usr/bin/libtool"  
LIBzstd_LTVERSION='-version-info 1:1:0' libzstd_ltversion=1.1 
PATH='/tmp/ports/pobj/zstd-1.3.5/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin'
 PREFIX='/usr/local'  LOCALBASE='/usr/local' X11BASE='/usr/X11R6'  CFLAGS='-O2 
-pipe'  TRUEPREFIX='/usr/local' DESTDIR=''  HOME='/zstd-1.3.5_writes_to_HOME' 
COMPILER_VERSION=clang  PICFLAG="-fpic"  BINGRP=bin BINOWN=root BINMODE=755 
NONBINMODE=644  DIRMODE=755  INSTALL_COPY=-c INSTALL_STRIP=-s  MANGRP=bin 
MANOWN=root MANMODE=644 
BSD_INSTALL_PROGRAM="/tmp/ports/pobj/zstd-1.3.5/bin/install -c -s -m 755"  
BSD_INSTALL_SCRIPT="/tmp/ports/pobj/zstd-1.3.5/bin/install -c -m 755"  
BSD_INSTALL_DATA="/tmp/ports/pobj/zstd-1.3.5/bin/install -c -m 644"  
BSD_INSTALL_MAN="/tmp/ports/pobj/zstd-1.3.5/bin/install -c -m 644"  
BSD_INSTALL_PROGRAM_DIR="/tmp/ports/pobj/zstd-1.3.5/bin/install -d -m 755"  
BSD_INSTALL_SCRIPT_DIR="/tmp/ports/pobj/zstd-1.3.5/bin/install -d -m 755"  
BSD_INSTALL_DATA_DIR="/tmp/ports/pobj/zstd-1.3.5/bin/install -d -m 755"  
BSD_INSTALL_MAN_DIR="/tmp/ports/pobj/zstd-1.3.5/bin/install -d -m 755"  gmake   
LIBTOOL="/usr/bin/libtool"  LIBzstd_LTVERSION='-version-info 1:1:0' 
libzstd_ltversion=1.1 
SHARED_LIBS_LOG=/tmp/ports/pobj/zstd-1.3.5/zstd-1.3.5/shared_libs.log -j2  -f 
Makefile check;  echo $? >&4) 2>&1 |  tee /tmp/ports/pobj/zstd-1.3.5/test.log`
 touch /tmp/ports/pobj/zstd-1.3.5/.test_done

Enclosed diff addresses the above. Revision bump is not necessary as the
resulting package is not affected.

Any ideas on the TEST_TARGET/do-test bit? More precise, any idea why
TEST_TARGET doesn't work (any more)?


Index: Makefile
===================================================================
RCS file: /cvs/ports/archivers/zstd/Makefile,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile
--- Makefile    29 Jun 2018 19:02:07 -0000      1.18
+++ Makefile    30 Jun 2018 20:30:57 -0000
@@ -34,6 +34,7 @@ FAKE_FLAGS =          PREFIX="${PREFIX}"
 
 USE_GMAKE =            Yes
 
-TEST_TARGET =          check
+do-test:
+       cd ${WRKSRC} && ${MAKE_PROGRAM} check
 
 .include <bsd.port.mk>
Index: patches/patch-tests_playTests_sh
===================================================================
RCS file: /cvs/ports/archivers/zstd/patches/patch-tests_playTests_sh,v
retrieving revision 1.10
diff -u -p -r1.10 patch-tests_playTests_sh
--- patches/patch-tests_playTests_sh    29 Jun 2018 19:02:07 -0000      1.10
+++ patches/patch-tests_playTests_sh    30 Jun 2018 20:30:57 -0000
@@ -5,6 +5,10 @@ fail. This is explained by a test trying
 as a regular user is not allowed to write to this device. /dev/zero has
 different permissions set.
 
+OpenBSD has no 'head -c -1', as such replace it with dd.
+
+Ignore warnings from xz/lzma by using -Q flag.
+
 Index: tests/playTests.sh
 --- tests/playTests.sh.orig
 +++ tests/playTests.sh
@@ -17,3 +21,72 @@ Index: tests/playTests.sh
  case "$OS" in
    Windows*)
      isWindows=true
+@@ -524,7 +524,7 @@ if [ $GZIPMODE -eq 1 ]; then
+     $ZSTD -f --format=gzip tmp
+     $ZSTD -f tmp
+     cat tmp.gz tmp.zst tmp.gz tmp.zst | $ZSTD -d -f -o tmp
+-    head -c -1 tmp.gz | $ZSTD -t > $INTOVOID && die "incomplete frame not 
detected !"
++    dd bs=1 count=1 status=none if=tmp.gz | $ZSTD -t > $INTOVOID && die 
"incomplete frame not detected !"
+     rm tmp*
+ else
+     $ECHO "gzip mode not supported"
+@@ -544,16 +544,16 @@ $ZSTD --format=xz -V || LZMAMODE=0
+ if [ $LZMAMODE -eq 1 ]; then
+     $ECHO "xz support detected"
+     XZEXE=1
+-    xz -V && lzma -V || XZEXE=0
++    xz -Q -V && lzma -Q -V || XZEXE=0
+     if [ $XZEXE -eq 1 ]; then
+         $ECHO "Testing zstd xz and lzma support"
+         ./datagen > tmp
+         $ZSTD --format=lzma -f tmp
+         $ZSTD --format=xz -f tmp
+-        xz -t -v tmp.xz
+-        xz -t -v tmp.lzma
+-        xz -f -k tmp
+-        lzma -f -k --lzma1 tmp
++        xz -Q -t -v tmp.xz
++        xz -Q -t -v tmp.lzma
++        xz -Q -f -k tmp
++        lzma -Q -f -k --lzma1 tmp
+         $ZSTD -d -f -v tmp.xz
+         $ZSTD -d -f -v tmp.lzma
+         rm tmp*
+@@ -565,13 +565,13 @@ if [ $LZMAMODE -eq 1 ]; then
+         $ECHO "Testing xz and lzma symlinks"
+         ./datagen > tmp
+         ./xz tmp
+-        xz -d tmp.xz
++        xz -Q -d tmp.xz
+         ./lzma tmp
+-        lzma -d tmp.lzma
++        lzma -Q -d tmp.lzma
+         $ECHO "Testing unxz and unlzma symlinks"
+-        xz tmp
++        xz -Q tmp
+         ./xz -d tmp.xz
+-        lzma tmp
++        lzma -Q tmp
+         ./lzma -d tmp.lzma
+         rm xz unxz lzma unlzma
+         rm tmp*
+@@ -591,8 +591,8 @@ if [ $LZMAMODE -eq 1 ]; then
+     $ZSTD -f --format=lzma tmp
+     $ZSTD -f tmp
+     cat tmp.xz tmp.lzma tmp.zst tmp.lzma tmp.xz tmp.zst | $ZSTD -d -f -o tmp
+-    head -c -1 tmp.xz | $ZSTD -t > $INTOVOID && die "incomplete frame not 
detected !"
+-    head -c -1 tmp.lzma | $ZSTD -t > $INTOVOID && die "incomplete frame not 
detected !"
++    dd bs=1 count=1 status=none if=tmp.xz | $ZSTD -t > $INTOVOID && die 
"incomplete frame not detected !"
++    dd bs=1 count=1 status=none if=tmp.lzma | $ZSTD -t > $INTOVOID && die 
"incomplete frame not detected !"
+     rm tmp*
+ else
+     $ECHO "xz mode not supported"
+@@ -628,7 +628,7 @@ if [ $LZ4MODE -eq 1 ]; then
+     $ZSTD -f --format=lz4 tmp
+     $ZSTD -f tmp
+     cat tmp.lz4 tmp.zst tmp.lz4 tmp.zst | $ZSTD -d -f -o tmp
+-    head -c -1 tmp.lz4 | $ZSTD -t > $INTOVOID && die "incomplete frame not 
detected !"
++    dd bs=1 count=1 status=none if=tmp.lz4 | $ZSTD -t > $INTOVOID && die 
"incomplete frame not detected !"
+     rm tmp*
+ else
+     $ECHO "lz4 mode not supported"

Reply via email to