mirror of
https://github.com/urbit/shrub.git
synced 2024-11-24 04:58:08 +03:00
test: remove herb from test suite
This commit is contained in:
parent
216d63a910
commit
98d202d44b
@ -109,7 +109,6 @@ let
|
||||
|
||||
urbit-debug = urbit.override { enableDebug = true; };
|
||||
urbit-tests = libLocal.testFakeShip {
|
||||
inherit herb;
|
||||
inherit arvo;
|
||||
|
||||
urbit = urbit-debug;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{ lib, stdenvNoCC, cacert }:
|
||||
{ lib, stdenvNoCC, curl }:
|
||||
|
||||
{ urbit, herb, arvo ? null, pill, ship, arguments ? [ "-l" ] }:
|
||||
{ urbit, arvo ? null, pill, ship, arguments ? [ "-l" ] }:
|
||||
|
||||
let
|
||||
|
||||
@ -10,16 +10,11 @@ let
|
||||
in stdenvNoCC.mkDerivation {
|
||||
name = "fake-${ship}";
|
||||
|
||||
buildInputs = [ cacert urbit herb ];
|
||||
buildInputs = [ curl urbit ];
|
||||
|
||||
phases = [ "buildPhase" "installPhase " ];
|
||||
|
||||
buildPhase = ''
|
||||
if ! [ -f "$SSL_CERT_FILE" ]; then
|
||||
header "$SSL_CERT_FILE doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
urbit ${lib.concatStringsSep " " args} ./pier
|
||||
@ -34,13 +29,27 @@ in stdenvNoCC.mkDerivation {
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1)
|
||||
|
||||
lensd() {
|
||||
curl -f -s \
|
||||
--data "{\"source\":{\"dojo\":\"$1\"},\"sink\":{\"stdout\":null}}" \
|
||||
"http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g'
|
||||
}
|
||||
|
||||
lensa() {
|
||||
curl -f -s \
|
||||
--data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \
|
||||
"http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g'
|
||||
}
|
||||
|
||||
check () {
|
||||
[ 3 -eq "$(herb ./pier -d 3)" ]
|
||||
[ 3 -eq "$(lensd 3)" ]
|
||||
}
|
||||
|
||||
if check && sleep 10 && check; then
|
||||
header "boot success"
|
||||
herb ./pier -p hood -d '+hood/exit'
|
||||
lensa hood '+hood/exit'
|
||||
while [ -f ./pier/.vere.lock ]; do
|
||||
echo "waiting for pier to shut down"
|
||||
sleep 5
|
||||
@ -48,8 +57,11 @@ in stdenvNoCC.mkDerivation {
|
||||
else
|
||||
header "boot failure"
|
||||
kill $(< ./pier/.vere.lock) || true
|
||||
set +x
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set +x
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
@ -1,16 +1,16 @@
|
||||
{ lib, stdenvNoCC, cacert, python3, bootFakeShip }:
|
||||
{ lib, stdenvNoCC, curl, python3, bootFakeShip }:
|
||||
|
||||
{ urbit, herb, arvo ? null, pill, ship ? "bus", arguments ? urbit.meta.arguments
|
||||
{ urbit, arvo ? null, pill, ship ? "bus", arguments ? urbit.meta.arguments
|
||||
, doCheck ? true }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "test-${ship}";
|
||||
|
||||
src = bootFakeShip { inherit urbit herb arvo pill ship; };
|
||||
src = bootFakeShip { inherit urbit arvo pill ship; };
|
||||
|
||||
phases = [ "unpackPhase" "buildPhase" "checkPhase" ];
|
||||
|
||||
buildInputs = [ cacert urbit herb python3 ];
|
||||
buildInputs = [ curl python3 urbit ];
|
||||
|
||||
unpackPhase = ''
|
||||
cp -R $src ./pier
|
||||
@ -26,6 +26,22 @@ stdenvNoCC.mkDerivation {
|
||||
# See: https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959
|
||||
python3 -c $'import os\n[os.set_blocking(i, True) for i in range(3)]\n'
|
||||
|
||||
port=$(cat ./pier/.http.ports | grep loopback | tr -s ' ' '\n' | head -n 1)
|
||||
|
||||
lensd() {
|
||||
# -f elided, this can hit server-side timeouts
|
||||
curl -s \
|
||||
--data "{\"source\":{\"dojo\":\"$1\"},\"sink\":{\"stdout\":null}}" \
|
||||
"http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g'
|
||||
}
|
||||
|
||||
lensa() {
|
||||
# -f elided, this can hit server-side timeouts
|
||||
curl -s \
|
||||
--data "{\"source\":{\"dojo\":\"$2\"},\"sink\":{\"app\":\"$1\"}}" \
|
||||
"http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g'
|
||||
}
|
||||
|
||||
tail -F urbit-output >&2 &
|
||||
|
||||
tailproc=$!
|
||||
@ -41,69 +57,69 @@ stdenvNoCC.mkDerivation {
|
||||
|
||||
# measure initial memory usage
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %init-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %init-mass-end ~'
|
||||
lensd '~& ~ ~& %init-mass-start ~'
|
||||
lensa hood '+hood/mass'
|
||||
lensd '~& ~ ~& %init-mass-end ~'
|
||||
|
||||
# run the unit tests
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %test-unit-start ~'
|
||||
herb ./pier -d '####-test %/tests ~'
|
||||
herb ./pier -d '~& ~ ~& %test-unit-end ~'
|
||||
lensd '~& ~ ~& %test-unit-start ~'
|
||||
lensd '-test %/tests ~'
|
||||
lensd '~& ~ ~& %test-unit-end ~'
|
||||
|
||||
# use the :test app to build all agents, generators, and marks
|
||||
#
|
||||
herb ./pier -p hood -d '+hood/start %test'
|
||||
lensa hood '+hood/start %test'
|
||||
|
||||
herb ./pier -d '~& ~ ~& %test-agents-start ~'
|
||||
herb ./pier -p test -d '%agents'
|
||||
herb ./pier -d '~& ~ ~& %test-agents-end ~'
|
||||
lensd '~& ~ ~& %test-agents-start ~'
|
||||
lensa test '%agents'
|
||||
lensd '~& ~ ~& %test-agents-end ~'
|
||||
|
||||
herb ./pier -d '~& ~ ~& %test-generators-start ~'
|
||||
herb ./pier -p test -d '%generators'
|
||||
herb ./pier -d '~& ~ ~& %test-generators-end ~'
|
||||
lensd '~& ~ ~& %test-generators-start ~'
|
||||
lensa test '%generators'
|
||||
lensd '~& ~ ~& %test-generators-end ~'
|
||||
|
||||
herb ./pier -d '~& ~ ~& %test-marks-start ~'
|
||||
herb ./pier -p test -d '%marks'
|
||||
herb ./pier -d '~& ~ ~& %test-marks-end ~'
|
||||
lensd '~& ~ ~& %test-marks-start ~'
|
||||
lensa test '%marks'
|
||||
lensd '~& ~ ~& %test-marks-end ~'
|
||||
|
||||
# measure memory usage post tests
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %test-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %test-mass-end ~'
|
||||
lensd '~& ~ ~& %test-mass-start ~'
|
||||
lensa hood '+hood/mass'
|
||||
lensd '~& ~ ~& %test-mass-end ~'
|
||||
|
||||
# defragment the loom
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %pack-start ~'
|
||||
herb ./pier -p hood -d '+hood/pack'
|
||||
herb ./pier -d '~& ~ ~& %pack-end ~'
|
||||
lensd '~& ~ ~& %pack-start ~'
|
||||
lensa hood '+hood/pack'
|
||||
lensd '~& ~ ~& %pack-end ~'
|
||||
|
||||
# reclaim space within arvo
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %trim-start ~'
|
||||
herb ./pier -p hood -d '+hood/trim'
|
||||
herb ./pier -d '~& ~ ~& %trim-end ~'
|
||||
lensd '~& ~ ~& %trim-start ~'
|
||||
lensa hood '+hood/trim'
|
||||
lensd '~& ~ ~& %trim-end ~'
|
||||
|
||||
# measure memory usage pre |meld
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %trim-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %trim-mass-end ~'
|
||||
lensd '~& ~ ~& %trim-mass-start ~'
|
||||
lensa hood '+hood/mass'
|
||||
lensd '~& ~ ~& %trim-mass-end ~'
|
||||
|
||||
# globally deduplicate
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %meld-start ~'
|
||||
herb ./pier -p hood -d '+hood/meld'
|
||||
herb ./pier -d '~& ~ ~& %meld-end ~'
|
||||
lensd '~& ~ ~& %meld-start ~'
|
||||
lensa hood '+hood/meld'
|
||||
lensd '~& ~ ~& %meld-end ~'
|
||||
|
||||
# measure memory usage post |meld
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %meld-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %meld-mass-end ~'
|
||||
lensd '~& ~ ~& %meld-mass-start ~'
|
||||
lensa hood '+hood/mass'
|
||||
lensd '~& ~ ~& %meld-mass-end ~'
|
||||
|
||||
herb ./pier -p hood -d '+hood/exit'
|
||||
lensa hood '+hood/exit'
|
||||
|
||||
cleanup
|
||||
|
||||
@ -128,6 +144,8 @@ stdenvNoCC.mkDerivation {
|
||||
mkdir -p $out
|
||||
|
||||
cp test-output-* $out/
|
||||
|
||||
set +x
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
@ -168,6 +186,4 @@ stdenvNoCC.mkDerivation {
|
||||
# Fix 'bind: operation not permitted' when nix.useSandbox = true on darwin.
|
||||
# See https://github.com/NixOS/nix/blob/5f6840fbb49ae5b534423bd8a4360646ee93dbaf/src/libstore/build.cc#L2961
|
||||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
meta = { platforms = [ "x86_64-linux" ]; };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user