Permalink
Browse files

Got the test cases for bytecode determinism failing again.

BOTH stdlib and OPy fail easily!  Only a few iterations necessary.

co_names is in a different order.
  • Loading branch information...
Andy Chu
Andy Chu committed Mar 17, 2018
1 parent 9dbeb4b commit e1ad2a54014296f746ef3abdeeca208a7d2a7f4d
Showing with 40 additions and 8 deletions.
  1. +23 −1 opy/determinism.sh
  2. +17 −7 opy/smoke.sh
View
@@ -1,5 +1,11 @@
#!/bin/bash
#
# 2018 experiments on determism. There are 2017 experiments in compare.sh and
# misc/determinism.py.
#
# I think I fixed the misc.Set() bug in OPy, but there still remained CPython
# determinism. However I haven't reproduced it on a small case.
#
# Usage:
# ./determinism.sh <function name>
@@ -9,7 +15,9 @@ set -o errexit
dictset() {
local n=${1:-30}
seq $n | python -c '
local python=${2:-python}
seq $n | $python -c '
import sys
d = {}
s = set()
@@ -40,4 +48,18 @@ compare-seed() {
done
}
# Hm this is stable oto.
compare-python() {
for i in $(seq 10); do
dictset
dictset '' ../_devbuild/cpython-full/python
done
}
#
# OPy
#
# See smoke.sh
"$@"
View
@@ -154,10 +154,6 @@ opy-hello3() {
# Doesn't suffice for for compiler2 determinism.
#export PYTHONHASHSEED=0
inspect-pyc() {
PYTHONPATH=. misc/inspect_pyc.py "$@"
}
# For comparing different bytecode.
compare-bytecode() {
local left=$1
@@ -166,8 +162,8 @@ compare-bytecode() {
md5sum "$@"
ls -l "$@"
inspect-pyc $left > _tmp/pyc-left.txt
inspect-pyc $right > _tmp/pyc-right.txt
opyc-dis $left > _tmp/pyc-left.txt
opyc-dis $right > _tmp/pyc-right.txt
$DIFF _tmp/pyc-{left,right}.txt || true
return
@@ -214,8 +210,22 @@ determinism-loop() {
done
}
opyc-dis() { ../bin/opyc dis "$@"; }
opyc-compile() { ../bin/opyc compile "$@"; }
stdlib-compile() { misc/stdlib_compile.py "$@"; }
# FAILS
opy-determinism-loop() {
determinism-loop _compile-one ../core/lexer.py
#local file=../core/lexer.py
local file=../core/word_compile.py # flanders has issue
determinism-loop opyc-compile $file
}
# FAILS
stdlib-determinism-loop() {
#local file=../core/lexer.py
local file=../core/word_compile.py # flanders has issue
determinism-loop stdlib-compile $file
}
# Not able to reproduce the non-determinism with d.keys()? Why not?

0 comments on commit e1ad2a5

Please sign in to comment.