[cfe-commits] r92147 - in /cfe/trunk/utils/C++Tests: LLVM-Code-Symbols/ LLVM-Code-Symbols/check-symbols LLVM-Code-Symbols/lit.local.cfg lit.cfg
Daniel Dunbar
daniel at zuster.org
Thu Dec 24 13:27:38 PST 2009
Author: ddunbar
Date: Thu Dec 24 15:27:38 2009
New Revision: 92147
URL: http://llvm.org/viewvc/llvm-project?rev=92147&view=rev
Log:
Sketch a simple new C++Tests suite for checking that llvm-gcc and clang generate
the same visible symbols, useful for finding ABI/Mangler/vtable/etc. issues.
Added:
cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/
cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols (with props)
cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg
Modified:
cfe/trunk/utils/C++Tests/lit.cfg
Added: cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/C%2B%2BTests/LLVM-Code-Symbols/check-symbols?rev=92147&view=auto
==============================================================================
--- cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols (added)
+++ cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols Thu Dec 24 15:27:38 2009
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+import subprocess
+import difflib
+
+def capture_2(args0, args1):
+ import subprocess
+ print ' '.join(args0)
+ print ' '.join(args1)
+ p0 = subprocess.Popen(args0, stdin=None, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ p1 = subprocess.Popen(args1, stdin=p0.stdout, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out,_ = p1.communicate()
+ return out
+
+def main():
+ import sys
+ clang = sys.argv[1]
+ flags = sys.argv[2:]
+
+ llvmgcc_nm = capture_2(["llvm-gcc"] + flags + ["-emit-llvm","-c","-o","-"],
+ ["llvm-nm", "-extern-only"])
+ clang_nm = capture_2([clang] + flags + ["-emit-llvm","-c","-o","-"],
+ ["llvm-nm", "-extern-only"])
+
+ llvmgcc_nm = llvmgcc_nm.split('\n')
+ clang_nm = clang_nm.split('\n')
+ llvmgcc_nm.sort()
+ clang_nm.sort()
+
+ if llvmgcc_nm == clang_nm:
+ sys.exit(0)
+
+ for line in difflib.unified_diff(llvmgcc_nm, clang_nm,
+ fromfile="llvm-gcc symbols",
+ tofile="clang symbols"):
+ print line
+ sys.exit(1)
+
+if __name__ == '__main__':
+ main()
Propchange: cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols
------------------------------------------------------------------------------
svn:executable = *
Added: cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/C%2B%2BTests/LLVM-Code-Symbols/lit.local.cfg?rev=92147&view=auto
==============================================================================
--- cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg (added)
+++ cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg Thu Dec 24 15:27:38 2009
@@ -0,0 +1,56 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+root = getRoot(config)
+
+# testFormat: The test format to use to interpret tests.
+target_obj_root = root.llvm_obj_root
+cxxflags = ['-D__STDC_LIMIT_MACROS',
+ '-D__STDC_CONSTANT_MACROS',
+ '-Wno-sign-compare',
+ '-I%s/include' % root.llvm_src_root,
+ '-I%s/include' % root.llvm_obj_root,
+ '-I%s/lib/Target/Alpha' % root.llvm_src_root,
+ '-I%s/lib/Target/ARM' % root.llvm_src_root,
+ '-I%s/lib/Target/Blackfin' % root.llvm_src_root,
+ '-I%s/lib/Target/CBackend' % root.llvm_src_root,
+ '-I%s/lib/Target/CellSPU' % root.llvm_src_root,
+ '-I%s/lib/Target/CppBackend' % root.llvm_src_root,
+ '-I%s/lib/Target/Mips' % root.llvm_src_root,
+ '-I%s/lib/Target/MSIL' % root.llvm_src_root,
+ '-I%s/lib/Target/MSP430' % root.llvm_src_root,
+ '-I%s/lib/Target/PIC16' % root.llvm_src_root,
+ '-I%s/lib/Target/PowerPC' % root.llvm_src_root,
+ '-I%s/lib/Target/Sparc' % root.llvm_src_root,
+ '-I%s/lib/Target/SystemZ' % root.llvm_src_root,
+ '-I%s/lib/Target/X86' % root.llvm_src_root,
+ '-I%s/lib/Target/XCore' % root.llvm_src_root,
+ '-I%s/lib/Target/Alpha' % target_obj_root,
+ '-I%s/lib/Target/ARM' % target_obj_root,
+ '-I%s/lib/Target/Blackfin' % target_obj_root,
+ '-I%s/lib/Target/CBackend' % target_obj_root,
+ '-I%s/lib/Target/CellSPU' % target_obj_root,
+ '-I%s/lib/Target/CppBackend' % target_obj_root,
+ '-I%s/lib/Target/Mips' % target_obj_root,
+ '-I%s/lib/Target/MSIL' % target_obj_root,
+ '-I%s/lib/Target/MSP430' % target_obj_root,
+ '-I%s/lib/Target/PIC16' % target_obj_root,
+ '-I%s/lib/Target/PowerPC' % target_obj_root,
+ '-I%s/lib/Target/Sparc' % target_obj_root,
+ '-I%s/lib/Target/SystemZ' % target_obj_root,
+ '-I%s/lib/Target/X86' % target_obj_root,
+ '-I%s/lib/Target/XCore' % target_obj_root];
+
+kScript = os.path.join(os.path.dirname(__file__), "check-symbols")
+config.test_format = \
+ lit.formats.OneCommandPerFileTest(command=[kScript, root.clang] + cxxflags,
+ dir='%s/lib' % root.llvm_src_root,
+ recursive=True,
+ pattern='^(.*\\.cpp)$')
+
Modified: cfe/trunk/utils/C++Tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/C%2B%2BTests/lit.cfg?rev=92147&r1=92146&r2=92147&view=diff
==============================================================================
--- cfe/trunk/utils/C++Tests/lit.cfg (original)
+++ cfe/trunk/utils/C++Tests/lit.cfg Thu Dec 24 15:27:38 2009
@@ -24,3 +24,4 @@
config.excludes.append('Clang-Code-Compile')
config.excludes.append('LLVM-Code-Syntax')
config.excludes.append('LLVM-Code-Compile')
+ config.excludes.append('LLVM-Code-Symbols')
More information about the cfe-commits
mailing list