-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildomat: build tests in AWS and run them in the lab
- Loading branch information
Showing
2 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
#: | ||
#: name = "tests-build" | ||
#: variety = "basic" | ||
#: target = "helios" | ||
#: rust_toolchain = "nightly-2021-11-24" | ||
#: output_rules = [ | ||
#: "/work/bins/*.gz", | ||
#: "/work/tests/*.gz", | ||
#: ] | ||
#: | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o xtrace | ||
|
||
/opt/ooce/bin/jq --version | ||
cargo --version | ||
rustc --version | ||
|
||
#banner 'BuildBins' | ||
#ptime -m cargo build --verbose --bins \ | ||
# --message-format json-render-diagnostics >/tmp/output.build.json | ||
|
||
banner 'BuildTests' | ||
ptime -m cargo build --verbose --tests \ | ||
--message-format json-render-diagnostics >/tmp/output.tests.json | ||
|
||
function artifacts_from { | ||
/opt/ooce/bin/jq -r -s " | ||
map( | ||
select(.reason == \"compiler-artifact\") | ||
| select( | ||
.target.kind | ||
| map_values(. == \"$2\") | ||
| any | ||
) | ||
| .filenames | ||
) | ||
| flatten | ||
| .[]" "$1" | ||
} | ||
|
||
#banner 'SaveBins' | ||
#mkdir -p /work/bins | ||
#artifacts_from /tmp/output.build.json bin | while read a; do | ||
# ptime -m gzip < "$a" > "/work/bins/$(basename "$a").gz" | ||
#done | ||
|
||
banner 'SaveTests' | ||
mkdir -p /work/tests | ||
artifacts_from /tmp/output.tests.json test | while read a; do | ||
ptime -m gzip < "$a" > "/work/tests/$(basename "$a").gz" | ||
done | ||
|
||
banner 'Done' | ||
ls -lh /work/*/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
#: | ||
#: name = "tests-run" | ||
#: variety = "basic" | ||
#: target = "lab" | ||
#: output_rules = [ | ||
#: "/tmp/*.log", | ||
#: ] | ||
#: skip_clone = true | ||
#: | ||
#: [dependencies.build] | ||
#: job = "tests-build" | ||
#: | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o xtrace | ||
|
||
banner 'Inputs' | ||
find /input -ls | ||
|
||
testdir="$PWD/tests" | ||
rm -rf "$testdir" | ||
mkdir "$testdir" | ||
|
||
for p in /input/build/work/tests/*.gz; do | ||
f="$testdir/$(basename "$p")" | ||
f="${f%.gz}" | ||
rm -f "$f" | ||
gunzip < "$p" > "$f" | ||
chmod +x "$f" | ||
done | ||
|
||
fail=no | ||
|
||
banner 'Tests' | ||
for f in "$testdir"/*; do | ||
# | ||
# Tests generally need to run as root in order to have access to the | ||
# hypervisor device. | ||
# | ||
if ! ptime -m pfexec "$f" --show-output --test-threads 1; then | ||
echo | ||
echo "TEST $f FAILED" | ||
echo | ||
fail=yes | ||
else | ||
echo | ||
echo "TEST $f PASSED" | ||
echo | ||
fi | ||
done | ||
|
||
if [[ $fail == yes ]]; then | ||
echo "SOME TESTS FAILED" | ||
exit 1 | ||
else | ||
echo "ALL TESTS PASSED" | ||
exit 0 | ||
fi |