#!/usr/bin/env bash # # Usage: # ./test.sh set -o nounset set -o pipefail set -o errexit proc make-zip { local out=_tmp/make-zip-test.zip build/make_zip.py $out _build/runpy-deps-py.txt unzip -l $out } proc hello-bundle { set +o errexit _bin/hello.ovm if test $Status = 1 { echo OK } else { echo 'FAIL: expected exit code 1' exit 1 } } proc oil-bundle { _bin/oil.ovm osh -c 'echo hi' ln -s -f oil.ovm _bin/osh _bin/osh -c 'echo hi from osh' } proc _tarball { local name=$(1:-hello) local version=$(2:-0.0.0) local tmp=_tmp/$(name)-tar-test rm -r -f $tmp mkdir -p $tmp cd $tmp tar --extract -z < ../../_release/$name-$version.tar.gz cd $name-$version ./configure # Build the fast one for a test. # TODO: Maybe edit the Makefile to change the top target. local bin=_bin/$(name).ovm # not dbg time make $bin $bin --version } proc hello-tar { _tarball hello $[head -n 1 build/testdata/hello-version.txt] } proc oil-tar { _tarball oil $[head -n 1 oil-version.txt] } # Test the different entry points. proc ovm-main-func { echo --- echo 'Running nothing' echo --- local ovm=_build/hello/ovm-dbg env _OVM_RUN_SELF=0 $ovm || true echo --- echo 'Running bytecode.zip' echo --- env _OVM_RUN_SELF=0 $ovm _build/hello/bytecode.zip || true # Doesn't work because of stdlib deps? echo --- echo 'Running lib.pyc' echo --- env _OVM_RUN_SELF=0 $ovm build/testdata/lib.pyc } @Argv