Disable docker container test from toplevel 'redo test'

It's not reliable on all versions of docker, and we haven't had time to
fix it yet, so just turn it off. It's not essential to redo.

Reported-by: b32fd19f8c39c0a632c491f3395d67fc2c825a4e@gmail.com

exec >&2   # any output we produce is a log message
no_simple=
no_debian=
no_runlocal=
no_runkvm=
no_docker=

if ! ./need.sh ldd; then
	echo "skipping simple image."
	no_simple=1
fi
if ! ./need.sh debootstrap eatmydata; then
	echo "skipping debian image."
	no_debian=1
fi
if ! ./need.sh cpio; then
	echo "skipping tarball generation."
	no_image=1
fi
if ! ./need.sh fakeroot fakechroot ||
   ! ./try_fakeroot.sh "x" true 2>/dev/null; then
	echo "skipping chroot test."
	no_runlocal=1
	echo "skipping debian image."
	no_debian=1
fi
if ! ./need.sh unshare ||
   ! unshare -r true 2>/dev/null; then
	echo " -- 'unshare -r' command doesn't work."
	echo "skipping chroot test."
	no_runlocal=1
fi
if ! ./need.sh busybox kvm cpio; then
	echo "skipping kvm test."
	no_runkvm=1
fi
kernel="/boot/vmlinuz-$(uname -r)"
if ! [ -e "$kernel" ]; then
	echo " -- missing kernel: $kernel"
	echo "skipping kvm test."
	no_runkvm=1
fi
if ! ./need.sh docker cpio ||
   ! docker images >/dev/null; then
	echo "skipping docker test."
	no_docker=1
fi
if [ -n "$NO_SLOW_TESTS" ]; then
	echo " -- NO_SLOW_TESTS is set."
	echo "skipping debian image."
	no_debian=1
	# TODO(apenwarr): docker test isn't "slow" exactly, but error prone.
	#  It might not work correctly on modern versions of docker.
	#  Until we resolve this, just disable it from a toplevel 'redo test',
	#  which sets NO_SLOW_TESTS.
	echo "skipping docker test."
	no_docker=1
fi

add() { targets="$targets $*"; }

[ -z "$no_simple$no_image" ] && add simple.image.gz
[ -z "$no_simple$no_runlocal" ] && add libs.runlocal
[ -z "$no_simple$no_runkvm" ] && add libs.runkvm
[ -z "$no_simple$no_docker" ] && add simple.rundocker

[ -z "$no_debian$no_image" ] && add debian.image
[ -z "$no_debian$no_runlocal" ] && add debian.runlocal
[ -z "$no_debian$no_runkvm" ] && add debian.runkvm
[ -z "$no_debian$no_docker" ] && add debian.rundocker

redo-ifchange $targets

check() {
	label=$1
	shift
	printf "checking %-18s %-35s " "$label:" "$*" >&2
	if test "$@"; then
		printf "ok\n" >&2
	else
		printf "failed\n" >&2
	fi
}

hellocheck() {
	check "$1" "$(cat "$1")" = "Hello, world!"
}

debcheck() {
	check "$1" "$(cat "$1")" -ge "70"
	check "$1" "$(cat "$1")" -le "100"
}

if [ -z "$no_simple" ]; then
	[ -n "$no_runlocal" ] || hellocheck libs.runlocal
	[ -n "$no_runkvm" ] || hellocheck libs.runkvm
	[ -n "$no_docker" ] || hellocheck simple.rundocker
fi

if [ -z "$no_debian" ]; then
	[ -n "$no_runlocal" ] || debcheck debian.runlocal
	[ -n "$no_runkvm" ] || debcheck debian.runkvm
	[ -n "$no_docker" ] || debcheck debian.rundocker
fi

exec >&2   # any output we produce is a log message
no_simple=
no_debian=
no_runlocal=
no_runkvm=
no_docker=

if ! ./need.sh ldd; then
	echo "skipping simple image."
	no_simple=1
fi
if ! ./need.sh debootstrap eatmydata; then
	echo "skipping debian image."
	no_debian=1
fi
if ! ./need.sh cpio; then
	echo "skipping tarball generation."
	no_image=1
fi
if ! ./need.sh fakeroot fakechroot ||
   ! ./try_fakeroot.sh "x" true 2>/dev/null; then
	echo "skipping chroot test."
	no_runlocal=1
	echo "skipping debian image."
	no_debian=1
fi
if ! ./need.sh unshare ||
   ! unshare -r true 2>/dev/null; then
	echo " -- 'unshare -r' command doesn't work."
	echo "skipping chroot test."
	no_runlocal=1
fi
if ! ./need.sh busybox kvm cpio; then
	echo "skipping kvm test."
	no_runkvm=1
fi
kernel="/boot/vmlinuz-$(uname -r)"
if ! [ -e "$kernel" ]; then
	echo " -- missing kernel: $kernel"
	echo "skipping kvm test."
	no_runkvm=1
fi
if ! ./need.sh docker cpio ||
   ! docker images >/dev/null; then
	echo "skipping docker test."
	no_docker=1
fi
if [ -n "$NO_SLOW_TESTS" ]; then
	echo " -- NO_SLOW_TESTS is set."
	echo "skipping debian image."
	no_debian=1
fi

add() { targets="$targets $*"; }

[ -z "$no_simple$no_image" ] && add simple.image.gz
[ -z "$no_simple$no_runlocal" ] && add libs.runlocal
[ -z "$no_simple$no_runkvm" ] && add libs.runkvm
[ -z "$no_simple$no_docker" ] && add simple.rundocker

[ -z "$no_debian$no_image" ] && add debian.image
[ -z "$no_debian$no_runlocal" ] && add debian.runlocal
[ -z "$no_debian$no_runkvm" ] && add debian.runkvm
[ -z "$no_debian$no_docker" ] && add debian.rundocker

redo-ifchange $targets

check() {
	label=$1
	shift
	printf "checking %-18s %-35s " "$label:" "$*" >&2
	if test "$@"; then
		printf "ok\n" >&2
	else
		printf "failed\n" >&2
	fi
}

hellocheck() {
	check "$1" "$(cat "$1")" = "Hello, world!"
}

debcheck() {
	check "$1" "$(cat "$1")" -ge "70"
	check "$1" "$(cat "$1")" -le "100"
}

if [ -z "$no_simple" ]; then
	[ -n "$no_runlocal" ] || hellocheck libs.runlocal
	[ -n "$no_runkvm" ] || hellocheck libs.runkvm
	[ -n "$no_docker" ] || hellocheck simple.rundocker
fi

if [ -z "$no_debian" ]; then
	[ -n "$no_runlocal" ] || debcheck debian.runlocal
	[ -n "$no_runkvm" ] || debcheck debian.runkvm
	[ -n "$no_docker" ] || debcheck debian.rundocker
fi


fix cmd_list for new stata

fix cmd_list for new stata

PLL_iters was ending up as not found or J(0,0,.)

*! version 0.1 13sep2021
*! A way to record commands and then run them all either in parallel or sequentially.
program cmd_list
    gettoken sub_cmd 0 : 0, parse(" :,")

    _assert inlist("`sub_cmd'", "clear", "add", "run"), msg("-cmd_list sub_cmd-: `sub_cmd' not found (should be clear, add, or run).")
    if "`sub_cmd'"=="clear" {
		mata: rmexternal("PLL_iters")
        *mata: PLL_iters = J(1,0,"")
    }
    if "`sub_cmd'"=="add" {
        _on_colon_parse `0'
        loc cmd `s(after)'
		* these two lines were tricky to get right on several versions of Stata
        mata: if(length(direxternal("PLL_iters"))==0) {PLL_temp = crexternal("PLL_iters");};
		mata: if(PLL_iters==J(0,0,.)){PLL_iters = J(1,0,"");};
        mata: PLL_iters = (PLL_iters, st_local("cmd"))
    }
    if "`sub_cmd'"=="run"{
        syntax [, parallel nocleanup mata *]

        mata: st_local("n_iters", strofreal(length(PLL_iters)))

        if c(k)>0 {
            tempfile maindata
            qui save "`maindata'"
        }
        else loc maindata ""

        if "`parallel'"!="" loc parallel "parallel, mata `options':"
        preserve
        clear
        qui set obs `n_iters'
        gen long i = _n
        `parallel' _cmd_list_runner, maindata("`maindata'")
        restore

        if "`rm'"!="nocleanup" mata:  rmexternal("PLL_iters")
        if "`rm'"!="nocleanup" mata: if(length(direxternal("PLL_temp"))>0){rmexternal("PLL_temp");};
    }
end

*! version 0.1 13sep2021
*! A way to record commands and then run them all either in parallel or sequentially.
program cmd_list
    gettoken sub_cmd 0 : 0, parse(" :,")

    _assert inlist("`sub_cmd'", "clear", "add", "run"), msg("-cmd_list sub_cmd-: `sub_cmd' not found (should be clear, add, or run).")
    if "`sub_cmd'"=="clear" {
        mata: PLL_iters = J(1,0,"")
    }
    if "`sub_cmd'"=="add" {
        _on_colon_parse `0'
        loc cmd `s(after)'
        mata: PLL_iters = length(direxternal("PLL_iters"))==0 ? J(1,0,"") : PLL_iters
        mata: PLL_iters = (PLL_iters, st_local("cmd"))
    }
    if "`sub_cmd'"=="run"{
        syntax [, parallel nocleanup mata *]

        mata: st_local("n_iters", strofreal(length(PLL_iters)))

        if c(k)>0 {
            tempfile maindata
            qui save "`maindata'"
        }
        else loc maindata ""

        if "`parallel'"!="" loc parallel "parallel, mata `options':"
        preserve
        clear
        qui set obs `n_iters'
        gen long i = _n
        `parallel' _cmd_list_runner, maindata("`maindata'")
        restore

        if "`rm'"!="nocleanup" mata:  rmexternal("PLL_iters")
    }
end