Created
April 22, 2020 13:01
-
-
Save mabdi/2e6dc00ea3c39c21ee8584ef4c8b0811 to your computer and use it in GitHub Desktop.
I use this code to run smallamp inside a Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
def getTodo(): | |
f = open("todo.txt", "r") | |
todo = f.readlines() | |
f.close() | |
return todo | |
def checkDone(className): | |
f = open("done.txt","r") | |
dones = f.readlines() | |
f.close() | |
for cname in dones: | |
if cname == className: return True | |
return False | |
def getStat(className): | |
f = open('out/'+className.strip() + '.out', "r") | |
log = f.read() | |
if not 'Run finish' in log: return 'Crash' | |
if 'Error details' in log: | |
return 'Error' | |
else: | |
return 'success' | |
def markAsDone(className): | |
stat = getStat(className) | |
f = open("done.txt","a") | |
f.write(className) | |
f.write(':') | |
f.write(stat) | |
f.write(os.linesep) | |
f.close() | |
todo = getTodo() | |
vm = "./pharo" | |
image = "myvms/Test1/Pharo.image" | |
for cname in todo: | |
className = cname.strip() | |
if className.strip() == '' : continue | |
print('processing: ' + className) | |
if (checkDone(className)): | |
print('skip: ' + className) | |
else: | |
cmd = 'SmallAmp initializeDefault testCase: {} ; amplifyEval'.format( className.strip()) | |
print(cmd) | |
os.system(vm + ' ' + image + ' eval \'' + cmd + '\' > out/'+className.strip() + '.out') | |
markAsDone(className) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment