[llvm-commits] CVS: llvm/test/QMTest/llvm.py

John Criswell criswell at cs.uiuc.edu
Fri Oct 10 15:26:01 PDT 2003


Changes in directory llvm/test/QMTest:

llvm.py updated: 1.16 -> 1.17

---
Log message:

Removed the AnalyzeTest class.
Corrected the code that checks for the exit status of child processes.
We should be able to detect program crashes much better now.



---
Diffs of the changes:  (+12 -74)

Index: llvm/test/QMTest/llvm.py
diff -u llvm/test/QMTest/llvm.py:1.16 llvm/test/QMTest/llvm.py:1.17
--- llvm/test/QMTest/llvm.py:1.16	Fri Oct 10 14:51:36 2003
+++ llvm/test/QMTest/llvm.py	Fri Oct 10 15:25:27 2003
@@ -73,7 +73,7 @@
 	# Wait for the child process to exit.
 	#
 	(pid, status) = os.waitpid (child, 0)
-	return ((os.WIFEXITED(status)) and (os.WEXITSTATUS(status) != 0))
+	return (not ((os.WIFEXITED(status)) and ((os.WEXITSTATUS(status)) == 0)))
 
 ##############################################################################
 #
@@ -296,12 +296,12 @@
 		# Assemble the program into C code and then compile it.
 		#
 		estatus=os.system (ccmd)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			fail = 1
 			result.Fail('Converting to C code failed')
 		else:
 			estatus=os.system (lcmd)
-			if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+			if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 				fail = 1
 				result.Fail('Compiling code failed')
 			else:
@@ -505,7 +505,7 @@
 		p=' | '
 
 		estatus = os.system (as + ' < ' + file + p + opt + ' -q -inline -dce ' + flags + p + dis + p + as + ' > ' + 'bc.1')
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			result.Fail()
 			return;
 
@@ -513,7 +513,7 @@
 		# Now, attempt to optimize the the program again.
 		#
 		estatus=os.system (opt + ' -q ' + flags + ' < ' + 'bc.1 > ' + 'bc.2')
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			result.Fail()
 			return
 
@@ -765,82 +765,20 @@
 		#
 		# Assemble the program.
 		#
-		estatus=os.system (as + ' -f -o ' + bcfile + ' ' + srcfile)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (ExecProgram ((as, '-f', '-o', bcfile, srcfile))):
 			result.Fail('Failed to assemble LLVM code')
 
 		#
 		# Execute the program.
 		#
 		estatus=os.system (lli + ' ' + bcfile + ' < /dev/null')
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			result.Fail('LLI failed to execute bytecode')
 
 		return
 
 ##############################################################################
 #
-# Class: AnalyzeTest
-#
-# Description:
-#	This class runs an LLVM assembly language program through the analyzer.
-#
-##############################################################################
-class AnalyzeTest(qm.test.test.Test):
-
-	#
-	# Description
-	#
-	description="Verifies that LLVM can analyze a file"
-
-	#
-	# List of arguments that the objects accepts for test configuration.
-	#
-	arguments = [
-		qm.fields.TextField(name='srcfile',
-		                    title='LLVM Assembly File',
-		                    description='LLVM Assembly File to Analyze'),
-	]
-
-	devnull = ' > /dev/null 2>&1'
-
-	def Run (self, context, result):
-		#
-		# Set the core dump size
-		#
-		coresize=int(context['coresize'])
-		resource.setrlimit (resource.RLIMIT_CORE, (coresize,coresize))
-
-		#
-		# Fetch the source and build root directories from the context.
-		#
-		srcroot=context['srcroot']
-		buildroot=context['buildroot']
-		tmpdir=context['tmpdir']
-
-		#
-		# Construct the pathname of the source file and object file.
-		#
-		srcfile=srcroot + '/' + self.srcfile
-
-		#
-		# Construct the pathnames to the various utilities.
-		#
-		anal  = buildroot + '/tools/' + context['buildtype'] + '/analyze -tddatastructure'
-
-		#
-		# Use the LLVM assembler to assemble the program.
-		#
-		cmd = anal + ' ' + srcfile + self.devnull
-		estatus=os.system (cmd)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
-			result.Fail()
-
-		return
-
-
-##############################################################################
-#
 # Class: TestRunner
 #
 # Description:
@@ -1019,12 +957,12 @@
 		# Assemble the program into C code and then compile it.
 		#
 		estatus=os.system (ccmd)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			fail = 1
 			result.Fail('Compiling C code failed')
 		else:
 			estatus=os.system (acmd)
-			if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+			if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 				fail = 1
 				result.Fail('Compiling code failed')
 			else:
@@ -1107,12 +1045,12 @@
 		# Assemble the program into C code and then compile it.
 		#
 		estatus=os.system (ccmd)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			fail = 1
 			result.Fail('Compiling C++ code failed')
 		else:
 			estatus=os.system (acmd)
-			if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+			if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 				fail = 1
 				result.Fail('Compiling code failed')
 			else:
@@ -1198,7 +1136,7 @@
 		# Execute make to build the programs.
 		#
 		estatus=os.system (make)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+		if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))):
 			result.Fail()
 
 		#





More information about the llvm-commits mailing list