-
Notifications
You must be signed in to change notification settings - Fork 3
/
runtests.py
68 lines (44 loc) · 1.24 KB
/
runtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import subprocess
import shutil
import sys
import prep
TOWNSTYPE="DEV"
THISFILE=os.path.realpath(__file__)
THISDIR=os.path.dirname(THISFILE)
TSUGARUDIR=os.path.join(THISDIR,"..","TOWNSEMU")
BUILDDIR=os.path.join(TSUGARUDIR,"build")
SRCDIR=os.path.join(TSUGARUDIR,"src")
ROMDIR=os.path.join(TSUGARUDIR,"..","TOWNSEMU_TEST","ROM_"+TOWNSTYPE)
DISKDIR=os.path.join(TSUGARUDIR,"..","TOWNSEMU_TEST","DISKIMG")
MEMCARDDIR=os.path.join(TSUGARUDIR,"..","TOWNSEMU_TEST","MEMCARD")
DISCDIR=os.path.join("/","d","TownsISO")
def ExeExtension():
if sys.platform.startswith('win'):
return ".exe"
else:
return ""
def TsugaruExe():
fName=os.path.join(BUILDDIR,"main_cui","Tsugaru_CUI"+ExeExtension())
if os.path.isfile(fName):
return fName
fName=os.path.join(BUILDDIR,"main_cui","Release","Tsugaru_CUI"+ExeExtension())
if os.path.isfile(fName):
return fName
print("Tsugaru executable not found")
ErrorExit()
def ErrorExit():
print("Error.")
quit()
def PrepRun(cmd):
proc=subprocess.Popen(cmd)
proc.communicate()
if 0!=proc.returncode:
ErrorExit()
def Run(argv):
os.chdir(os.path.join(THISDIR,"scratch"))
PrepRun(["cmake","../tests"])
PrepRun(["ctest","-C","Release"]+argv)
if __name__=="__main__":
prep.Prep()
Run(sys.argv[1:])