#!/bin/sh # Superficial execution tests testPrintFromStdin() { stdout=$(echo 'print("Hello")' | pypy3) assertEquals 'Execute code from stdin' Hello "$stdout" } testPrintFromMinusC() { stdout=$(pypy3 -c 'print("Hello")') assertEquals 'Execute code from -c' Hello "$stdout" } # Stdlib testImportStdLib() { pypy3 -c 'import os.path' assertTrue 'Import os.path' $? } testImportTk() { # Tkinter's cffi library lives in a separate binary package, to keep # Depends manageable. Check that we point users to it. if dpkg-query -f '${db:Status-Abbrev}\n' -W pypy3-tk | grep -q ^.i; then # autopkgtest can't Conflict, so we just skip if it's present startSkipping fi stderr=$(pypy3 -c 'import tkinter' 2>&1) assertFalse 'Fail to import Tk when not installed' $? echo "$stderr" | grep -Fq 'please install the pypy3-tk package' assertTrue 'Suggest installing pypy3-tk' $? } testImportCFFI() { # Are all the modules that use cffi importable? # They're built separately, and often link to shared libs pypy3 -c 'import audioop' assertTrue 'Import audioop' $? pypy3 -c 'import _blake2' assertTrue 'Import _blake2' $? pypy3 -c 'import curses' assertTrue 'Import curses' $? pypy3 -c 'import decimal' assertTrue 'Import decimal' $? pypy3 -c 'import _gdbm' assertTrue 'Import _gdbm' $? pypy3 -c 'import lzma' assertTrue 'Import lzma' $? pypy3 -c 'import pwd, grp' assertTrue 'Import pwd, grp' $? pypy3 -c 'import _sha3' assertTrue 'Import _sha3' $? pypy3 -c 'import ssl' assertTrue 'Import ssl' $? pypy3 -c 'import resource' assertTrue 'Import resource' $? pypy3 -c 'import sqlite3' assertTrue 'Import sqlite3' $? pypy3 -c 'import syslog' assertTrue 'Import syslog' $? } . shunit2