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
9f1d3d08
Commit
9f1d3d08
authored
Aug 05, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more
parent
3ffbacd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
t/test_node.py
t/test_node.py
+6
-12
t/test_util.py
t/test_util.py
+1
-3
No files found.
t/test_node.py
View file @
9f1d3d08
...
...
@@ -38,31 +38,25 @@ class TestNode(unittest.TestCase):
link
=
netns
.
Link
()
link
.
connect
(
ifa
)
link
.
connect
(
ifb
)
def
get_devs
():
ipcmd
=
subprocess
.
Popen
([
netns
.
environ
.
ip_path
,
"-o"
,
"link"
,
"list"
],
stdout
=
subprocess
.
PIPE
)
(
outdata
,
errdata
)
=
ipcmd
.
communicate
()
ipcmd
.
wait
()
return
outdata
.
split
(
"
\
n
"
)
# Test automatic destruction
orig_devs
=
len
(
get_devs
())
orig_devs
=
len
(
test_util
.
get_devs
())
create_stuff
()
self
.
assertEquals
(
netns
.
get_nodes
(),
[])
self
.
assertEquals
(
orig_devs
,
len
(
get_devs
()))
self
.
assertEquals
(
orig_devs
,
len
(
test_util
.
get_devs
()))
# Test at_exit hooks
orig_devs
=
len
(
get_devs
())
orig_devs
=
len
(
test_util
.
get_devs
())
chld
=
os
.
fork
()
if
chld
==
0
:
netns
.
set_cleanup_hooks
(
on_exit
=
True
,
on_signals
=
[])
create_stuff
()
os
.
_exit
(
0
)
os
.
waitpid
(
chld
,
0
)
self
.
assertEquals
(
orig_devs
,
len
(
get_devs
()))
self
.
assertEquals
(
orig_devs
,
len
(
test_util
.
get_devs
()))
# Test signal hooks
orig_devs
=
len
(
get_devs
())
orig_devs
=
len
(
test_util
.
get_devs
())
chld
=
os
.
fork
()
if
chld
==
0
:
netns
.
set_cleanup_hooks
(
on_exit
=
False
,
...
...
@@ -72,7 +66,7 @@ class TestNode(unittest.TestCase):
time
.
sleep
(
10
)
os
.
kill
(
chld
,
signal
.
SIGTERM
)
os
.
waitpid
(
chld
,
0
)
self
.
assertEquals
(
orig_devs
,
len
(
get_devs
()))
self
.
assertEquals
(
orig_devs
,
len
(
test_util
.
get_devs
()))
if
__name__
==
'__main__'
:
unittest
.
main
()
...
...
t/test_util.py
View file @
9f1d3d08
...
...
@@ -54,9 +54,7 @@ def process_ipcmd(str):
return out
def get_devs():
ipcmd = subprocess.Popen([ip_path, "addr", "list"],
stdout = subprocess.PIPE)
(outdata, errdata) = ipcmd.communicate()
outdata = backticks([ip_path, "addr", "list"])
return process_ipcmd(outdata)
def get_devs_netns(node):
...
...
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