Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
73aa5340
Commit
73aa5340
authored
Jul 26, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add kernel version checks to avoid Oopses.
parent
d532795a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
t/test_interfaces.py
t/test_interfaces.py
+4
-2
t/test_util.py
t/test_util.py
+9
-1
No files found.
t/test_interfaces.py
View file @
73aa5340
...
@@ -119,8 +119,10 @@ class TestWithDummy(unittest.TestCase):
...
@@ -119,8 +119,10 @@ class TestWithDummy(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
cleanup
=
[]
self
.
cleanup
=
[]
#@test_util.skipUnless(os.getuid() == 0, "Test requires root privileges")
@
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
(
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
):
def
test_interface_migration
(
self
):
node
=
netns
.
Node
()
node
=
netns
.
Node
()
dummyname
=
"dummy%d"
%
os
.
getpid
()
dummyname
=
"dummy%d"
%
os
.
getpid
()
...
...
t/test_util.py
View file @
73aa5340
#!/usr/bin/env python
#!/usr/bin/env python
# vim:ts=4:sw=4:et:ai:sts=4
# vim:ts=4:sw=4:et:ai:sts=4
import
re
,
subprocess
,
sys
import
os
,
re
,
subprocess
,
sys
import
netns.subprocess_
import
netns.subprocess_
def
process_ipcmd
(
str
):
def
process_ipcmd
(
str
):
...
@@ -62,6 +62,14 @@ def get_devs_netns(node):
...
@@ -62,6 +62,14 @@ def get_devs_netns(node):
out = netns.subprocess_.backticks_raise(node, ["ip", "addr", "list"])
out = netns.subprocess_.backticks_raise(node, ["ip", "addr", "list"])
return process_ipcmd(out)
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
# Unittest from Python 2.6 doesn'
t
have
these
decorators
def
_bannerwrap
(
f
,
text
):
def
_bannerwrap
(
f
,
text
):
name
=
f
.
__name__
name
=
f
.
__name__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment