aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mgba/test-py.sh
diff options
context:
space:
mode:
authorAlexander Edland <s@ocv.me>2018-08-05 02:20:25 +0200
committerShiz <hi@shiz.me>2018-08-05 04:02:18 +0200
commitd7f2885f1d94f54ceea0f5e9b79e6e92e1ef7df5 (patch)
treeaa9b472226d726ff0e0662a3c4f47045f8017ec4 /testing/mgba/test-py.sh
parente41ff98770060e26b0a3211e2bfaa066ac44fca4 (diff)
downloadaports-d7f2885f1d94f54ceea0f5e9b79e6e92e1ef7df5.tar.bz2
aports-d7f2885f1d94f54ceea0f5e9b79e6e92e1ef7df5.tar.xz
testing/mgba: new aport
Diffstat (limited to 'testing/mgba/test-py.sh')
-rw-r--r--testing/mgba/test-py.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/testing/mgba/test-py.sh b/testing/mgba/test-py.sh
new file mode 100644
index 0000000000..af47e0a7c9
--- /dev/null
+++ b/testing/mgba/test-py.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+mkdir test-py
+cd test-py
+
+cat > test.py <<'EOF'
+import sys
+import mgba.core
+import mgba.image
+
+core = mgba.core.loadPath(sys.argv[1])
+screen = mgba.image.Image(*core.desiredVideoDimensions())
+core.setVideoBuffer(screen)
+core.reset()
+
+for i in range(2000):
+ core.runFrame()
+
+with open("dump.png".format(i), "wb") as f:
+ screen.savePNG(f)
+EOF
+
+echo "using LD_LIBRARY_PATH [$LD_LIBRARY_PATH]"
+echo "using PYTHONPATH [$PYTHONPATH]"
+echo "using ZIPFILE [$ZIPFILE]"
+
+unzip "$ZIPFILE"
+echo "running Z80 cpu test suite"
+python3 test.py "cpu_instrs/cpu_instrs.gb"
+ls -al dump.png
+[ $(wc -c < dump.png) -gt 768 ]