Skip to content

Commit

Permalink
Merge pull request #270 from vincentcasseau/dev
Browse files Browse the repository at this point in the history
KCore - test: define a list of tests to ignore in debug mode
  • Loading branch information
vincentcasseau authored Jan 29, 2025
2 parents cdd92dc + 08fcec7 commit e1dad98
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Cassiopee/KCore/test/compareSessionLogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
import sys
from time import strptime, strftime

# Tests to ignore in non-debug mode
IGNORE_TESTS_NDBG = []
# Tests to ignore in debug mode
IGNORE_TESTS_DBG = [
"Ael/quantum_t1.py", "Converter/mpi4py_t1.py", "KCore/empty_t1.py"
]


# Parse command-line arguments
def parseArgs():
import argparse
Expand Down Expand Up @@ -118,6 +126,12 @@ def getDiffExecTime(test, ref, new):
diffNew = round((newExecTime-baseExecTime)/baseExecTime*100., 1)
return diffRef, diffNew

# Return a list of tests to ignore for a given prod.
def tests2Ignore(prod):
if '_DBG' in prod:
return IGNORE_TESTS_DBG
return IGNORE_TESTS_NDBG

# Stringify test comparison
def stringify(test='', ref='', new=''):
if not test:
Expand Down Expand Up @@ -150,6 +164,9 @@ def stringify(test='', ref='', new=''):
newSession = readLog(script_args.logs[1])
gitInfo = readGitInfo(script_args.logs[1])

# Get prod name
prod = getProd(script_args.logs[1])

# Draw a one-to-one correspondance between tests of each session
# (module + testname)
refDict = dict((test[0] + '/' + test[1], test[2:]) for test in refSession)
Expand All @@ -165,6 +182,7 @@ def stringify(test='', ref='', new=''):
deletedTests = sorted(refSet - newSet)
# Find failed tests in newSession
failedTests = sorted([k for k, v in newDict.items() if v[5] != 'OK'])
failedTests = [t for t in failedTests if t not in tests2Ignore(prod)]

# Write differences to terminal or send an email
baseState = 'OK'
Expand Down Expand Up @@ -226,7 +244,6 @@ def stringify(test='', ref='', new=''):
if cmpt == 0: compStr += "[none]\n"

baseStateMsg = ""
prod = getProd(script_args.logs[1])
tlog, tlog2 = getTimeFromLog(script_args.logs[1])
messageSubject = "[validCassiopee - {}] {} - State: {}".format(prod, tlog, baseState)
messageText = header + compStr + baseStateMsg
Expand Down

0 comments on commit e1dad98

Please sign in to comment.