urbit/nix/ops/test/builder.sh

81 lines
1.8 KiB
Bash
Raw Normal View History

2019-03-05 03:43:53 +03:00
source $stdenv/setup
set -ex
cp -r $SHIP ./ship
chmod -R u+rw ./ship
$URBIT -d ./ship 2> urbit-output
2019-03-05 03:43:53 +03:00
tail -f urbit-output >&2 &
tailproc=$!
shutdown () {
if [ -e ./ship/.vere.lock ]
then kill $(< ./ship/.vere.lock) || true;
fi
kill "$tailproc" || true;
}
trap shutdown EXIT
2019-07-10 10:33:41 +03:00
herb ./ship -p hood -d '+hood/mass'
2020-06-25 09:14:16 +03:00
# Run the unit tests and then print scrollback
herb ./ship -d '~& ~ ~& %test-unit-start ~'
herb ./ship -d '####-test %/tests'
2020-06-25 09:14:16 +03:00
herb ./ship -d '~& ~ ~& %test-unit-end ~'
2019-03-05 03:43:53 +03:00
2020-06-25 09:14:16 +03:00
# Start and run the test app
herb ./ship -p hood -d '+hood/start %test'
2019-07-10 10:33:41 +03:00
2020-06-25 09:14:16 +03:00
herb ./ship -d '~& ~ ~& %test-agents-start ~'
herb ./ship -p test -d '%agents'
herb ./ship -d '~& ~ ~& %test-agents-end ~'
2019-03-05 03:43:53 +03:00
2020-06-25 09:14:16 +03:00
herb ./ship -d '~& ~ ~& %test-generators-start ~'
herb ./ship -p test -d '%generators'
herb ./ship -d '~& ~ ~& %test-generators-end ~'
2020-06-25 09:14:16 +03:00
herb ./ship -d '~& ~ ~& %test-marks-start ~'
herb ./ship -p test -d '%marks'
herb ./ship -d '~& ~ ~& %test-marks-end ~'
2019-03-05 03:43:53 +03:00
2020-06-25 09:14:16 +03:00
# compact the loom, comparing memory use before and after
2019-07-10 10:33:41 +03:00
herb ./ship -p hood -d '+hood/mass'
2020-06-25 09:14:16 +03:00
herb ./ship -d '~& ~ ~& %pack-start ~'
2019-11-23 04:25:18 +03:00
herb ./ship -p hood -d '+hood/pack'
2020-06-25 09:14:16 +03:00
herb ./ship -d '~& ~ ~& %pack-end ~'
herb ./ship -p hood -d '+hood/mass'
2019-11-23 04:25:18 +03:00
2019-03-05 03:43:53 +03:00
shutdown
# Collect output
2020-06-25 09:14:16 +03:00
cp urbit-output test-output-unit
cp urbit-output test-output-agents
cp urbit-output test-output-generators
cp urbit-output test-output-marks
2019-03-05 03:43:53 +03:00
rm urbit-output
2020-06-25 09:14:16 +03:00
sed -i '0,/test-unit-start/d' test-output-unit
sed -i '/test-unit-end/,$d' test-output-unit
sed -i '0,/test-agents-start/d' test-output-agents
sed -i '/test-agents-end/,$d' test-output-agents
sed -i '0,/test-generators-start/d' test-output-generators
sed -i '/test-generators-end/,$d' test-output-generators
2019-03-05 03:43:53 +03:00
2020-06-25 09:14:16 +03:00
sed -i '0,/test-marks-start/d' test-output-marks
sed -i '/test-marks-end/,$d' test-output-marks
2019-03-05 03:43:53 +03:00
mkdir $out
2020-06-25 09:14:16 +03:00
cp -r test-output-* $out/
set +x