mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
test-runner: use unique name for namespace output files
Output files in namespaces were not handled differently and would end up overwriting/duplicating files from the root namespace. These are now named /tmp/<process>-<namespace>-out.
This commit is contained in:
parent
1791ef1dc7
commit
c10bd14cde
@ -172,6 +172,11 @@ class Process:
|
|||||||
self.write_fds = []
|
self.write_fds = []
|
||||||
self.io_watch = None
|
self.io_watch = None
|
||||||
|
|
||||||
|
if not namespace:
|
||||||
|
self.output_name = '/tmp/%s-out' % self.name
|
||||||
|
else:
|
||||||
|
self.output_name = '/tmp/%s-%s-out' % (self.name, namespace)
|
||||||
|
|
||||||
if namespace:
|
if namespace:
|
||||||
self.args = ['ip', 'netns', 'exec', namespace]
|
self.args = ['ip', 'netns', 'exec', namespace]
|
||||||
self.args.extend(args)
|
self.args.extend(args)
|
||||||
@ -181,7 +186,7 @@ class Process:
|
|||||||
# (/tmp/<name>-out). If any verbose options are required this file
|
# (/tmp/<name>-out). If any verbose options are required this file
|
||||||
# will get an IO watch and write out any bytes to the needed FDs.
|
# will get an IO watch and write out any bytes to the needed FDs.
|
||||||
#
|
#
|
||||||
self.stdout = open('/tmp/%s-out' % self.name, 'a+')
|
self.stdout = open(self.output_name, 'a+')
|
||||||
self.io_position = self.stdout.tell()
|
self.io_position = self.stdout.tell()
|
||||||
|
|
||||||
if ctx:
|
if ctx:
|
||||||
@ -285,6 +290,8 @@ class Process:
|
|||||||
for f in self.write_fds:
|
for f in self.write_fds:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
os.remove(self.output_name)
|
||||||
|
|
||||||
def kill(self, force=False):
|
def kill(self, force=False):
|
||||||
print("Killing process %s" % self.args)
|
print("Killing process %s" % self.args)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user