Commit 73aa5340 authored by Martín Ferrari's avatar Martín Ferrari

add kernel version checks to avoid Oopses.

parent d532795a
......@@ -119,8 +119,10 @@ class TestWithDummy(unittest.TestCase):
def setUp(self):
self.cleanup = []
#@test_util.skipUnless(os.getuid() == 0, "Test requires root privileges")
@test_util.skip("Test trigger a kernel bug on 2.6.34")
@test_util.skipUnless(os.getuid() == 0, "Test requires root privileges")
@test_util.skipUnless(
test_util.get_linux_ver() >= test_util.make_linux_ver("2.6.35"),
"Test trigger a kernel bug on 2.6.34")
def test_interface_migration(self):
node = netns.Node()
dummyname = "dummy%d" % os.getpid()
......
#!/usr/bin/env python
# vim:ts=4:sw=4:et:ai:sts=4
import re, subprocess, sys
import os, re, subprocess, sys
import netns.subprocess_
def process_ipcmd(str):
......@@ -62,6 +62,14 @@ def get_devs_netns(node):
out = netns.subprocess_.backticks_raise(node, ["ip", "addr", "list"])
return process_ipcmd(out)
def make_linux_ver(string):
match = re.match(r'(\d+)\.(\d+)\.(\d+)(.*)', string)
version, patchlevel, sublevel, extraversion = match.groups()
return (int(version) << 16) + (int(patchlevel) << 8) + int(sublevel)
def get_linux_ver():
return make_linux_ver(os.uname()[2])
# Unittest from Python 2.6 doesn't have these decorators
def _bannerwrap(f, text):
name = f.__name__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment