fixed the segfault! hand-initialized HParser needed PB_MIN set.

This commit is contained in:
Meredith L. Patterson 2013-11-19 19:00:58 -06:00 committed by Dan Hirsch
parent 12bb5cac36
commit 8b6d6084c5
2 changed files with 7 additions and 7 deletions

View file

@ -6,15 +6,15 @@ pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
pythonenv.Append(CPPPATH = ['../../', '/usr/include/python2.7']) pythonenv.Append(CPPPATH = ['../../', '/usr/include/python2.7'])
pythonenv.Append(CCFLAGS = ['-fpic', '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error']) pythonenv.Append(CCFLAGS = ['-fpic', '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error'])
#pythonenv.Append(LIBS = ['hammer']) pythonenv.Append(LIBS = ['hammer'])
#pythonenv.Append(LIBPATH = ['../../']) pythonenv.Append(LIBPATH = ['../../'])
pythonenv.Append(SWIGFLAGS = ['-DHAMMER_INTERNAL__NO_STDARG_H', '-Isrc/', '-python']) pythonenv.Append(SWIGFLAGS = ['-DHAMMER_INTERNAL__NO_STDARG_H', '-Isrc/', '-python'])
pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE")) pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE"))
swig = ['hammer.i'] swig = ['hammer.i']
libhammer_python = pythonenv.SharedLibrary('hammer', libhammer_shared + swig, SHLIBPREFIX='_') libhammer_python = pythonenv.SharedLibrary('hammer', swig, SHLIBPREFIX='_')
pytestenv = pythonenv.Clone() pytestenv = pythonenv.Clone()
pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0])) pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))

View file

@ -477,7 +477,7 @@ class TestNot2(unittest.TestCase):
# # def test_failure(self): # # def test_failure(self):
# # pass # # pass
class TestARightrec(unittest.TestCase): class TestRightrec(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.parser = h.h_indirect() cls.parser = h.h_indirect()
@ -486,13 +486,13 @@ class TestARightrec(unittest.TestCase):
def test_success(self): def test_success(self):
tree = h.h_parse(self.parser, "a", 1).ast.token_data.seq tree = h.h_parse(self.parser, "a", 1).ast.token_data.seq
self.assertEqual(tree[0].token_data.uint, ord("a")) self.assertEqual(tree[0].token_data.uint, ord("a"))
tree = h_parse(self.parser, "aa", 2).ast.token_data.seq tree = h.h_parse(self.parser, "aa", 2).ast.token_data.seq
self.assertEqual(tree[0].token_data.uint, ord("a")) self.assertEqual(tree[0].token_data.uint, ord("a"))
self.assertEqual(tree[1].token_data.seq[0].token_data.uint, ord("a")) self.assertEqual(tree[1].token_data.seq[0].token_data.uint, ord("a"))
tree = h_parse(self.parser, "aaa", 3).ast.token_data.seq tree = h.h_parse(self.parser, "aaa", 3).ast.token_data.seq
self.assertEqual(tree[0].token_data.uint, ord("a")) self.assertEqual(tree[0].token_data.uint, ord("a"))
self.assertEqual(tree[1].token_data.seq[0].token_data.uint, ord("a")) self.assertEqual(tree[1].token_data.seq[0].token_data.uint, ord("a"))
self.assertEqual(tree[1].token_data.seq[1].token_data.seq[0].uint, ord("a")) self.assertEqual(tree[1].token_data.seq[1].token_data.seq[0].token_data.uint, ord("a"))
def test_failure(self): def test_failure(self):
pass pass