check for globals in the lib that are not prefixed with toku. addresses #74

git-svn-id: file:///svn/tokudb@844 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Rich Prohaska 2007-11-30 02:33:54 +00:00
parent d71d3efc80
commit 0cb6474b8c

43
src/tokuglobals.py Normal file
View file

@ -0,0 +1,43 @@
#!/usr/bin/python
import sys
import os
import re
def checkglobals(libname, exceptsymbols, verbose):
badglobals = 0
nmcmd = "nm -g " + libname
f = os.popen(nmcmd)
b = f.readline()
while b != "":
match = re.match("^([0-9a-f]+)\s(.?)\s(.*)$", b)
if match == None:
match = re.match("^\s+(.*)$", b)
if match == None:
print "unknown", b
badglobals = 1
else:
type = match.group(2)
symbol = match.group(3)
if verbose: print type, symbol
match = re.match("^toku_", symbol)
if match == None and not exceptsymbols.has_key(symbol):
print "non toku symbol=", symbol
badglobals = 1
b = f.readline()
f.close()
return badglobals
def main():
verbose = 0
for arg in sys.argv[1:]:
if arg == "-v":
verbose += 1
exceptsymbols = {}
for n in [ "_init", "_fini", "_end", "_edata", "__bss_start" ]:
exceptsymbols[n] = 1
for n in [ "db_env_create", "db_create", "db_strerror", "db_version", "log_compare" ]:
exceptsymbols[n] = 1
return checkglobals("libdb.so", exceptsymbols, verbose)
sys.exit(main())