Skip to content

Commit

Permalink
split migrate-from-base tests into a separate PHD run
Browse files Browse the repository at this point in the history
Move the existing phd-run script into a callable phd-run-with-args.sh
that passes its arguments through to its phd-runner invocation. Then
create separate "run PHD" jobs that call this script, respectively
including and excluding the migrate-from-base tests from their runs.
  • Loading branch information
gjcolombo committed Jul 31, 2024
1 parent efbc11f commit 0ea043d
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 83 deletions.
1 change: 1 addition & 0 deletions .github/buildomat/jobs/phd-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ tar -czvf target/debug/phd-runner.tar.gz \
banner copy
pfexec mkdir -p $outdir
pfexec chown "$UID" $outdir
cp .github/buildomat/phd-run-with-args.sh $outdir/phd-run-with-args.sh
mv target/debug/propolis-server-debug.tar.gz \
$outdir/propolis-server-debug.tar.gz
mv target/debug/phd-runner.tar.gz $outdir/phd-runner.tar.gz
Expand Down
18 changes: 18 additions & 0 deletions .github/buildomat/jobs/phd-run-migrate-from-base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
#:
#: name = "phd-run-migrate-from-base"
#: variety = "basic"
#: target = "lab-2.0-opte"
#: output_rules = [
#: "/tmp/phd-runner.log",
#: "/tmp/phd-tmp-files.tar.gz",
#: ]
#: skip_clone = true
#:
#: [dependencies.phd-build]
#: job = "phd-build"
#:

cp /input/phd-build/out/phd-run-with-args.sh /tmp/phd-run-with-args.sh
chmod a+x /tmp/phd-run-with-args.sh
exec /tmp/phd-run-with-args.sh --exclude-filter "phd_tests::migrate::from_base"
86 changes: 3 additions & 83 deletions .github/buildomat/jobs/phd-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,86 +13,6 @@
#: job = "phd-build"
#:

set -o errexit
set -o pipefail
set -o xtrace

indir="/input"
indir_suffix="phd-build/out/*.tar.gz"
phddir="$PWD/phd-test"

# Put artifacts on the runner's SSDs (the /work ramdisk is small by design, too
# small for images of any appreciable size).
pfexec zpool create -f phd-artifacts c1t1d0 c2t1d0
artifactdir="/phd-artifacts"

banner 'Inputs'
find $indir -ls

rm -rf "$phddir"
mkdir "$phddir"

for p in $indir/$indir_suffix; do
tar xzvf $p -C $phddir
for f in $(tar tf "$p"); do
chmod +x "$phddir/$f"
done
done

ls $phddir

banner 'Setup'
tmpdir="/tmp/propolis-phd"
if [ ! -d "$tmpdir" ]; then
mkdir $tmpdir
fi

banner 'Tests'

runner="$phddir/phd-runner"
artifacts="$phddir/artifacts.toml"
propolis="$phddir/propolis-server"

ls $runner
ls $artifacts
ls $propolis

# Disable errexit so that we still upload logs on failure
set +e

(RUST_BACKTRACE=1 RUST_LOG="info,phd=debug" ptime -m pfexec $runner \
--emit-bunyan \
run \
--propolis-server-cmd $propolis \
--base-propolis-branch master \
--crucible-downstairs-commit auto \
--artifact-toml-path $artifacts \
--tmp-directory $tmpdir \
--artifact-directory $artifactdir | \
tee /tmp/phd-runner.log)
failcount=$?
set -e

tar -czvf /tmp/phd-tmp-files.tar.gz \
-C /tmp/propolis-phd /tmp/propolis-phd/*.log \
-C /tmp/propolis-phd /tmp/propolis-phd/*.toml

exitcode=0
if [ $failcount -eq 0 ]; then
echo
echo "ALL TESTS PASSED"
echo
else
echo
echo "SOME TESTS FAILED"
echo
exitcode=1
fi

if find /dev/vmm -mindepth 1 -maxdepth 1 | read ; then
echo "VMM handles leaked:"
find /dev/vmm -type c -exec basename {} \;
exitcode=2
fi

exit $exitcode
cp /input/phd-build/out/phd-run-with-args.sh /tmp/phd-run-with-args.sh
chmod a+x /tmp/phd-run-with-args.sh
exec /tmp/phd-run-with-args.sh --exclude-filter "phd_tests::migrate::from_base"
89 changes: 89 additions & 0 deletions .github/buildomat/phd-run-with-args.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

# Unpacks and executes the PHD runner in the Buildomat environment, passing
# through to the runner any arguments that were passed to this script.

set -o errexit
set -o pipefail
set -o xtrace

indir="/input"
indir_suffix="phd-build/out/*.tar.gz"
phddir="$PWD/phd-test"

# Put artifacts on the runner's SSDs (the /work ramdisk is small by design, too
# small for images of any appreciable size).
pfexec zpool create -f phd-artifacts c1t1d0 c2t1d0
artifactdir="/phd-artifacts"

banner 'Inputs'
find $indir -ls

rm -rf "$phddir"
mkdir "$phddir"

for p in $indir/$indir_suffix; do
tar xzvf $p -C $phddir
for f in $(tar tf "$p"); do
chmod +x "$phddir/$f"
done
done

ls $phddir

banner 'Setup'
tmpdir="/tmp/propolis-phd"
if [ ! -d "$tmpdir" ]; then
mkdir $tmpdir
fi

banner 'Tests'

runner="$phddir/phd-runner"
artifacts="$phddir/artifacts.toml"
propolis="$phddir/propolis-server"

ls $runner
ls $artifacts
ls $propolis

args=()
args+=($runner '--emit-bunyan' 'run')
args+=('--propolis-server-cmd' $propolis)
args+=('--base-propolis-branch' 'master')
args+=('--crucible-downstairs-commit' 'auto')
args+=('--artifact-toml-path' $artifacts)
args+=('--tmp-directory' $tmpdir)
args+=('--artifact-directory' $artifactdir)
args+=($@)

# Disable errexit so that we still upload logs on failure
set +e
(RUST_BACKTRACE=1 RUST_LOG="info,phd=debug" ptime -m pfexec "${args[@]}" | \
tee /tmp/phd-runner.log)
failcount=$?
set -e

tar -czvf /tmp/phd-tmp-files.tar.gz \
-C /tmp/propolis-phd /tmp/propolis-phd/*.log \
-C /tmp/propolis-phd /tmp/propolis-phd/*.toml

exitcode=0
if [ $failcount -eq 0 ]; then
echo
echo "ALL TESTS PASSED"
echo
else
echo
echo "SOME TESTS FAILED"
echo
exitcode=1
fi

if find /dev/vmm -mindepth 1 -maxdepth 1 | read ; then
echo "VMM handles leaked:"
find /dev/vmm -type c -exec basename {} \;
exitcode=2
fi

exit $exitcode

0 comments on commit 0ea043d

Please sign in to comment.