Skip to content

Instantly share code, notes, and snippets.

@bhyde
Created July 8, 2014 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhyde/f3adbd06661c706d919a to your computer and use it in GitHub Desktop.
Save bhyde/f3adbd06661c706d919a to your computer and use it in GitHub Desktop.
Assuming you have a working docker setup 'quickload_system_test foo' will (ql:load "foo") in a container and leave a of that in runs/foo/foo.log
#!/bin/bash
cd $(dirname $0)
set -o nounset -o errexit
function LOG(){ echo "LOG: $*" ; }
function ERROR(){ echo "ERROR: $*" ; }
function cleanup(){ echo '' ; }
trap "cleanup; ERROR in $0; exit 1" ERR
if [[ 0 == $# ]] ; then ERROR "missing system name arg."; exit 1; fi
QL_SYSTEM="$1"
DIR="runs/$QL_SYSTEM"
rm -rf "$DIR"
mkdir -p "$DIR"
cd "$DIR"
LOG "Test via container $QL_SYSTEM"
docker run "--name=$QL_SYSTEM" --interactive bhyde/crate-of-ccl <<EOF > /dev/null 2>&1 \
|| LOG Container exited with an error.
(ccl:quit
(handler-case
(progn (ql:quickload "$QL_SYSTEM") 0)
(error (e) (format *error-output* "ERROR ~A" e) 1)))
EOF
docker logs "$QL_SYSTEM" > "$QL_SYSTEM.log" 2>&1
LOG "discarding container for $(docker rm "$QL_SYSTEM")"
echo ...
head -40 "$QL_SYSTEM.log" | sed -n '/Welcome/p'
echo ...
tail -1 "$QL_SYSTEM.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment