Re: regress: don't needlessly fiddle with MALLOC_OPTIONS

2021-09-01 Thread Alexander Bluhm
On Wed, Sep 01, 2021 at 01:42:41PM +0200, Jasper Lievisse Adriaanse wrote:
> Hi,
> 
> As discussed earlier with bluhm, regress tests shouldn't set or modify
> MALLOC_OPTIONS (except under very specific situations, like malloc tests).
> It would be better to set the options globally through sysctl when
> running the suite, as bluhm does.
> 
> So remove most cases of MALLOC_OPTIONS from regress and amend the
> manpage guidelines accordingly.
> 
> OK?

OK bluhm@

> diff 9ca4957b0bf957d4e3a97547c791aeac34911aaf /usr/src
> blob - a40fad57e604ca5bf7ccfee8c91bcb68bbb46456
> file + regress/bin/csh/Makefile
> --- regress/bin/csh/Makefile
> +++ regress/bin/csh/Makefile
> @@ -20,7 +20,6 @@ REGRESS_TARGETS+=   env
>  .SUFFIXES: .in
>  
>  .in:
> - env -i MALLOC_OPTIONS=S ${CSH} <${.CURDIR}/${@}.in 2>&1 | \
> - diff -u ${.CURDIR}/${@}.ok -
> + ${CSH} <${.CURDIR}/${@}.in 2>&1 | diff -u ${.CURDIR}/${@}.ok -
>  
>  .include 
> blob - 3341dabb1403688df8f8e16fa2e31dcd3739d108
> file + regress/bin/csh/filec.sh
> --- regress/bin/csh/filec.sh
> +++ regress/bin/csh/filec.sh
> @@ -50,8 +50,7 @@ cd ~
>  !
>  
>  HOME=$tmp
> -MALLOC_OPTIONS=S
> -export HOME MALLOC_OPTIONS
> +export HOME
>  
>  # NL: Execute command.
>  testseq "echo a\n" "? echo a\r\na\r\n? "
> blob - aee8864d3f8965a05eb4ca63f0ee80979d4d1591
> file + regress/bin/ksh/edit/emacs.sh
> --- regress/bin/ksh/edit/emacs.sh
> +++ regress/bin/ksh/edit/emacs.sh
> @@ -25,10 +25,9 @@ EDITOR=
>  ENV=
>  HISTFILE=
>  MAIL=
> -MALLOC_OPTIONS=S
>  PS1=' # '
>  VISUAL=emacs
> -export EDITOR ENV HISTFILE MAIL MALLOC_OPTIONS PS1 VISUAL
> +export EDITOR ENV HISTFILE MAIL PS1 VISUAL
>  
>  # The function testseq() sets up a pseudo terminal and feeds its first
>  # argument to a shell on standard input.  It then checks that output
> blob - be15c4d1ee8d04be8f36c6f0d647241edbeb70f1
> file + regress/bin/ksh/edit/vi.sh
> --- regress/bin/ksh/edit/vi.sh
> +++ regress/bin/ksh/edit/vi.sh
> @@ -25,10 +25,9 @@ EDITOR=
>  ENV=
>  HISTFILE=
>  MAIL=
> -MALLOC_OPTIONS=S
>  PS1=' # '
>  VISUAL=vi
> -export EDITOR ENV HISTFILE MAIL MALLOC_OPTIONS PS1 VISUAL
> +export EDITOR ENV HISTFILE MAIL PS1 VISUAL
>  
>  # The function testseq() sets up a pseudo terminal and feeds its first
>  # argument to a shell on standard input.  It then checks that output
> blob - 4a35e2664dba5fab3029d832bf181cd63bfa8c0a
> file + regress/bin/ksh/th
> --- regress/bin/ksh/th
> +++ regress/bin/ksh/th
> @@ -56,8 +56,7 @@
>  #missing, NAME is removed from the
>  #environment.  Programs are run with
>  #the following minimal environment:
> -#USER, LOGNAME, HOME, PATH, SHELL,
> -#MALLOC_OPTIONS=S
> +#USER, LOGNAME, HOME, PATH, SHELL
>  #(values from the current environment
>  #takes higher precedence).
>  #file-setup  mps Used to create files, directories
> @@ -233,10 +232,8 @@ grep($do_test{$_} = 1, @ARGV);
>  $all_tests = @ARGV == 0;
>  
>  # Set up a very minimal environment
> -%new_env = (
> -MALLOC_OPTIONS => 'S',
> -);
> -foreach $env (('USER', 'LOGNAME', 'HOME', 'PATH', 'SHELL', 
> 'MALLOC_OPTIONS')) {
> +%new_env = ();
> +foreach $env (('USER', 'LOGNAME', 'HOME', 'PATH', 'SHELL')) {
>  $new_env{$env} = $ENV{$env} if defined $ENV{$env};
>  }
>  if (defined $opt_e) {
> blob - f70d94bd6299646db94cbd0ef873bda47536d474
> file + regress/usr.bin/doas/Makefile
> --- regress/usr.bin/doas/Makefile
> +++ regress/usr.bin/doas/Makefile
> @@ -114,8 +114,7 @@ ${t}:
>   /bin/echo $$tdir/bin/echo; \
>   ${SUDO} install -o ${BINOWN} -g ${BINGRP} -m 4555 \
>   /usr/bin/doas $$tdir/usr/bin/doas; \
> - ${SUDO} env MALLOC_OPTIONS=S chroot -u nobody $$tdir \
> - /usr/bin/doas echo okay
> + ${SUDO} chroot -u nobody $$tdir /usr/bin/doas echo okay
>  . endif
>  .endfor
>  
> blob - 7b9898b8ed49bbb82e891f12a98415ac996f9033
> file + regress/usr.bin/mail/send.sh
> --- regress/usr.bin/mail/send.sh
> +++ regress/usr.bin/mail/send.sh
> @@ -43,8 +43,7 @@ set ask
>  !
>  
>  HOME=$tmp
> -MALLOC_OPTIONS=S
> -export HOME MALLOC_OPTIONS
> +export HOME
>  
>  # VERASE: Delete character.
>  testseq "\0177" "Subject: "
> blob - 64237f6cc9abe1803f2082d0c8d0b91d214b58da
> file + regress/usr.bin/make/Makefile
> --- regress/usr.bin/make/Makefile
> +++ regress/usr.bin/make/Makefile
> @@ -8,191 +8,190 @@ REGRESS_TARGETS= t1  t2  t3  t4  t5  t6  t7  t8  t
>  
>  REGRESS_EXPECTED_FAILURES = t14 t17 t18
>  
> -MALLOC_OPTIONS?=J
>  t1: t1.out
> - env -i PATH=${PATH} MALLOC_OPTIONS=${MALLOC_OPTIONS} ${MAKE} -e -r -f 
> ${.CURDIR}/mk1 | diff - t1.out
> + env -i PATH=${PATH} ${MAKE} -e -r -f ${.CURDIR}/mk1 | diff - t1.out
>  
>  # This is a POSIX test. pmake does not pass variables to 

regress: don't needlessly fiddle with MALLOC_OPTIONS

2021-09-01 Thread Jasper Lievisse Adriaanse
Hi,

As discussed earlier with bluhm, regress tests shouldn't set or modify
MALLOC_OPTIONS (except under very specific situations, like malloc tests).
It would be better to set the options globally through sysctl when
running the suite, as bluhm does.

So remove most cases of MALLOC_OPTIONS from regress and amend the
manpage guidelines accordingly.

OK?

diff 9ca4957b0bf957d4e3a97547c791aeac34911aaf /usr/src
blob - a40fad57e604ca5bf7ccfee8c91bcb68bbb46456
file + regress/bin/csh/Makefile
--- regress/bin/csh/Makefile
+++ regress/bin/csh/Makefile
@@ -20,7 +20,6 @@ REGRESS_TARGETS+= env
 .SUFFIXES: .in
 
 .in:
-   env -i MALLOC_OPTIONS=S ${CSH} <${.CURDIR}/${@}.in 2>&1 | \
-   diff -u ${.CURDIR}/${@}.ok -
+   ${CSH} <${.CURDIR}/${@}.in 2>&1 | diff -u ${.CURDIR}/${@}.ok -
 
 .include 
blob - 3341dabb1403688df8f8e16fa2e31dcd3739d108
file + regress/bin/csh/filec.sh
--- regress/bin/csh/filec.sh
+++ regress/bin/csh/filec.sh
@@ -50,8 +50,7 @@ cd ~
 !
 
 HOME=$tmp
-MALLOC_OPTIONS=S
-export HOME MALLOC_OPTIONS
+export HOME
 
 # NL: Execute command.
 testseq "echo a\n" "? echo a\r\na\r\n? "
blob - aee8864d3f8965a05eb4ca63f0ee80979d4d1591
file + regress/bin/ksh/edit/emacs.sh
--- regress/bin/ksh/edit/emacs.sh
+++ regress/bin/ksh/edit/emacs.sh
@@ -25,10 +25,9 @@ EDITOR=
 ENV=
 HISTFILE=
 MAIL=
-MALLOC_OPTIONS=S
 PS1=' # '
 VISUAL=emacs
-export EDITOR ENV HISTFILE MAIL MALLOC_OPTIONS PS1 VISUAL
+export EDITOR ENV HISTFILE MAIL PS1 VISUAL
 
 # The function testseq() sets up a pseudo terminal and feeds its first
 # argument to a shell on standard input.  It then checks that output
blob - be15c4d1ee8d04be8f36c6f0d647241edbeb70f1
file + regress/bin/ksh/edit/vi.sh
--- regress/bin/ksh/edit/vi.sh
+++ regress/bin/ksh/edit/vi.sh
@@ -25,10 +25,9 @@ EDITOR=
 ENV=
 HISTFILE=
 MAIL=
-MALLOC_OPTIONS=S
 PS1=' # '
 VISUAL=vi
-export EDITOR ENV HISTFILE MAIL MALLOC_OPTIONS PS1 VISUAL
+export EDITOR ENV HISTFILE MAIL PS1 VISUAL
 
 # The function testseq() sets up a pseudo terminal and feeds its first
 # argument to a shell on standard input.  It then checks that output
blob - 4a35e2664dba5fab3029d832bf181cd63bfa8c0a
file + regress/bin/ksh/th
--- regress/bin/ksh/th
+++ regress/bin/ksh/th
@@ -56,8 +56,7 @@
 #  missing, NAME is removed from the
 #  environment.  Programs are run with
 #  the following minimal environment:
-#  USER, LOGNAME, HOME, PATH, SHELL,
-#  MALLOC_OPTIONS=S
+#  USER, LOGNAME, HOME, PATH, SHELL
 #  (values from the current environment
 #  takes higher precedence).
 #  file-setup  mps Used to create files, directories
@@ -233,10 +232,8 @@ grep($do_test{$_} = 1, @ARGV);
 $all_tests = @ARGV == 0;
 
 # Set up a very minimal environment
-%new_env = (
-MALLOC_OPTIONS => 'S',
-);
-foreach $env (('USER', 'LOGNAME', 'HOME', 'PATH', 'SHELL', 'MALLOC_OPTIONS')) {
+%new_env = ();
+foreach $env (('USER', 'LOGNAME', 'HOME', 'PATH', 'SHELL')) {
 $new_env{$env} = $ENV{$env} if defined $ENV{$env};
 }
 if (defined $opt_e) {
blob - f70d94bd6299646db94cbd0ef873bda47536d474
file + regress/usr.bin/doas/Makefile
--- regress/usr.bin/doas/Makefile
+++ regress/usr.bin/doas/Makefile
@@ -114,8 +114,7 @@ ${t}:
/bin/echo $$tdir/bin/echo; \
${SUDO} install -o ${BINOWN} -g ${BINGRP} -m 4555 \
/usr/bin/doas $$tdir/usr/bin/doas; \
-   ${SUDO} env MALLOC_OPTIONS=S chroot -u nobody $$tdir \
-   /usr/bin/doas echo okay
+   ${SUDO} chroot -u nobody $$tdir /usr/bin/doas echo okay
 . endif
 .endfor
 
blob - 7b9898b8ed49bbb82e891f12a98415ac996f9033
file + regress/usr.bin/mail/send.sh
--- regress/usr.bin/mail/send.sh
+++ regress/usr.bin/mail/send.sh
@@ -43,8 +43,7 @@ set ask
 !
 
 HOME=$tmp
-MALLOC_OPTIONS=S
-export HOME MALLOC_OPTIONS
+export HOME
 
 # VERASE: Delete character.
 testseq "\0177" "Subject: "
blob - 64237f6cc9abe1803f2082d0c8d0b91d214b58da
file + regress/usr.bin/make/Makefile
--- regress/usr.bin/make/Makefile
+++ regress/usr.bin/make/Makefile
@@ -8,191 +8,190 @@ REGRESS_TARGETS= t1  t2  t3  t4  t5  t6  t7  t8  t
 
 REGRESS_EXPECTED_FAILURES = t14 t17 t18
 
-MALLOC_OPTIONS?=J
 t1: t1.out
-   env -i PATH=${PATH} MALLOC_OPTIONS=${MALLOC_OPTIONS} ${MAKE} -e -r -f 
${.CURDIR}/mk1 | diff - t1.out
+   env -i PATH=${PATH} ${MAKE} -e -r -f ${.CURDIR}/mk1 | diff - t1.out
 
 # This is a POSIX test. pmake does not pass variables to submakes until
 # after OpenBSD 2.7.
 t2:
-   cd ${.CURDIR} && env -i PATH=${PATH} MALLOC_OPTIONS=${MALLOC_OPTIONS} 
${MAKE} -r -f mk2| diff - t2.out
+   cd ${.CURDIR} && env -i PATH=${PATH} ${MAKE} -r -f mk2| diff - t2.out
 
 t3:
-   cd ${.CURDIR} && env -i PATH=${PATH} MALLOC_OPTIONS=${MALLOC_OPTIONS} 
${MAKE} -r