1#!/usr/bin/env python 2# Copyright (c) PLUMgrid, Inc. 3# Licensed under the Apache License, Version 2.0 (the "License") 4 5import unittest 6from bcc import BPF 7 8class TestLru(unittest.TestCase): 9 def test_lru_map_flags(self): 10 test_prog1 = """ 11 BPF_F_TABLE("lru_hash", int, u64, lru, 1024, BPF_F_NO_COMMON_LRU); 12 """ 13 b = BPF(text=test_prog1) 14 t = b["lru"] 15 self.assertEqual(t.flags, 2); 16 17 def test_hash_map_flags(self): 18 test_prog1 = """ 19 BPF_F_TABLE("hash", int, u64, hash, 1024, BPF_F_NO_PREALLOC); 20 """ 21 b = BPF(text=test_prog1) 22 t = b["hash"] 23 self.assertEqual(t.flags, 1); 24 25if __name__ == "__main__": 26 unittest.main() 27