Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
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
bpftrace
Commits
bd71f2fd
Commit
bd71f2fd
authored
Sep 15, 2018
by
Matheus Marchini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! attach to multiple identical probes
parent
3a184594
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
src/ast/.codegen_llvm.cpp.swp
src/ast/.codegen_llvm.cpp.swp
+0
-0
tests/codegen.cpp
tests/codegen.cpp
+20
-0
tests/semantic_analyser.cpp
tests/semantic_analyser.cpp
+0
-13
No files found.
src/ast/.codegen_llvm.cpp.swp
deleted
100644 → 0
View file @
3a184594
File deleted
tests/codegen.cpp
View file @
bd71f2fd
...
...
@@ -13,6 +13,11 @@ namespace test {
namespace
codegen
{
using
::
testing
::
_
;
class
MockBPFtrace
:
public
BPFtrace
{
public:
MOCK_METHOD1
(
add_probe
,
int
(
ast
::
Probe
&
p
));
};
TEST
(
codegen
,
populate_sections
)
{
...
...
@@ -94,6 +99,21 @@ void test(const std::string &input, const std::string expected_output)
EXPECT_EQ
(
full_expected_output
,
out
.
str
());
}
TEST
(
codegen
,
probe_count
)
{
MockBPFtrace
bpftrace
;
EXPECT_CALL
(
bpftrace
,
add_probe
(
_
)).
Times
(
2
);
Driver
driver
;
ASSERT_EQ
(
driver
.
parse_str
(
"kprobe:f { 1; } kprobe:d { 1; }"
),
0
);
ast
::
SemanticAnalyser
semantics
(
driver
.
root_
,
bpftrace
);
ASSERT_EQ
(
semantics
.
analyse
(),
0
);
ast
::
CodegenLLVM
codegen
(
driver
.
root_
,
bpftrace
);
codegen
.
compile
();
}
TEST
(
codegen
,
empty_function
)
{
test
(
"kprobe:f { 1; }"
,
...
...
tests/semantic_analyser.cpp
View file @
bd71f2fd
...
...
@@ -9,11 +9,6 @@ namespace bpftrace {
namespace
test
{
namespace
semantic_analyser
{
class
MockBPFtrace
:
public
BPFtrace
{
public:
MOCK_METHOD1
(
add_probe
,
int
(
ast
::
Probe
&
p
));
};
using
::
testing
::
_
;
void
test
(
BPFtrace
&
bpftrace
,
Driver
&
driver
,
const
std
::
string
&
input
,
int
expected_result
=
0
)
...
...
@@ -97,14 +92,6 @@ TEST(semantic_analyser, builtin_functions)
test
(
"kprobe:f { fake() }"
,
1
);
}
TEST
(
semantic_analyser
,
probe_count
)
{
MockBPFtrace
bpftrace
;
EXPECT_CALL
(
bpftrace
,
add_probe
(
_
)).
Times
(
2
);
test
(
bpftrace
,
"kprobe:f { 1; } kprobe:d { 1; }"
);
}
TEST
(
semantic_analyser
,
undefined_map
)
{
test
(
"kprobe:f / @mymap == 123 / { @mymap = 0 }"
,
0
);
...
...
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