Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-19084 Regression Test Engine should handle syntactically wrong tags in ECL files. #10872

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions testing/regress/ecl-test
Expand Up @@ -284,6 +284,7 @@ class RegressMain:
logging.critical(e)
exit(e.getErrorCode());
except Exception as e:
logging.critical("Regression Test Engine internal error")
logging.critical(e)
logging.critical(traceback.format_exc())
except KeyboardInterrupt:
Expand Down
2 changes: 2 additions & 0 deletions testing/regress/hpcc/common/error.py
Expand Up @@ -34,6 +34,8 @@
"6002": "OS error when try to call ecl command!",
"6003": "Parameter error when try to call ecl command!",
"6004": "Can't connect to remote HPCC System!",
"6005": "Syntax error in //skip tag!",
"6006": "Error in build suite"
}


Expand Down
78 changes: 43 additions & 35 deletions testing/regress/hpcc/regression/suite.py
Expand Up @@ -18,13 +18,12 @@
'''

import os
import sys
import time
import glob

from ..util.ecl.file import ECLFile
from ..common.error import Error
from ..util.util import checkClusters, getConfig
from ..util.util import getConfig

class Suite:
def __init__(self, clusterName, dir_ec, dir_a, dir_ex, dir_r, logDir, dir_inc, args, isSetup=False, fileList = None):
Expand Down Expand Up @@ -81,44 +80,53 @@ def buildSuite(self, args, isSetup, fileList):
classExcluded = args.excludeclass[0].split(',')
pass

exceptions = ''
for file in allfiles:
if file.endswith(".ecl"):
ecl = os.path.join(self.dir_ec, file)
eclfile = ECLFile(ecl, self.dir_a, self.dir_ex,
self.dir_r, self.dir_inc, self.clusterName, args)
if isSetup:
skipResult = eclfile.testSkip('setup')
else:
skipResult = eclfile.testSkip(self.targetName)

if not skipResult['skip']:
exclude=False
exclusionReason=''
try:
ecl = os.path.join(self.dir_ec, file)
eclfile = ECLFile(ecl, self.dir_a, self.dir_ex,
self.dir_r, self.dir_inc, self.clusterName, args)
if isSetup:
exclude = eclfile.testExclusion('setup')
exclusionReason=' setup'
elif ( 'all' not in classIncluded ) or ('none' not in classExcluded):
included = True
if 'all' not in classIncluded:
included = eclfile.testInClass(classIncluded)
excluded = False
if 'none' not in classExcluded:
excluded = eclfile.testInClass(classExcluded)
exclude = (not included ) or excluded
exclusionReason=' class member excluded'
if not exclude:
exclude = eclfile.testExclusion(self.targetName)
exclusionReason=' ECL excluded'

if not exclude:
self.addFileToSuite(eclfile)
skipResult = eclfile.testSkip('setup')
else:
self.exclude.append(format(file, "30")+exclusionReason)
else:
self.exclude.append(format(file, "30")+" skipped (reason:"+skipResult['reason']+")");
skipResult = eclfile.testSkip(self.targetName)

if not skipResult['skip']:
exclude=False
exclusionReason=''
if isSetup:
exclude = eclfile.testExclusion('setup')
exclusionReason=' setup'
elif ( 'all' not in classIncluded ) or ('none' not in classExcluded):
included = True
if 'all' not in classIncluded:
included = eclfile.testInClass(classIncluded)
excluded = False
if 'none' not in classExcluded:
excluded = eclfile.testInClass(classExcluded)
exclude = (not included ) or excluded
exclusionReason=' class member excluded'
if not exclude:
exclude = eclfile.testExclusion(self.targetName)
exclusionReason=' ECL excluded'

if not exclude:
self.addFileToSuite(eclfile)
else:
self.exclude.append(format(file, "30")+exclusionReason)
else:
self.exclude.append(format(file, "30")+" skipped (reason:"+skipResult['reason']+")");

if eclfile.testPublish():
self.publish.append(eclfile.getBaseEcl())
except Error as e:
exceptions += str(e)
except:
raise

if eclfile.testPublish():
self.publish.append(eclfile.getBaseEcl())
if exceptions != '':
raise Error("6006", err="%s" % (exceptions))

def addFileToSuite(self, eclfile):
haveVersions = eclfile.testVesion()
Expand Down
47 changes: 27 additions & 20 deletions testing/regress/hpcc/util/ecl/file.py
Expand Up @@ -26,7 +26,7 @@
import unicodedata

from ...util.util import isPositiveIntNum, getConfig

from ...common.error import Error
class ECLFile:
ecl = None
xml_e = None
Expand Down Expand Up @@ -284,29 +284,36 @@ def __checkSkip(self, skipText, skip):
skip = skip.lower()
eclText = open(self.getEcl(), 'r')
skipLines = []
lineNo=0
for line in eclText:
lineNo += 1
line = line.lower()
if skipText in line:
skipLines.append(line.rstrip('\n'))
skipLines.append({'line': line.rstrip('\n'), 'lineNo' : lineNo})
if len(skipLines) > 0:
for skipLine in skipLines:
skipParts = skipLine.split()
skipType = skipParts[1]
skipReason = None

if len(skipParts) == 3:
skipReason = skipParts[2]
splitChar = '='

if "==" in skipType:
splitChar='=='
skipType = skipType.split(splitChar)[1]

if not skip:
return {'reason': skipReason, 'type': skipType}

if skip == skipType:
return {'skip': True, 'type' : skipType, 'reason': skipReason}
try:
for skipLine in skipLines:
skipParts = skipLine['line'].split()
skipType = skipParts[1]
skipReason = None

if len(skipParts) == 3:
skipReason = skipParts[2]
splitChar = '='

if "==" in skipType:
splitChar='=='
skipType = skipType.split(splitChar)[1]

if not skip:
return {'reason': skipReason, 'type': skipType}

if skip == skipType:
return {'skip': True, 'type' : skipType, 'reason': skipReason}
except Exception as e:
logging.debug( e, extra={'taskId':self.taskId})
logging.debug("%s", traceback.format_exc().replace("\n","\n\t\t"), extra={'taskId':self.taskId} )
raise Error("6005", err='file: %s:%d\n text: \"%s\"' % (self.getEcl(), skipLine['lineNo'], skipLine['line']))

return {'skip': False}

Expand Down