X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_stats_client.py;h=bdc98118aeb33595bd7744c647df1988bccff1d5;hb=refs%2Fchanges%2F63%2F32163%2F13;hp=87c9efd4f1ce0fd71d0e1fbe3d0a46a25829e23c;hpb=5995482d310c97616beea2d5002943745b453515;p=vpp.git diff --git a/test/test_stats_client.py b/test/test_stats_client.py index 87c9efd4f1c..bdc98118aeb 100644 --- a/test/test_stats_client.py +++ b/test/test_stats_client.py @@ -1,13 +1,14 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 import unittest - import psutil from vpp_papi.vpp_stats import VPPStats +from framework import tag_fixme_vpp_workers from framework import VppTestCase, VppTestRunner +@tag_fixme_vpp_workers class StatsClientTestCase(VppTestCase): """Test Stats Client""" @@ -19,6 +20,12 @@ class StatsClientTestCase(VppTestCase): def tearDownClass(cls): super(StatsClientTestCase, cls).tearDownClass() + def test_set_errors(self): + """Test set errors""" + self.assertEqual(self.statistics.set_errors(), {}) + self.assertEqual( + self.statistics.get_counter('/err/ethernet-input/no error'), [0]) + def test_client_fd_leak(self): """Test file descriptor count - VPP-1486""" @@ -27,7 +34,7 @@ class StatsClientTestCase(VppTestCase): initial_fds = p.num_fds() for _ in range(100): - stats = VPPStats(socketname=cls.stats_sock) + stats = VPPStats(socketname=cls.get_stats_sock_path()) stats.disconnect() ending_fds = p.num_fds() @@ -37,5 +44,25 @@ class StatsClientTestCase(VppTestCase): "ending client side file descriptor count: %s" % ( initial_fds, ending_fds)) + @unittest.skip("Manual only") + def test_mem_leak(self): + def loop(): + print('Running loop') + for i in range(50): + rv = self.vapi.papi.tap_create_v2(id=i, use_random_mac=1) + self.assertEqual(rv.retval, 0) + rv = self.vapi.papi.tap_delete_v2(sw_if_index=rv.sw_if_index) + self.assertEqual(rv.retval, 0) + + before = self.statistics.get_counter('/mem/statseg/used') + loop() + self.vapi.cli("memory-trace on stats-segment") + for j in range(100): + loop() + print(self.vapi.cli("show memory stats-segment verbose")) + print('AFTER', before, + self.statistics.get_counter('/mem/statseg/used')) + + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)