Skip to content

Commit 40b4e12

Browse files
committed
add a test suite
This is based on a suite I wrote internally at Red Hat for python-ethtool, later modified by Braňo Náter <bnater@redhat.com>.
1 parent 5f6339c commit 40b4e12

File tree

4 files changed

+1199
-0
lines changed

4 files changed

+1199
-0
lines changed

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,32 @@ bz2dev: rpmdirs
2424

2525
rpmdev: bz2dev rpmdirs
2626
rpmbuild -ba --define "_topdir $(PWD)/rpm" rpm/SPECS/$(PACKAGE).spec
27+
28+
29+
build:
30+
python setup.py build
31+
32+
# Need to set PYTHONPATH appropriately when invoking this
33+
test:
34+
python tests/parse_ifconfig.py -v
35+
python -m unittest discover -v
36+
valgrind --leak-check=full python tests/test_ethtool.py
37+
38+
# As of 5f6339c432dc227e456b70c459cf6f57c6cfe7c2 I (dmalcolm) hope to have
39+
# fixed the memory leaks within python-ethtool itself, but I expect
40+
# to see a few blocks lost within libnl which appear to be caches,
41+
# and thus (presumably) false positives:
42+
# ==9163== 4,600 (80 direct, 4,520 indirect) bytes in 2 blocks are definitely lost in loss record 2,559 of 2,612
43+
# ==9163== at 0x4C26F18: calloc (vg_replace_malloc.c:566)
44+
# ==9163== by 0x1152C307: nl_cache_alloc (in /usr/lib64/libnl.so.1.1)
45+
# ==9163== by 0x115309FC: rtnl_link_alloc_cache (in /usr/lib64/libnl.so.1.1)
46+
# ==9163== by 0x1130C843: get_etherinfo (etherinfo.c:315)
47+
# ==9163== by 0x1130CFD0: _ethtool_etherinfo_getter (etherinfo_obj.c:152)
48+
# ==9163== by 0x4F07E90: PyEval_EvalFrameEx (ceval.c:2330)
49+
# ...etc...
50+
# ==9163== LEAK SUMMARY:
51+
# ==9163== definitely lost: 160 bytes in 4 blocks
52+
# ==9163== indirectly lost: 9,040 bytes in 60 blocks
53+
# ==9163== possibly lost: 489,676 bytes in 3,299 blocks
54+
# ==9163== still reachable: 1,277,848 bytes in 11,100 blocks
55+
# ==9163== suppressed: 0 bytes in 0 blocks

tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)