57 lines
1.5 KiB
Python
57 lines
1.5 KiB
Python
import os
|
|
import re
|
|
import shutil
|
|
|
|
def CheckOutput(output):
|
|
return output == 'Hello world!\n'
|
|
|
|
def test_c():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_cs():
|
|
print(os.getcwd())
|
|
fh = os.popen("mono ./HelloWorld.exe", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_java():
|
|
print(os.getcwd())
|
|
fh = os.popen("/usr/lib/jvm/java-15-openjdk/bin/java HelloWorld", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_bash():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld.bash", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_perl():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld.pl", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_php():
|
|
print(os.getcwd())
|
|
fh = os.popen("php ./HelloWorld.php", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_python():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld.py", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|