Browse Source

prism-auto: Make sure nailgun is closed down if the script ends with an error (and refactor the exit code).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11743 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 9 years ago
parent
commit
0f9dfe0275
  1. 17
      prism/etc/scripts/prism-auto

17
prism/etc/scripts/prism-auto

@ -362,7 +362,7 @@ def runPrism(args, dir=""):
print("To see log file, run:")
print("edit " + logFile)
if not options.testAll:
sys.exit(1)
closeDown(1)
# Print a testing-related message, colour coding if needed
@ -468,7 +468,7 @@ def benchmark(file, args, dir=""):
# print "Out files to verify exports against: " + ' '.join(outFiles)
allEqual = verifyAndCleanupExports(outFiles, exportPrefix)
if (not allEqual) and (not options.testAll):
sys.exit(1)
closeDown(1)
# Execute benchmarking based on a directory
# Unless requested not to (via -n/--non-recursive), the directory is searched recursively.
@ -639,12 +639,17 @@ def printUsage():
print("Usage: prism-auto ...")
def signal_handler(signal, frame):
closeDown(1)
# Close down neatly, stopping nailgun if needed
def closeDown(exitCode):
if options.nailgun:
if options.echo or options.echoFull:
print(options.ngprism + " stop")
else:
subprocess.Popen([options.ngprism, "stop"]).wait()
sys.exit(1)
sys.exit(exitCode)
# Main program
@ -691,8 +696,4 @@ for arg in args:
benchmarkFile(arg)
else:
print("Error: File/directory " + arg + " does not exist")
if options.nailgun:
if options.echo or options.echoFull:
print(options.ngprism + " stop")
else:
subprocess.Popen([options.ngprism, "stop"]).wait()
closeDown(0)
Loading…
Cancel
Save