[cfe-commits] r92170 - /cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols
Daniel Dunbar
daniel at zuster.org
Sat Dec 26 14:58:49 PST 2009
Author: ddunbar
Date: Sat Dec 26 16:58:48 2009
New Revision: 92170
URL: http://llvm.org/viewvc/llvm-project?rev=92170&view=rev
Log:
Tests: Tweak LLVM-Code-Symbols test to ignore common and undefined symbols for
now, let's start small.
Modified:
cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols
Modified: 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=92170&r1=92169&r2=92170&view=diff
==============================================================================
--- cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols (original)
+++ cfe/trunk/utils/C++Tests/LLVM-Code-Symbols/check-symbols Sat Dec 26 16:58:48 2009
@@ -5,8 +5,6 @@
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,
@@ -14,24 +12,38 @@
out,_ = p1.communicate()
return out
+def normalize_nm(data):
+ lines = data.split('\n')
+ lines.sort()
+
+ # FIXME: Ignore common symbols for now.
+ lines = [ln for ln in lines
+ if not ln.startswith(' C')]
+
+ return lines
+
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()
+ # FIXME: Relax to include undefined symbols.
+ nm_args = ["llvm-nm", "-extern-only", "-defined-only"]
+
+ llvmgcc_args = ["llvm-gcc"] + flags + ["-emit-llvm","-c","-o","-"]
+ clang_args = [clang] + flags + ["-emit-llvm","-c","-o","-"]
+
+ llvmgcc_nm = capture_2(llvmgcc_args, nm_args)
+ clang_nm = capture_2(clang_args, nm_args)
+
+ llvmgcc_nm = normalize_nm(llvmgcc_nm)
+ clang_nm = normalize_nm(clang_nm)
if llvmgcc_nm == clang_nm:
sys.exit(0)
+ print ' '.join(llvmgcc_args), '|', ' '.join(nm_args)
+ print ' '.join(clang_args), '|', ' '.join(nm_args)
for line in difflib.unified_diff(llvmgcc_nm, clang_nm,
fromfile="llvm-gcc symbols",
tofile="clang symbols"):
More information about the cfe-commits
mailing list