Skip to contentSkip to conversation

ipvs: Add selftests for ipvs

PATCH In review Alex Gartrell 4 participants 4 messages Aug 14, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipvs: Add selftests for ipvs

Here's a basic python framework for doing selftests on ipvs.

---
 tools/testing/selftests/ipvs/.gitignore            |   1 +
 tools/testing/selftests/ipvs/Makefile              |  14 +
 tools/testing/selftests/ipvs/general_ipvs_tests.py |  87 ++++++
 tools/testing/selftests/ipvs/network_headers.py    | 315 +++++++++++++++++++++
 tools/testing/selftests/ipvs/network_test_utils.py |  93 ++++++
 tools/testing/selftests/ipvs/test-ipvs.py          |  17 ++
 6 files changed, 527 insertions(+)
 create mode 100644 tools/testing/selftests/ipvs/.gitignore
 create mode 100644 tools/testing/selftests/ipvs/Makefile
 create mode 100644 tools/testing/selftests/ipvs/general_ipvs_tests.py
 create mode 100644 tools/testing/selftests/ipvs/network_headers.py
 create mode 100644 tools/testing/selftests/ipvs/network_test_utils.py
 create mode 100644 tools/testing/selftests/ipvs/test-ipvs.py
tools/testing/selftests/ipvs/.gitignore new file +1 -0
new file mode 100644
index 0000000..0d20b64
@@ -0,0 +1 @@
+*.pyc
tools/testing/selftests/ipvs/Makefile new file +14 -0
new file mode 100644
index 0000000..be74db3
@@ -0,0 +1,14 @@
+# Makefile for net selftests
+
+PYTHON ?= python
+TEST_MODULES += general_ipvs_tests
+
+all:
+
+run_tests:
+	@$(PYTHON) -c 'import sys ; assert sys.version_info[:2] >= (2, 7), \
+			"Depends on python version 2.7"' && \
+			$(PYTHON) ./test-ipvs.py $(TEST_MODULES)
+
+clean:
+	rm -f *.pyc
tools/testing/selftests/ipvs/general_ipvs_tests.py new file +87 -0

87 lines not on this page · raw message

tools/testing/selftests/ipvs/network_headers.py new file +315 -0

315 lines not on this page · raw message

tools/testing/selftests/ipvs/network_test_utils.py new file +93 -0

93 lines not on this page · raw message

tools/testing/selftests/ipvs/test-ipvs.py new file +17 -0
new file mode 100644
index 0000000..fb5f20e
@@ -0,0 +1,17 @@
+import sys
+import os
+import unittest
+
+def main(argv):
+    if os.geteuid() != 0:
+        print >>sys.stderr, "Must be run as root"
+        sys.exit(2)
+
+    suite = unittest.TestSuite()
+    for modname in argv[1:]:
+        module = __import__(modname)
+        suite.addTest(unittest.TestLoader().loadTestsFromModule(module))
+    unittest.TextTestRunner(verbosity=2).run(suite)
+
+if __name__ == '__main__':
+    main(sys.argv)
Signature · 1 line
1.8.1
maintainer
#1 lore raw

Hello,

Quoted 1 line · Alex Gartrell

Here's a basic python framework for doing selftests on ipvs.

This is interesting work. I, personally, didn't
played with such kind of tools, so if you don't get other response here feel free to contact netdev, DaveM, Andrew Morton or even Linus for applying the patch. I don't know if some part of the code (IPv4/IPv6 headers) can be useful for other future tests, so CC-ing netdev would be a good idea.

Quoted 15 lines
---
 tools/testing/selftests/ipvs/.gitignore            |   1 +
 tools/testing/selftests/ipvs/Makefile              |  14 +
 tools/testing/selftests/ipvs/general_ipvs_tests.py |  87 ++++++
 tools/testing/selftests/ipvs/network_headers.py    | 315 +++++++++++++++++++++
 tools/testing/selftests/ipvs/network_test_utils.py |  93 ++++++
 tools/testing/selftests/ipvs/test-ipvs.py          |  17 ++
 6 files changed, 527 insertions(+)
 create mode 100644 tools/testing/selftests/ipvs/.gitignore
 create mode 100644 tools/testing/selftests/ipvs/Makefile
 create mode 100644 tools/testing/selftests/ipvs/general_ipvs_tests.py
 create mode 100644 tools/testing/selftests/ipvs/network_headers.py
 create mode 100644 tools/testing/selftests/ipvs/network_test_utils.py
 create mode 100644 tools/testing/selftests/ipvs/test-ipvs.py

Regards

--
Julian Anastasov <[email protected]>

#2 lore raw
Quoted 7 lines · Julian Anastasov

Hello,

Quoted 1 line · Alex Gartrell

Here's a basic python framework for doing selftests on ipvs.

Quoted 7 lines

This is interesting work. I, personally, didn't
played with such kind of tools, so if you don't get other response here feel free to contact netdev, DaveM, Andrew Morton or even Linus for applying the patch. I don't know if some part of the code (IPv4/IPv6 headers) can be useful for other future tests, so CC-ing netdev would be a good idea.

Agreed, that's great to have a selftest suite for ipvs!

One minor note, for networking there is so far a small set of tests under tools/testing/selftests/net/ .

You might want to consider adding it there and reorganizing the structure as follows, for example:

tools/testing/selftests/net/ipvs/    -- your code
tools/testing/selftests/net/packet/  -- for existing psock* tests
tools/testing/selftests/net/misc/    -- general socket tests

net-next is currently closed due to the merge window, but development should open very soon again, Dave always announces this on netdev.

Quoted 25 lines
Quoted 9 lines
---
  tools/testing/selftests/ipvs/.gitignore            |   1 +
  tools/testing/selftests/ipvs/Makefile              |  14 +
  tools/testing/selftests/ipvs/general_ipvs_tests.py |  87 ++++++
  tools/testing/selftests/ipvs/network_headers.py    | 315 +++++++++++++++++++++
  tools/testing/selftests/ipvs/network_test_utils.py |  93 ++++++
  tools/testing/selftests/ipvs/test-ipvs.py          |  17 ++
  6 files changed, 527 insertions(+)
Quoted 6 lines

create mode 100644 tools/testing/selftests/ipvs/.gitignore create mode 100644 tools/testing/selftests/ipvs/Makefile create mode 100644 tools/testing/selftests/ipvs/general_ipvs_tests.py create mode 100644 tools/testing/selftests/ipvs/network_headers.py create mode 100644 tools/testing/selftests/ipvs/network_test_utils.py create mode 100644 tools/testing/selftests/ipvs/test-ipvs.py

Regards

--
Julian Anastasov <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Alex Gartrell
Quoted 1 line · On Wed, 13 Aug 2014 19:12:29 -0700 Alex Gartrell <[email protected]> wrote:

Here's a basic python framework for doing selftests on ipvs.

Generally, I would like to see some comments in the individual *.py programs describing in general terms what is covered by this test or what the module provide to others, but in general terms what the idea is behind the module (I don't usually code/read python, but the function names does make enough sense that I get what they do).

Signature · 5 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer