Exemple #1
0
	def initialize(self):
		super().initialize()
		try:
			self.command = command.Command(self.path)
			self.version = "Currently not supported";
			self.arch = "Currently not supported";
			testr.writeln("Target renjin initialized:")
		except IOError:
			testr.fatalError("Target path {0} not found!".format(self.path))
Exemple #2
0
	def _exec(self, cmd, args = (), input = None, timeout = 600):
		if (self._displayFullCommand):
			testr.writeln(self.name()+": "+self.path+" "+" ".join(args))
		result = cmd.run(args,input,timeout) 
		if (self._displayOutput):
			testr.writeln(self.name()+": output: ")
			testr.writeln("  "+"\n  ".join(result[0].split("\n")))
			if (result[1]):
				testr.writeln(self.name()+": error: ")
				testr.writeln("  "+"\n  ".join(result[1].split("\n")))
		return result
Exemple #3
0
	def initialize(self, targets):
		testr.writeln("  initializing module test")
		if (not targets):
			testr.fatalError("module test must have at least one target specified")
		self.count = 0
		self.passed = [0] * len(targets)
		self.failed = [0] * len(targets)
		self.execFailed = [0] * len(targets)
		self.skipped = [0] * len(targets)
		self._targets = targets
		self._tlocal = Module.TL()
		self._longestTargetName = max([ len(i.name()) for i in targets])
Exemple #4
0
	def initialize(self, targets):
		testr.writeln("  initializing module timer")
		if (not targets):
			testr.fatalError("module timer must have at least one target specified")
		self.count = 0
		self._targets = targets
		self._tlocal = Module.TL()
		self._longestTargetName = max([ len(i.name()) for i in targets])
		self.write(testr.truncIfLonger("test name",70))
		for t in targets:
			self.write(" | {0:17}".format(t.name()))
		self.writeln("")
		self.writeln("-" * (70 + len(targets) * 20))
Exemple #5
0
	def _extractOutput(self, runOut):
		""" Returns only those lines correspondling to the output of the run. Skips all lines to the first prompt and then only displays those lines that do not start with either > (prompt) or + (prompt continuation). If your target does not follow this convention you may need to reqrite this method. """
		runOut = super()._extractOutput(runOut);
		output = ""
		for line in runOut.split("\n"):
			l = line.strip()
			if (l.find("[truffle]") != 0):
				if (l):
					output += line+"\n"
			else:
				if (self._printTruffleInfo):
					testr.writeln(l)
		return output
Exemple #6
0
	def doParseArgument(self, name, value):
		""" Analyzes the given argument specified by its name and value. This method should return True if the argument is recognized and the value is correct, should return False if the argument is not recognized and should call the testr.fatalError function if the argument is recognized, but the value is not recognized.
	   
		Override this method while calling the inherited one to provide new functionality. 
	    """
		if (name in ("path", "p")):
			testr.writeln("  path changed to {0}".format(value))
			self.path = value
		elif (name in ("arg", "a")):
			if (self.cmdArguments == self.defaultCmdArguments()):
				self.cmdArguments = [value,]
			else: # multiple default arguments can be concatenated
				self.cmdArguments.append(value)
		elif (name in ('displayCmd', 'dc')):
			self._displayFullCommand = True if value else False
		elif (name in ('displayOutput', 'do')):
			self._displayOutput = True if value else False
		else:
			return False
		return True
Exemple #7
0
	def initialize(self):
		super().initialize()
		try:
			self.command = command.Command(self.path)
			v = self.command.run(args= self._arguments() + ("--version",))
			print(v[1])
			v = v[1].split("\n") if command._isWindows else v[0].split("\n")
			self.version = v[0].strip().split(" ")[2]
			if (self.version[0] == "3"):
				self.arch = v[2].strip().split(" ")[1]
			else:
				self.arch = v[3].strip().split(" ")[1]
			testr.writeln("Target R initialized:")
			testr.writeln("  arch:    {0}".format(self.arch))
			testr.writeln("  version: {0}".format(self.version))
			testr.writeln("  path:    {0}".format(self.path))  
		except IOError:
			testr.fatalError("Target path {0} not found!".format(self.path))
Exemple #8
0
	def initialize(self):
		super().initialize()
		try:
			self.command = command.Command(self.path)
			self.version = "Currently not supported";
			self.arch = "Currently not supported";
			#v = self.command.run(args= self.cmdArguments)
			#v = v[1].split("\n") if command._isWindows else v[0].split("\n")
			#self.LAPACK = v[0].split(" ")[2].strip()
			#self.BLAS = v[1].split(" ")[2].strip()
			#self.GNUR = v[2].split(" ")[2].strip()
			testr.writeln("Target fastr initialized:")
			testr.writeln("  arch:    {0}".format(self.arch))
			testr.writeln("  version: {0}".format(self.version))
			testr.writeln("  path:    {0}".format(self.path))  
			#testr.writeln("  LAPACK: {0}".format(self.LAPACK))
			#testr.writeln("  BLAS:   {0}".format(self.BLAS))
			#testr.writeln("  GNUR:   {0}".format(self.GNUR))  
		except IOError:
			testr.fatalError("Target path {0} not found!".format(self.path))
Exemple #9
0
	def initialize(self, targets):
		testr.writeln("  initializing module counter")
		if (targets):
			testr.fatalError("  module counter can only be used with no targets")
		self.count = 0
Exemple #10
0
	def writeln(self,*args, force=False):
		testr.writeln(*args,force=force)
		if (self.outputFile):
			self.outputFile.write("".join([str(i) for i in args])+"\n")
Exemple #11
0
	def __init__(self):
		testr.writeln("  creating module counter")
		self.outputFile = None
Exemple #12
0
	def initialize(self):
		testr.writeln("initializing target {0}".format(self.name()))
		pass
Exemple #13
0
	def __init__(self, args):
		""" Initializes the test suite from the arguments parsed. """
		self.recursive = None # none so that we can check that it was specified only once
		self.roots = []
		self.whitelist = []
		self.blacklist = []
		i = 0
		testr.writeln("parsing arguments for the testsuite")
		while (i < len(args)):
			argName, argValue = args[i]
			if (argName in ("suite","s")):
				if (not os.path.exists(argValue)):
					testr.fatalError("test suite root directory {0} not found".format(argValue))
				testr.writeln("  suite {0} added".format(argValue))
				self.roots.append((argValue, argValue))
			elif (argName in ("recursive","r")):
				if (self.recursive != None):
					testr.fatalError("argument recursive, or r can be used only once")
				if (argValue not in (True, False)):
					testr.fatalError("only True, False, or empty value are allowed for argument {0}".format(argName))
				if (argValue):
					testr.writeln("  test suite will be scanned recursively")
				else:
					testr.writeln("  test suite will not be scanned recursively. Only suite roots will be analyzed for test files") 
				self.recursive = argValue
			elif (argName in ("whitelist", "wl")):
				if (self.blacklist):
					testr.fatalError("whitelist cannot be specified together with blacklist")
				self.whitelist += [ item.strip() for item in argValue.split(",")]
				testr.writeln("  whitelist is now {0}".format(",".join(self.whitelist)))
			elif (argName in ("blacklist", "bl")):
				if (self.whitelist):
					testr.fatalError("blacklist cannot be specified together with whitelist")
				self.blacklist += [ item.strip() for item in argValue.split(",")]
				testr.writeln("  blacklist is now {0}".format(",".join(self.blacklist)))
			else:
				i += 1
				continue
			args.pop(i)
		if (self.recursive == None): # if recursive was not set set it to its default value
			self.recursive = True
		self._lock = threading.Lock()
		self._i = self._ennumerate()