update script now prints when each folder is updated

This commit is contained in:
Bryan Herman 2013-08-12 19:18:09 -04:00
parent dbb89870e5
commit 4ab6937039

View file

@ -4,6 +4,22 @@ import os
import sys
from subprocess import Popen, STDOUT, PIPE
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def disable(self):
self.HEADER = ''
self.OKBLUE = ''
self.OKGREEN = ''
self.WARNING = ''
self.FAIL = ''
self.ENDC = ''
# Check for arguments
if len(sys.argv) > 1:
folders = []
@ -23,15 +39,26 @@ for root, dirs, files in folders:
# Don't continue if not prefixed by test
if root[0:4] != 'test':
continue
# Skip test compile or plot
if root == 'test_compile' or root.find('plot') != -1:
continue
# Go into that directory
os.chdir(root)
pwd = os.path.abspath(os.path.dirname('settings.xml'))
os.putenv('PWD', pwd)
# Print status to screen
sys.stdout.write(root+'... ')
# Run openmc
proc = Popen(['../../src/openmc'])
proc = Popen(['../../src/openmc'], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
if returncode == 0:
sys.stdout.write(bcolors.OKGREEN + "OK" + bcolors.ENDC + "\n")
else:
sys.stdout.write(bcolors.FAIL + "ERROR" + bcolors.ENDC + "\n")
# Process results
os.system('python results.py')