On 2018/10/04 11:36, Solene Rapenne wrote:
> Klemens Nanni <k...@openbsd.org> wrote:
> > DEBUG=-g3 is honored for the normal build but not tests:
> >
> >     $ make DEBUG=-g3 test
> >     ...
> >     gmake[2]: Leaving directory '/tmp/pobj/ipv6calc-1.1.0/ipv6calc-1.1.0'
> >     cc -o ipv6calc ipv6calc.o showinfo.o ipv6calchelp_local.o   -lcrypto  
> > -L../lib/ -L../databases/lib/ -lipv6calc_db_wrapper -lipv6calc    -lm
> >     ...
> >
> > Which is needed since one test reproducibly dumps core on my X250:
> >
> >     ...
> >     INFO  : run 'ipv6calc' pipe tests (1)
> >     Segmentation fault (core dumped)
> >     INFO  : test 'echo 3ffe::1:ff00:1234 | ./ipv6calc --in ipv6addr --out 
> > ipv6addr --printuncompressed | grep "^3ffe:0:0:0:0:1:ff00:1234$"'
> >     Error executing 'ipv6calc' (1)!
> >     gmake[1]: *** [Makefile:65: test] Error 1
> >     gmake[1]: Leaving directory 
> > '/tmp/pobj/ipv6calc-1.1.0/ipv6calc-1.1.0/ipv6calc'
> >     Result: 2
> >     gmake: *** [Makefile:166: test] Error 2
> >     *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2768 
> > '/tmp/pobj/ipv6calc-1.1.0/.test_done')
> >     *** Error 1 in /usr/ports/net/ipv6calc 
> > (/usr/ports/infrastructure/mk/bsd.port.mk:2412 'test')
> >
> > Homepage has TLS.
>
> Thanks for feedback. I get the seg fault too. FTIW, the current port test
> segfault too.
>
> I really can't get "make test" to honour flags, if someone has a clue it would
> be nice to share about it, I'm stuck right now.
>
> adding TEST_FLAGS=     CFLAGS="${CFLAGS}" to Makefile doesn't help, I've been
> trying to fiddle in the Makefile with no success.
>
> The test target is the following:
>
> test:
>                 for dir in ipv6calc ipv6logconv ipv6logstats ipv6loganon 
> ipv6calcweb $(MOD_IPV6CALC_DIR); do \
>                         ocwd=`pwd`; \
>                         cd $$dir || exit 1; \
>                         ${MAKE} $@ ; r=$$?; \
>                         cd $$ocwd ; if [ $$r -ne 0 ]; then echo "Result: 
> $$r"; exit $$r; fi; \
>                 done || exit 1
>                 echo "ALL TESTS SUCCESSFUL"
>

I just ran the failing test manually. bt looks like:

[New process 166218]
Core was generated by `ipv6calc'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000012c86b4042b1 in main (argc=0, argv=0x7f7fffff1b58) at ipv6calc.c:887
887                     if (*ptrptr[0] != '\0') {
(gdb) p ptrptr
$1 = (char **) 0x7f7ffffe7500
(gdb) p *ptrptr
$2 = 0x0
(gdb) list
882                     inputc = 1;
883
884                     DEBUGPRINT_WA(DEBUG_ipv6calc_general, "Token 1: '%s'", 
input1);
885
886                     /* check for second token */
887                     if (*ptrptr[0] != '\0') {
888                             input2 = *ptrptr;
889                             inputc = 2;
890
891                             DEBUGPRINT_WA(DEBUG_ipv6calc_general, "Token 2: 
'%s'", input2);
(gdb) quit


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/ipv6calc/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- Makefile    28 Nov 2017 12:03:28 -0000      1.21
+++ Makefile    4 Oct 2018 13:23:57 -0000
@@ -20,4 +20,7 @@ MAKE_FLAGS=   DEFAULT_CFLAGS=
 
 TEST_TARGET=   test
 
+pre-test:
+       sed -i 's,^source ,. ,' ${WRKSRC}/*/test*.sh
+
 .include <bsd.port.mk>
Index: patches/patch-ipv6calc_ipv6calc_c
===================================================================
RCS file: patches/patch-ipv6calc_ipv6calc_c
diff -N patches/patch-ipv6calc_ipv6calc_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ipv6calc_ipv6calc_c   4 Oct 2018 13:23:57 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: ipv6calc/ipv6calc.c
+--- ipv6calc/ipv6calc.c.orig
++++ ipv6calc/ipv6calc.c
+@@ -884,7 +884,7 @@ PIPE_input:
+               DEBUGPRINT_WA(DEBUG_ipv6calc_general, "Token 1: '%s'", input1);
+ 
+               /* check for second token */
+-              if (*ptrptr[0] != '\0') {
++              if (*ptrptr && *ptrptr[0] != '\0') {
+                       input2 = *ptrptr;
+                       inputc = 2;
+ 

Reply via email to