From eb5028dbf867f7ec2a2ec618ddee13e0639da5fe Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Wed, 14 Sep 2016 11:16:53 +0000 Subject: [PATCH] prism-auto: add --dd-warnings mode for printing the CUDD reference leak warnings git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11812 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/etc/scripts/prism-auto | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/prism/etc/scripts/prism-auto b/prism/etc/scripts/prism-auto index 3911b5dd..65ef818a 100755 --- a/prism/etc/scripts/prism-auto +++ b/prism/etc/scripts/prism-auto @@ -341,13 +341,18 @@ def runPrism(args, dir=""): prismArgs = prismArgs + ['-mainlog', logFile] exitCode = subprocess.Popen(prismArgs).wait() #exitCode = subprocess.Popen(prismArgs, cwd=dir, stdout=f).wait() - elif options.test: + elif options.test or options.ddWarnings: f = tempfile.NamedTemporaryFile(delete=False) logFile = f.name prismArgs = prismArgs + ['-mainlog', logFile] exitCode = subprocess.Popen(prismArgs).wait() else: exitCode = subprocess.Popen(prismArgs).wait() + # Extract DD reference count warnings + if options.ddWarnings: + for line in open(logFile, 'r').readlines(): + if re.match('Warning: CUDD reports .* non-zero references', line): + printTestResult(line) # Extract test results if needed if options.test: for line in open(logFile, 'r').readlines(): @@ -374,6 +379,8 @@ def printTestResult(msg): # Coloured-coded... if 'Error:' in msg or 'FAIL' in msg: print('\033[31m' + msg + '\033[0m') + elif 'Warning:' in msg: + print('\033[31;1m' + msg + '\033[0m') elif 'PASS' in msg: print('\033[32m' + msg + '\033[0m') elif 'SKIPPED' in msg or 'NOT TESTED' in msg: @@ -673,6 +680,7 @@ parser.add_option("--debug", action="store_true", dest="debug", default=False, h parser.add_option("--echo-full", action="store_true", dest="echoFull", default=False, help="An expanded version of -e/--echo") parser.add_option("--models-filename", dest="modelsFilename", metavar="X", default="models", help="Read in list of models/parameters for a directory from file X, if present [default=models]") parser.add_option("--no-export-tests", action="store_true", dest="noExportTests", default=False, help="Don't check exported files when in test mode") +parser.add_option("--dd-warnings", action="store_true", dest="ddWarnings", default=False, help="Print the DD reference count warnings") parser.add_option("--colour", dest="colourEnabled", metavar="X", type="choice", choices=["yes","no","auto"], default="auto", help="Whether to colour test results: yes, no, auto (yes iff in terminal mode) [default=auto]") (options, args) = parser.parse_args() if len(args) < 1: