Skip to content

Commit

Permalink
tracee_test: Add tests for execveat_flags_to_str
Browse files Browse the repository at this point in the history
Signed-off-by: Simarpreet Singh <simar@linux.com>
  • Loading branch information
simar7 committed Nov 5, 2019
1 parent d0f474f commit efc2f14
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test_container_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,35 @@ def test_load_bpf_program(self):
actualbpf = tracee.container_tracer.load_bpf_program()
self.assertEqual(expectedbpf, actualbpf, "should be a valid bpf program")

def test_execveat_flags_to_str(self):
self.longMessage = True

test_cases = [
{
"name": "invalid flags",
"input": 0x666,
"expected": "",
},
{
"name": "empty path",
"input": 0x1000,
"expected": "AT_EMPTY_PATH",
},
{
"name": "symlink no follow",
"input": 0x100,
"expected": "AT_SYMLINK_NOFOLLOW",
},
{
"name": "symlink no follow with empty path",
"input": 0x1100,
"expected": "AT_EMPTY_PATH|AT_SYMLINK_NOFOLLOW",
},
]
for test_case in test_cases:
self.assertEqual(test_case["expected"], tracee.container_tracer.execveat_flags_to_str(test_case["input"]),
test_case["name"])


if __name__ == '__main__':
unittest.main()

0 comments on commit efc2f14

Please sign in to comment.