Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
7bdd53c0
Commit
7bdd53c0
authored
Nov 27, 2017
by
yonghong-song
Committed by
GitHub
Nov 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1458 from oliviertilmans/master
python: make _decode_table_types aware of __int128
parents
65c23528
a1962c6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+3
-1
tests/python/test_clang.py
tests/python/test_clang.py
+23
-2
No files found.
src/python/bcc/__init__.py
View file @
7bdd53c0
...
...
@@ -378,7 +378,9 @@ class BPF(object):
u"unsigned long long"
:
ct
.
c_ulonglong
,
u"float"
:
ct
.
c_float
,
u"double"
:
ct
.
c_double
,
u"long double"
:
ct
.
c_longdouble
u"long double"
:
ct
.
c_longdouble
,
u"__int128"
:
ct
.
c_int64
*
2
,
u"unsigned __int128"
:
ct
.
c_uint64
*
2
,
}
@
staticmethod
def
_decode_table_type
(
desc
):
...
...
tests/python/test_clang.py
View file @
7bdd53c0
...
...
@@ -7,6 +7,8 @@ import ctypes as ct
from
unittest
import
main
,
skipUnless
,
TestCase
import
os
import
sys
import
socket
import
struct
from
contextlib
import
contextmanager
import
distutils.version
...
...
@@ -439,7 +441,7 @@ int process(struct xdp_md *ctx) {
"""
b
=
BPF
(
text
=
text
)
t
=
b
[
"jmp"
]
self
.
assertEqual
s
(
len
(
t
),
32
);
self
.
assertEqual
(
len
(
t
),
32
);
def
test_update_macro_arg
(
self
):
text
=
"""
...
...
@@ -459,7 +461,7 @@ int process(struct xdp_md *ctx) {
"""
b
=
BPF
(
text
=
text
)
t
=
b
[
"act"
]
self
.
assertEqual
s
(
len
(
t
),
32
);
self
.
assertEqual
(
len
(
t
),
32
);
def
test_ext_ptr_maps
(
self
):
bpf_text
=
"""
...
...
@@ -654,6 +656,25 @@ BPF_HASH(drops, struct a);
"""
b
=
BPF
(
text
=
text
)
def
test_int128_types
(
self
):
text
=
"""
BPF_HASH(table1, unsigned __int128, __int128);
"""
b
=
BPF
(
text
=
text
)
table
=
b
[
'table1'
]
self
.
assertEqual
(
ct
.
sizeof
(
table
.
Key
),
16
)
self
.
assertEqual
(
ct
.
sizeof
(
table
.
Leaf
),
16
)
table
[
table
.
Key
.
from_buffer_copy
(
socket
.
inet_pton
(
socket
.
AF_INET6
,
"2001:db8::"
))
]
=
table
.
Leaf
.
from_buffer_copy
(
struct
.
pack
(
'LL'
,
42
,
123456789
))
for
k
,
v
in
table
.
items
():
self
.
assertEqual
(
v
[
0
],
42
)
self
.
assertEqual
(
v
[
1
],
123456789
)
self
.
assertEqual
(
socket
.
inet_ntop
(
socket
.
AF_INET6
,
struct
.
pack
(
'LL'
,
k
[
0
],
k
[
1
])),
"2001:db8::"
)
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment