From: Paul Chaignon Date: Tue, 22 Aug 2017 21:00:08 +0000 (+0200) Subject: Test case for incomplete types X-Git-Tag: submit/tizen_4.0/20171018.110122~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=574c3ebc62a130b464567e6f8e309145f727d4bf;p=platform%2Fupstream%2Fbcc.git Test case for incomplete types The bcc rewriter segfaults when it encounters an incomplete type (missing declaration or declaration after use) in a map declaration. --- diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py index 376a5dc5..70ff1b8a 100755 --- a/tests/python/test_clang.py +++ b/tests/python/test_clang.py @@ -587,6 +587,16 @@ int bar(void) { int foo(struct pt_regs *ctx) { return bar(); } +""" + with self.assertRaises(Exception): + b = BPF(text=text) + + def test_incomplete_type(self): + text = """ +BPF_HASH(drops, struct key_t); +struct key_t { + u64 location; +}; """ with self.assertRaises(Exception): b = BPF(text=text)