Skip to content

Commit

Permalink
[test/spec-runner] Able to publish HTML results from Alpine.
Browse files Browse the repository at this point in the history
Addresses issue #167.

Still needs a lot of cleanup.
  • Loading branch information
Andy Chu committed Mar 7, 2020
1 parent f6f770d commit ea0d987
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 10 deletions.
7 changes: 4 additions & 3 deletions test/alpine2.sh
Expand Up @@ -51,6 +51,7 @@ setup-dns() {

# bash, make, gcc, musl-dev: to compile Oil
# python2, gawk: to run spec tests
# zip: for publishing it
#
# What about xargs? It uses --verbose, which busybox doesn't have.
# I think I should run a minimal serial test runner, in Python maybe?
Expand All @@ -60,7 +61,7 @@ add-oil-build-deps() {
local chroot_dir=${1:-$CHROOT_DIR}
sudo chroot $chroot_dir /bin/sh <<EOF
apk update
apk add bash make gcc musl-dev python2 gawk
apk add bash make gcc musl-dev python2 gawk zip
EOF
}

Expand All @@ -79,13 +80,13 @@ test-tar() {
make-oil-spec() {
# TODO: maybe get rid of doctools
# test/spec.sh is just for reference
# web/ dir because we want the end user to be able to see it
# web/*.css dir because we want the end user to be able to see it
find \
benchmarks/time_.py \
test/sh_spec.py doctools/{html_head,doc_html,__init__}.py \
test/{common,spec-common,spec,spec-alpine,spec-runner}.sh \
spec/ \
web/ \
web/*.css \
-type f \
| xargs tar --create > _tmp/oil-spec.tar
}
Expand Down
72 changes: 71 additions & 1 deletion test/spec-alpine.sh
Expand Up @@ -99,8 +99,78 @@ all() {
export OSH_LIST=osh OIL_LIST=oil SPEC_RUNNER='test/spec-alpine.sh run-test'

# this is like test/spec.sh {oil,osh}-all
test/spec-runner.sh all-parallel oil "$@"
test/spec-runner.sh all-parallel osh "$@"
#test/spec-runner.sh all-parallel oil "$@"
}

home-page() {
cat <<EOF
<h1>Spec Test Results</h2>
<a href="_tmp/spec/osh.html">osh.html</a> <br/>
<a href="_tmp/spec/oil.html">oil.html</a> <br/>
EOF
}

# oilshell.org/spec-results/$date-$hostname-$distro.wwz/
# _tmp/spec/ # from _tmp/spec
# osh.html
# oil.html
# web/ # from web

manifest() {
find index.html _tmp/spec/ web/ -type f
}

archive-results() {
local archive_type=${1:-zip} # zip or tar

home-page > index.html
local out_name="$(date +%Y-%m-%d__%H-%M-%S)__$(hostname)"

case $archive_type in
# zip isn't in POSIX so some systems might not have it.
tar)
local out=$out_name.tar.gz
manifest | xargs -- tar -c -z > $out
;;

zip)
# .wwz is just a zip file that is served
local out=$out_name.wwz
manifest | xargs -- zip $out
;;

*)
die "Invalid type $archive_type"
;;
esac

ls -l $out
}

# similar to web/publish.sh

publish() {
### Publish results to oilshell.org/spec-results
local user=$1
local host=$user.org

local path=$2

local dest='oilshell.org/spec-results'
ssh $user@$host mkdir --verbose -p $dest
scp $path $user@$host:$dest

echo "Visit http://$dest/$(basename $path)/"
}

copy-out() {
local out=_tmp/spec-results
mkdir -p $out
cp -v _chroot/spec-alpine/src/oil-spec/*.wwz $out
ls -l $out
}

"$@"
7 changes: 1 addition & 6 deletions test/spec-runner.sh
Expand Up @@ -283,11 +283,6 @@ html-summary() {
echo "Results: file://$PWD/$out"
}

link-web() {
# No long flags like --verbose because of busybox
ln -s -f -v $PWD/web _tmp
}

_all-parallel() {
local suite=${1:-osh-oil}
local manifest="_tmp/spec/SUITE-$suite.txt"
Expand All @@ -304,7 +299,7 @@ _all-parallel() {

all-tests-to-html $manifest

link-web
# note: the HTML links to ../../web/, which is in the repo.

html-summary $suite
}
Expand Down

0 comments on commit ea0d987

Please sign in to comment.