build: simplify make test and re-enable on darwin ci for testing

This commit is contained in:
Brendan Hay 2020-10-29 13:16:20 +01:00
parent fada33dfe6
commit 50f66ce431
No known key found for this signature in database
GPG Key ID: 80E915C54A7C457D
4 changed files with 40 additions and 47 deletions

View File

@ -10,7 +10,7 @@ release:
sh/release
test:
sh/test
nix-build -A urbit-tests --no-out-link
pills:
sh/update-solid-pill

View File

@ -49,7 +49,7 @@ let
# Encode `oid` and `size` into a download operation per:
# https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
#
# This is done using toJSON to avoid bash quotation issuthe configurationes.
# This is done using toJSON to avoid bash quotation issues.
downloadPayload = builtins.toJSON {
operation = "download";
objects = [ pointer ];

View File

@ -2,12 +2,10 @@
{ urbit, herb, arvo ? null, pill, ship ? "bus" }:
stdenvNoCC.mkDerivation {
name = "test-${ship}";
stdenvNoCC.mkDerivation {name = "test-${ship}";
buildInputs = [ cacert urbit herb ];
phases = [ "buildPhase" "installPhase " ];
phases = [ "buildPhase" "installPhase" "checkPhase" ];
buildPhase = ''
set -xeuo pipefail
@ -100,5 +98,40 @@ stdenvNoCC.mkDerivation {
cp -r test-output-* $out/
'';
meta = { platforms = [ "x86_64-linux" ]; };
checkPhase = ''
hdr () {
echo =====$(sed 's/./=/g' <<< "$1")=====
echo ==== $1 ====
echo =====$(sed 's/./=/g' <<< "$1")=====
}
for f in $(find "$out/" -type f); do
hdr "$(basename $f)"
cat "$f"
done
fail=0
for f in $(find "$out/" -type f); do
if egrep "((FAILED|CRASHED)|(ford|warn):) " $f >/dev/null; then
if [[ $fail -eq 0 ]]; then
hdr "Test Failures"
fi
echo "ERROR Test failure in $(basename $f)"
((fail++))
fi
done
if [[ $fail -eq 0 ]]; then
hdr "Success"
fi
exit "$fail"
'';
meta = {
platforms = [ "x86_64-linux" "x86_64-darwin" ];
};
}

40
sh/test
View File

@ -1,40 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
pkg="$(nix-build -A urbit-tests --no-out-link "$@")"
hdr () {
echo =====$(sed 's/./=/g' <<< "$1")=====
echo ==== $1 ====
echo =====$(sed 's/./=/g' <<< "$1")=====
}
for f in $(find "$pkg/" -type f)
do
hdr "$(basename $f)"
cat "$f"
done
fail=0
for f in $(find "$pkg/" -type f)
do
if egrep "((FAILED|CRASHED)|(ford|warn):) " $f >/dev/null
then
if [[ $fail -eq 0 ]]
then
hdr "Test Failures"
fi
echo "ERROR Test failure in $(basename $f)"
((fail++))
fi
done
if [[ $fail -eq 0 ]]
then
hdr "Success"
fi
exit "$fail"