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

John Criswell criswell at cs.uiuc.edu
Fri Oct 10 14:52:01 PDT 2003


Changes in directory llvm/test/QMTest:

llvm.py updated: 1.15 -> 1.16
llvmdb.py updated: 1.6 -> 1.7

---
Log message:

Renamed the feature subtests so that they do not begin with 'f'.  It was
never necessary to do that to denote them as feature tests.
Removed the Feature.asm tests as they are the same as the Feature.mc
tests.
Removed the AssemblyCodeTest class as it is no longer used.
Improved the MachineCodeTest class so that it uses ExecProgram() and
verifies that the output assembly file is actually generated..



---
Diffs of the changes:  (+18 -100)

Index: llvm/test/QMTest/llvm.py
diff -u llvm/test/QMTest/llvm.py:1.15 llvm/test/QMTest/llvm.py:1.16
--- llvm/test/QMTest/llvm.py:1.15	Tue Oct  7 15:55:15 2003
+++ llvm/test/QMTest/llvm.py	Fri Oct 10 14:51:36 2003
@@ -326,99 +326,16 @@
 
 ##############################################################################
 #
-# Class: MachineCodeTest
-#
-# Description:
-#	This test verifies that the specified bytecode file can be converted
-#	into machine code.
-#
-##############################################################################
-class MachineCodeTest(qm.test.test.Test):
-
-	description="Verifies that LLVM can convert a file into machine code"
-
-	#
-	# List of arguments that the objects accepts for test configuration.
-	#
-	arguments = [
-		qm.fields.TextField(name='srcfile',
-		                    title='LLVM Assembly Language File',
-		                    description='LLVM Assembly Language File to Convert to Machine Code'),
-	]
-
-
-	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
-		bcfile=tmpdir + '/' + os.path.basename (self.srcfile) + '.bc'
-		objfile=tmpdir + '/' + os.path.basename (self.srcfile) + '.mc'
-
-		#
-		# Construct the pathnames to the various utilities.
-		#
-		as   = buildroot + '/tools/' + context['buildtype'] + '/llvm-as'
-		llc  = buildroot + '/tools/' + context['buildtype'] + '/llc'
-
-		#
-		# Use the LLVM assembler to assemble the program.
-		#
-		cmd = as + ' -f -o=' + bcfile + ' ' + srcfile + self.devnull
-		estatus=os.system (cmd)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
-			result.Fail ('Failed to assemble program')
-
-		#
-		# Use LLC to compile the program into native assembly code.
-		#
-		cmd = llc + ' ' + bcfile + ' -f -o=' + objfile + self.devnull
-		estatus=os.system (cmd)
-		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
-			fail = 1
-			result.Fail('Failed to compile bytecode')
-		else:
-			fail = 0
-
-		#
-		# Cleanup the file if it exists.
-		#
-		if ((os.access(objfile,os.F_OK)) == 1):
-			os.remove (objfile)
-		else:
-			if (fail == 0):
-				result.Fail ('Object file not created')
-
-		return
-
-##############################################################################
-#
 # Class: AssemblyCodeTest
 #
 # Description:
 #	This test verifies that the specified bytecode file can be converted
-#	into assembly code.
+#	into native assembly code.
 #
 ##############################################################################
-class AssemblyCodeTest(qm.test.test.Test):
+class MachineCodeTest(qm.test.test.Test):
 
-	description="Verifies that LLVM can convert a file into assembly code"
+	description="Verifies that LLVM can convert a file into native assembly code"
 
 	#
 	# List of arguments that the objects accepts for test configuration.
@@ -426,11 +343,9 @@
 	arguments = [
 		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Assembly Code File',
-		                    description='LLVM Assembly Code File to Convert to Machine Code'),
+		                    description='LLVM Assembly Code File to Convert to Native Assembly Code'),
 	]
 
-	devnull = ' > /dev/null 2>&1'
-
 	def Run (self, context, result):
 
 		#
@@ -450,8 +365,8 @@
 		# Construct the pathname of the source file and object file.
 		#
 		srcfile=srcroot + '/' + self.srcfile
-		bcfile=tmpdir + '/feature-' + os.path.basename (self.srcfile)
-		objfile=tmpdir + '/feature-' + self.srcfile + '.s'
+		bcfile=tmpdir + '/feature-mc-' + os.path.basename (self.srcfile)
+		objfile=tmpdir + '/feature-mc-' + os.path.basename (self.srcfile) + '.s'
 
 		#
 		# Construct the pathnames to the various utilities.
@@ -469,15 +384,20 @@
 		#
 		# Use the LLVM assembler to assemble the program.
 		#
-		exstatus=os.spawnl (os.P_WAIT, llc, llc, bcfile, '-f', '-o=' + objfile)
-		if (exstatus != 0):
+		if (ExecProgram ((llc, bcfile, '-f', '-o', objfile))):
+			fail = 1
 			result.Fail('Failed to compile ' + bcfile + ' to native asm code.')
+		else:
+			fail = 0
 
 		#
 		# Cleanup the file if it exists.
 		#
 		if ((os.access(objfile,os.F_OK)) == 1):
 			os.remove (objfile)
+		else:
+			if (fail == 0):
+				result.Fail ('Native assembly file ' + objfile + ' was not created')
 
 		return
 


Index: llvm/test/QMTest/llvmdb.py
diff -u llvm/test/QMTest/llvmdb.py:1.6 llvm/test/QMTest/llvmdb.py:1.7
--- llvm/test/QMTest/llvmdb.py:1.6	Tue Oct  7 15:55:37 2003
+++ llvm/test/QMTest/llvmdb.py	Fri Oct 10 14:51:36 2003
@@ -91,15 +91,13 @@
 		# If the test is a feature test, create the appropraite test for it.
 		#
 		if (headlabel == 'Feature'):
-			if (featuretypelabel == 'fopt'):
+			if (featuretypelabel == 'opt'):
 				return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestOptimizer', {'srcfile':testpath})
-			if (featuretypelabel == 'fasm'):
-				return qm.test.database.TestDescriptor(self, test_id, 'llvm.AssemblyCodeTest', {'srcfile':testpath})
-			if (featuretypelabel == 'fmc'):
+			if (featuretypelabel == 'mc'):
 				return qm.test.database.TestDescriptor(self, test_id, 'llvm.MachineCodeTest', {'srcfile':testpath})
-			if (featuretypelabel == 'fcc'):
+			if (featuretypelabel == 'cc'):
 				return qm.test.database.TestDescriptor(self, test_id, 'llvm.ConvertToCTest', {'srcfile':testpath})
-			if (featuretypelabel == 'fad'):
+			if (featuretypelabel == 'ad'):
 				return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestAsmDisasm', {'srcfile':testpath})
 
 		#
@@ -138,7 +136,7 @@
 	def GetDirsAndFiles (self, dirpath):
 
 		# The list of feature directories
-		featuredirs = ['fopt', 'fasm', 'fmc', 'fcc', 'fad']
+		featuredirs = ['opt', 'mc', 'cc', 'ad']
 
 		#
 		# To perform magic on the Feature tests, adjust the pathname.





More information about the llvm-commits mailing list