Skip to content

Instantly share code, notes, and snippets.

@mabdi
Created April 22, 2020 13:01
Show Gist options
  • Save mabdi/2e6dc00ea3c39c21ee8584ef4c8b0811 to your computer and use it in GitHub Desktop.
Save mabdi/2e6dc00ea3c39c21ee8584ef4c8b0811 to your computer and use it in GitHub Desktop.
I use this code to run smallamp inside a Ubuntu
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