From 4ab6937039bfa76e61842d80434bd0c8ca9fe85c Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 12 Aug 2013 19:18:09 -0400 Subject: [PATCH] update script now prints when each folder is updated --- tests/update_results.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/update_results.py b/tests/update_results.py index 9b51076a4a..7c562ed6c5 100644 --- a/tests/update_results.py +++ b/tests/update_results.py @@ -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')