• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright (c) PLUMgrid, Inc.
3# Licensed under the Apache License, Version 2.0 (the "License")
4
5# test program for the 'dump_func' method
6
7from bcc import BPF
8from unittest import main, TestCase
9
10class TestDumpFunc(TestCase):
11    def test_return(self):
12        b = BPF(text="""
13            int entry(void)
14            {
15                return 1;
16            }""")
17
18        self.assertEqual(
19            b"\xb7\x00\x00\x00\x01\x00\x00\x00" +
20            b"\x95\x00\x00\x00\x00\x00\x00\x00",
21            b.dump_func("entry"))
22
23if __name__ == "__main__":
24    main()
25