Permalink
Browse files

Shell functions to publish OPy test output for the release.

Make notes about './regtest.sh verify-golden'.

The golden files are specific to Python 2.7.12 (as opposed to .13 or
.14).  Gah.
  • Loading branch information...
Andy Chu
Andy Chu committed Jul 12, 2018
1 parent f3484d8 commit d9afd05f84f980d1c543a932334ed5aba8bc1d2c
Showing with 79 additions and 9 deletions.
  1. +12 −1 opy/build.sh
  2. +16 −4 opy/regtest.sh
  3. +7 −3 scripts/count.sh
  4. +44 −1 scripts/release.sh
View
@@ -62,11 +62,22 @@ _compile-tree() {
# Used by the Makefile.
compile-manifest() {
local dest_dir=$1
# Python 2.7.14 on Ubuntu 17.10: ./regtest.sh verify-golden doesn't work.
# Many diffs.
# Our own Python 2.7.13: doesn't work.
#local py=../_devbuild/cpython-full/python
# Our own Python 2.7.12: Just one diff in hashlib.pyc!
#local py=../_devbuild/cpython-full-2712/python
local py=''
while read full_src_path rel_dest_path; do
local dest=$dest_dir/$rel_dest_path
mkdir -p $(dirname $dest)
log " $full_src_path"
$THIS_DIR/../bin/opyc compile $full_src_path $dest
$py $THIS_DIR/../bin/opyc compile $full_src_path $dest
local rel_py_path=${rel_dest_path%.pyc}.py # .pyc -> py
View
@@ -77,6 +77,15 @@ checksum() {
find _tmp/regtest -type f | xargs $THIS_DIR/../bin/opyc dis-md5 | sort -n
}
# NOTE: This doesn't work on Ubuntu 17.10 because it uses Python 2.7.14, and I
# generated the golden file on Ubuntu 16.04 with Python 2.7.12. (Although I
# verified it on two different machines with Python 2.7.12.) I'm not going to
# worry about it for now because I think it's due to marshal / hashing
# differences, and OPy will eventually not use marshal, and probably not
# hashing either.
#
# See comments in 'build.sh compile-manifest'.
verify-golden() {
if checksum | diff -u _regtest/dis-md5.golden.txt -; then
echo OK
@@ -89,13 +98,16 @@ lines() {
find _regtest/src -type f | xargs wc -l | sort -n
}
compare-one() {
local rel_path='opy/compiler2/transformer.pyc'
# For debugging golden differences. We want it to be the same on multiple
# machines.
compare-other-machine() {
local rel_path=${1:-'opy/compiler2/transformer.pyc'}
# TODO: Copy zip from flanders?
local zip=_tmp/flanders/bytecode-opy.zip
ls -l _tmp/regtest/$rel_path
# TODO: Copy zip from flanders?
unzip -p $rel_path _tmp/flanders/bytecode-opy.zip | od -c
unzip -p $rel_path $zip | od -c
}
smoke-three-modes() {
View
@@ -203,8 +203,10 @@ top-level() {
_python-symbols() {
local main=$1
local name=$2
local out_dir=$3
local out=_tmp/${name}-python-symbols.txt
mkdir -p $out_dir
local out=${out_dir}/${name}.txt
CALLGRAPH=1 $main | tee $out
@@ -214,11 +216,13 @@ _python-symbols() {
}
oil-python-symbols() {
_python-symbols bin/oil.py oil
local out_dir=${1:-_tmp/metrics/symbols}
_python-symbols bin/oil.py oil $out_dir
}
opy-python-symbols() {
_python-symbols bin/opy_.py opy
local out_dir=${1:-_tmp/metrics/symbols}
_python-symbols bin/opy_.py opy $out_dir
}
old-style-classes() {
View
@@ -5,7 +5,7 @@
#
# Steps:
# build/doc.sh update-src-versions (optional)
# $0 build-and-test (builds tarball, runs spec tests, etc.)
# $0 build-and-test (builds tarball, runs unit/spec/gold tests, etc.)
# prereq: build/codegen.sh {download,install}-re2c
# test/wild.sh all
# benchmarks:
@@ -155,6 +155,46 @@ _test-release-build() {
OSH_OVM=$OSH_RELEASE_BINARY test/spec.sh all
}
# NOTE: Following opy/README.md. Right now this is a quick and dirty
# verification. For example we found out something about the golden checksums
# for the OPy regtest!
test-opy() {
local out=$PWD/_tmp/opy-release
mkdir -p $out
pushd opy
local step=''
step='build-oil-repo'
echo "--- $step ---"
time ./build.sh oil-repo > $out/$step.txt 2>&1
echo $?
step='test-oil-unit-byterun'
echo "--- $step ---"
time ./test.sh oil-unit-byterun > $out/$step.txt 2>&1
echo $?
step='test-gold'
echo "--- $step ---"
time ./test.sh gold > $out/$step.txt 2>&1
echo $?
# Hm does this need its own table output?
step='test-spec-all'
echo "--- $step ---"
time ./test.sh spec all > $out/$step.txt 2>&1
echo $?
# NOTE: This is sensitive to Python 2.7.12 vs .13 vs .14, so don't bother
# publishing it for now.
#./regtest.sh compile > $out/regtest-compile.txt
#./regtest.sh verify-golden > $out/regtest-verify-golden.txt
popd
}
# TODO: Log this whole thing? Include logs with the /release/ page?
build-and-test() {
# 5 steps: clean, dev build, unit tests, release build, end-to-end tests.
@@ -549,6 +589,9 @@ metrics() {
line-counts $out/line-counts
scripts/count.sh oil-python-symbols $out/symbols
scripts/count.sh opy-python-symbols $out/symbols
tree $out
}

0 comments on commit d9afd05

Please sign in to comment.