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

John Criswell criswell at cs.uiuc.edu
Fri Oct 3 14:22:01 PDT 2003


Changes in directory llvm/test/QMTest:

llvm.py updated: 1.12 -> 1.13
llvmdb.py updated: 1.1 -> 1.2

---
Log message:

llvm.py: Modified all tests to have the same inputs.  Also changed tests so
that they always compile the bytecode themselves (I haven't figured out how
to fit resources into this new database, and I don't think it's all that
important).

llvmdb.py: Adjusted methods so that the GUI reports the names of tests and not
their extensions.



---
Diffs of the changes:

Index: llvm/test/QMTest/llvm.py
diff -u llvm/test/QMTest/llvm.py:1.12 llvm/test/QMTest/llvm.py:1.13
--- llvm/test/QMTest/llvm.py:1.12	Thu Oct  2 13:18:36 2003
+++ llvm/test/QMTest/llvm.py	Fri Oct  3 14:21:02 2003
@@ -92,7 +92,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='assembly_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Assembly File',
 		                    description='LLVM Assembly File to Assemble'),
 	]
@@ -117,7 +117,7 @@
 		#
 		# Construct the pathname of the source file and object file.
 		#
-		srcfile=srcroot + '/' + self.assembly_file
+		srcfile=srcroot + '/' + self.srcfile
 		bcpath=tmpdir + '/' + 'temp.bc'
 
 		#
@@ -167,7 +167,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='bytecode_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Bytecode File',
 		                    description='LLVM Bytecode File to Convert to C'),
 	]
@@ -193,8 +193,8 @@
 		#
 		# Construct the pathname of the source file and object file.
 		#
-		srcfile=tmpdir + '/' + self.bytecode_file
-		objfile=tmpdir + '/' + self.bytecode_file + '.tc'
+		srcfile=tmpdir + '/' + self.srcfile
+		objfile=tmpdir + '/' + self.srcfile + '.tc'
 
 		#
 		# Construct the pathnames to the various utilities.
@@ -333,9 +333,9 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='bytecode_file',
-		                    title='LLVM Bytecode File',
-		                    description='LLVM Bytecode File to Convert to Machine Code'),
+		qm.fields.TextField(name='srcfile',
+		                    title='LLVM Assembly Language File',
+		                    description='LLVM Assembly Language File to Convert to Machine Code'),
 	]
 
 
@@ -359,22 +359,32 @@
 		#
 		# Construct the pathname of the source file and object file.
 		#
-		srcfile=tmpdir + '/' + self.bytecode_file
-		objfile=tmpdir + '/' + self.bytecode_file + '.mc'
+		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 = llc + ' ' + srcfile + ' -f -o=' + objfile + self.devnull
+		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()
+			result.Fail('Failed to compile bytecode')
 		else:
 			fail = 0
 
@@ -406,7 +416,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='bytecode_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Bytecode File',
 		                    description='LLVM Bytecode File to Convert to Machine Code'),
 	]
@@ -431,8 +441,8 @@
 		#
 		# Construct the pathname of the source file and object file.
 		#
-		srcfile=tmpdir + '/' + self.bytecode_file
-		objfile=tmpdir + '/' + self.bytecode_file + '.s'
+		srcfile=tmpdir + '/' + self.srcfile
+		objfile=tmpdir + '/' + self.srcfile + '.s'
 
 		#
 		# Construct the pathnames to the various utilities.
@@ -468,7 +478,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='assembly_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Assembly File',
 		                    description='LLVM Assembly File to run through the Optimizer'),
 	]
@@ -502,7 +512,7 @@
 		#
 		# Construct the pathname of the source file.
 		#
-		sourcefile=srcroot + '/' + self.assembly_file
+		sourcefile=srcroot + '/' + self.srcfile
 
 		#
 		# Construct the pathnames to the various utilities.
@@ -614,7 +624,7 @@
 	# List of information that is passed into each test
 	arguments = [
 		# Name of the file to assemble and disassemble
-		qm.fields.TextField(name="assembly_file",
+		qm.fields.TextField(name="srcfile",
 		                    title="LLVM Assembly File",
 		                    description="Name of the LLVM Assembly language file to assemble and disassemble"),
 	]
@@ -650,7 +660,7 @@
 		#
 		# Find the name of the file to assemble.
 		#
-		input=testdir + '/' + self.assembly_file
+		input=testdir + '/' + self.srcfile
 
 		#
 		# Construct output filenames.
@@ -723,7 +733,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='assembly_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Assembly File',
 		                    description='LLVM Assembly File to Verify'),
 	]
@@ -747,7 +757,7 @@
 		#
 		# Construct the pathname of the source file.
 		#
-		srcfile=srcroot + '/' + self.assembly_file
+		srcfile=srcroot + '/' + self.srcfile
 
 		#
 		# Construct the pathnames to the various utilities.
@@ -785,7 +795,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='bytecode_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Bytecode File',
 		                    description='LLVM Bytecode File to Convert to Machine Code'),
 	]
@@ -810,17 +820,26 @@
 		#
 		# Construct the pathname of the source file and object file.
 		#
-		srcfile=tmpdir + '/' + self.bytecode_file
+		srcfile = srcroot + '/' + self.srcfile
+		bcfile  = tmpdir + '/' + os.path.basename (self.srcfile)
 
 		#
 		# Construct the pathnames to the various utilities.
 		#
-		lli  = buildroot + '/tools/' + context['buildtype'] + '/lli -force-interpreter=false '
+		as  = buildroot + '/tools/' + context['buildtype'] + '/llvm-as'
+		lli = buildroot + '/tools/' + context['buildtype'] + '/lli -force-interpreter=false '
+
+		#
+		# Assemble the program.
+		#
+		estatus=os.system (as + ' -f -o ' + bcfile + ' ' + srcfile)
+		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
+			result.Fail('Failed to assemble LLVM code')
 
 		#
 		# Execute the program.
 		#
-		estatus=os.system (lli + ' ' + srcfile + ' < /dev/null')
+		estatus=os.system (lli + ' ' + bcfile + ' < /dev/null')
 		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
 			result.Fail('LLI failed to execute bytecode')
 
@@ -845,7 +864,7 @@
 	# List of arguments that the objects accepts for test configuration.
 	#
 	arguments = [
-		qm.fields.TextField(name='assembly_file',
+		qm.fields.TextField(name='srcfile',
 		                    title='LLVM Assembly File',
 		                    description='LLVM Assembly File to Analyze'),
 	]
@@ -869,7 +888,7 @@
 		#
 		# Construct the pathname of the source file and object file.
 		#
-		srcfile=srcroot + '/' + self.assembly_file
+		srcfile=srcroot + '/' + self.srcfile
 
 		#
 		# Construct the pathnames to the various utilities.
@@ -984,6 +1003,7 @@
 		# Execute the script using TestRunner.
 		#
 		command = 'cd ' + tmpdir + ';/bin/sh ' + scriptfile + ' > ' + outputfile + ' 2>&1'
+
 		estatus=os.system (command)
 		if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)):
 			result.Fail('Script: ' + scriptfile + '\n    Output: ' + outputfile)


Index: llvm/test/QMTest/llvmdb.py
diff -u llvm/test/QMTest/llvmdb.py:1.1 llvm/test/QMTest/llvmdb.py:1.2
--- llvm/test/QMTest/llvmdb.py:1.1	Fri Oct  3 13:39:40 2003
+++ llvm/test/QMTest/llvmdb.py	Fri Oct  3 14:21:02 2003
@@ -231,7 +231,10 @@
 					if (directory == ''):
 						files = files + [path]
 					else:
-						files = files + [directory + '.' + path]
+						(filebase, fileext) = os.path.splitext(path)
+						if (fileext == '.tr'):
+							(filebase, fileext) = os.path.splitext(filebase)
+						files = files + [directory + '.' + filebase]
 
 		if (scan_subdirs == 1):
 			for dirlabel in dirs:





More information about the llvm-commits mailing list