Commit 1866b885 authored by Isaac's avatar Isaac

Simplified pytest stuff

parent 6e074cfb
......@@ -5,7 +5,7 @@ stages:
- mubench
before_script:
- source ./init_test_env.sh
- source ./init_test_env.sh release
build:
stage: build
......@@ -15,7 +15,7 @@ build:
- rustup default stable # Change `stable` to whatever rust toolchain you want, it will be installed and set as the default
- rustc --version
- cargo clean
- time cargo test -j6 --$ZEBU_BUILD --no-run --color=always
- time cargo test -j6 --$ZEBU_BUILD --no-run --color=always # This needs to go before mu-tool-compiler
- if [ ! -d $CI_HOME/antlr4 ]; then # Compile the antlr runtime
- git clone https://github.com/antlr/antlr4.git $CI_HOME/antlr4
- pushd $CI_HOME/antlr4/runtime/Cpp
......@@ -45,12 +45,9 @@ build:
- popd
- fi
- if [ ! -d $CI_HOME/mu-perf-benchmarks ]; then
- deactivate
- git clone https://gitlab.anu.edu.au/mu/mu-perf-benchmarks.git $CI_HOME/mu-perf-benchmarks
- source $CI_HOME/venv3/bin/activate
- source $CI_HOME/venv3/bin/activate # Switch to python3
- pip install -Ue $CI_HOME/mu-perf-benchmarks
- deactivate
- source $CI_HOME/venv2/bin/activate
- fi
artifacts:
paths:
......@@ -121,51 +118,48 @@ testjit:cmpops:
testjit:controlflow:
stage: test
script:
# run this test under test_jit directory
# as a C source file is expected in a relative path to current working directory
- cd tests/test_jit; pytest test_controlflow.py -v --color=yes
- pytest tests/test_jit/test_controlflow.py -v --color=yes
testjit:convops:
stage: test
script:
- cd tests/test_jit; pytest test_convops.py -v --color=yes
- pytest tests/test_jit/test_convops.py -v --color=yes
testjit:double:
stage: test
script:
- cd tests/test_jit; pytest test_double.py -v --color=yes
- pytest tests/test_jit/test_double.py -v --color=yes
testjit:memops:
stage: test
script:
- cd tests/test_jit; pytest test_memops.py -v --color=yes
- pytest tests/test_jit/test_memops.py -v --color=yes
testjit:milestones:
stage: test
script:
- cd tests/test_jit; pytest test_milestones.py -v --color=yes
- pytest tests/test_jit/test_milestones.py -v --color=yes
testjit:otherops:
stage: test
script:
- cd tests/test_jit; pytest test_otherops.py -v --color=yes
- pytest tests/test_jit/test_otherops.py -v --color=yes
testjit:rpython:
stage: test
script:
- cd tests/test_jit; LD_LIBRARY_PATH=./emit:$LD_LIBRARY_PATH MU_LOG_LEVEL=info pytest test_rpython*.py -v --color=yes
- LD_LIBRARY_PATH=./emit:$LD_LIBRARY_PATH MU_LOG_LEVEL=info pytest tests/test_jit/test_rpython*.py -v --color=yes
testjit:som:
stage: test
script:
- cd tests/test_jit; MU_LOG_LEVEL=info pytest test_som.py -v --color=yes
- MU_LOG_LEVEL=info pytest tests/test_jit/test_som.py -v --color=yes
mubench:
stage: mubench
script:
- cp $MU_ZEBU/target/$ZEBU_BUILD/deps/libmu.so ./target/$ZEBU_BUILD/libmu.so
- deactivate
- source $CI_HOME/venv3/bin/activate
- source $CI_HOME/venv3/bin/activate # Switch to python3
- mkdir ci
- mubench local $CI_HOME/mu-perf-benchmarks/ci/*.yml --dump $CI_HOME/results/$(git log -1 --pretty="%h_%at") --pipeline ""
- if [ "$(hostname)" == "angus" ]; then rsync -a $CI_HOME/results/* squirrel:~/mu-impl-fast/angus; fi
......
export CI_HOME=~/mu-ci/ # Where to put all the depencies
mkdir -p $CI_HOME/results # Where performance results will go
export RUSTUP_HOME=$CI_HOME/.rustup # rust will use this instead of ~/.rustup
export CARGO_HOME=$CI_HOME/.cargo # rust will use this instead of ~/.cargo
# Install rustup if we haven't yet
if [ ! -f $CARGO_HOME/bin/rustup ]; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none; fi
source $CARGO_HOME/env # Set up $PATH appropriately
export MU_ZEBU=$PWD
export ZEBU_BUILD=release
export CC=clang
export CXX=clang++
export RUST_TEST_THREADS=1
export LD_LIBRARY_PATH=$MU_ZEBU/tests/test_jit/emit:$MU_ZEBU/target/$ZEBU_BUILD/deps/:$CI_HOME/antlr4/usr/local/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$CI_HOME/mu-client-pypy:$CI_HOME/RPySOM/src
export RPYSOM=$CI_HOME/RPySOM
export PYPY=$CI_HOME/mu-client-pypy
export MUC=$CI_HOME/mu-tool-compiler/muc
if [ ! -d $CI_HOME/venv2 ]; then
virtualenv -p python2 $CI_HOME/venv2
source $CI_HOME/venv2/bin/activate
pip install pytest
if test $# -lt 1 || test $# -gt 3; then
echo "Usage: ./init_test_env.sh <release|debug> [zebu-dir]"
echo " Where zebu-dir defaults to $PWD"
else
export ZEBU_BUILD=$1
if test "$2" == ""; then
export MU_ZEBU=$PWD
else
export MU_ZEBU=$2;
fi
export CI_HOME=~/mu-ci # Where to put all the depencies
mkdir -p $CI_HOME/results # Where performance results will go
export RUSTUP_HOME=$CI_HOME/.rustup # rust will use this instead of ~/.rustup
export CARGO_HOME=$CI_HOME/.cargo # rust will use this instead of ~/.cargo
# Install rustup if we haven't yet
if [ ! -f $CARGO_HOME/bin/rustup ]; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none; fi
source $CARGO_HOME/env # Set up $PATH appropriately
export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | sed 's!/mu-impl-fast/target/[^/]*/deps/!/REMOVED/!g') # Delete any existing zebu's (so they don't accidently get used)
export LD_LIBRARY_PATH=$MU_ZEBU/emit:$MU_ZEBU/target/$ZEBU_BUILD/deps/:$CI_HOME/antlr4/usr/local/lib:$LD_LIBRARY_PATH
export CC=clang
export CXX=clang++
export RUST_TEST_THREADS=1
export PYTHONPATH=$CI_HOME/mu-client-pypy:$CI_HOME/RPySOM/src
export RPYSOM=$CI_HOME/RPySOM
export PYPY=$CI_HOME/mu-client-pypy
export MUC=$CI_HOME/mu-tool-compiler/muc
if [ ! -d $CI_HOME/venv2 ]; then
virtualenv -p python2 $CI_HOME/venv2
source $CI_HOME/venv2/bin/activate
pip install pytest
fi
source $CI_HOME/venv2/bin/activate
if [ ! -d $CI_HOME/venv3 ]; then virtualenv -p python3 $CI_HOME/venv3; fi
fi
if [ ! -d $CI_HOME/venv3 ]; then virtualenv -p python3 $CI_HOME/venv3; fi
......@@ -102,6 +102,7 @@ def ctypes_fncptr_from_lib(libpath, fnc_name, argtypes=[], restype=ctypes.c_long
fnp.restype = restype
return fnp, lib
def rffi_fncptr_from_lib(libpath, fnc_name, llargtypes, restype, mode=ctypes.RTLD_GLOBAL):
from rpython.rtyper.lltypesystem import rffi
from rpython.translator.platform import platform
......@@ -112,7 +113,6 @@ def rffi_fncptr_from_lib(libpath, fnc_name, llargtypes, restype, mode=ctypes.RTL
libname = libpath.basename[3:libpath.basename.index(libext)]
if mode == ctypes.RTLD_GLOBAL:
sys.stderr.write(libpath.strpath)
lib = ctypes.CDLL(libpath.strpath, mode) # preload lib using RTLD_GLOBAL
return rffi.llexternal(fnc_name, llargtypes, restype,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment