[28445] in Source-Commits
Re: scripts commit: Switch to qemu from vmware; enhance tests
daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Thu Sep 25 16:54:05 2014
Date: Thu, 25 Sep 2014 16:53:47 -0400 (EDT)
From: Benjamin Kaduk <kaduk@MIT.EDU>
To: Jonathan D Reed <jdreed@MIT.EDU>
cc: source-commits@MIT.EDU
In-Reply-To: <201409242046.s8OKkwvr014047@drugstore.mit.edu>
Message-ID: <alpine.GSO.1.10.1409251628170.21571@multics.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Wed, 24 Sep 2014, Jonathan D Reed wrote:
> https://github.com/mit-athena/scripts/commit/6562e4316bcfb22c5a18a1684e002030ed4e7183
> commit 6562e4316bcfb22c5a18a1684e002030ed4e7183
> Author: Jonathan Reed <jdreed@mit.edu>
> Date: Tue Sep 23 09:42:14 2014 -0400
>
> Switch to qemu from vmware; enhance tests
>
> - VMware didn't do as well headless as I would have liked, and ESX
> was a bit too large of a hammer, so we switch to QEMU.
> - Change the logic to simply bootstrap the stage2 installer rather
> then writing out our own preseed.
> - Log to a uniquely generated log file
> - Break testing out into 3 stages (networking, installer,
> final working machine).
>
> diff --git a/tests/installer/install-test.sh b/tests/installer/install-test.sh
> index 335945c..7a7eb78 100755
> --- a/tests/installer/install-test.sh
> +++ b/tests/installer/install-test.sh
> @@ -1,153 +1,223 @@
> +stop_qemu() {
> + PID=
> + if [ -n "$QPIDFILE" ] && \
> + [ -r "$QPIDFILE" ]; then
> + PID="$(cat $QPIDFILE)"
> + else
> + echo "QEMU PID file ($QPIDFILE) missing or unreadable" >&2
Your parentheses are unbalanced here.
> + if ! echo quit | nc localhost 4444; then
> + echo "Couldn't send quit command to monitor! Trying to kill.." >&2
> + kill "$PID" || :
Probably wise to use kill -- "$PID", in case there is some garbage in the
file.
> +[ -n "$HOSTNAME" ] || die "HOSTNAME unspecified"
> +case "$ARCH" in
> + i386|amd64)
> + ;;
> + *)
> + die "Unknown arch $ARCH"
> + ;;
> +esac
> +[ -n "$SUITE" ] || die "SUITE unspecified"
> +[ -f "$ISOLINUXBIN" ] || die "$ISOLINUXBIN missing"
It may be better to not have the dollar sign there?
> +echo -n "Looking up $HOSTNAME ... "
> +# This will always return true because of tail(1)
(Until some bozo decides to set -o pipefail somewhere earlier. Which
seems unlikely.)
> +IP=$(dig +short $HOSTNAME | tail -1)
> +if echo "$IP" | grep -q '[^0-9\.]'; then
> + echo "bad IP ($IP)."
> + exit 1
> +else
> + echo "$IP"
Maybe "IP $IP"?
> +echo "Install started at $(date)"
> +echo -n "Waiting up to 30s for machine networking to come up..."
> +err=1
> +for i in $(seq 30); do
> + if ping -c 1 -w 2 "$IP" > /dev/null 2>&1; then
> + err=0
> + echo "ok"
> + break
> + fi
> + echo -n "."
> + sleep 1
> +done
> +[ $err -eq 1 ] && die "Machine did not respond to ping within 30s"
I think this ends up printing "Machine did not[...]" on the same line as
all the '.'s, not that it really matters.
(Similar things apply to the subsequent loops, which I will trim.)
-Ben