Usually the test home directory is a git repo somewhere e.g. under
/home. But if the home directory is located under /tmp this poses
a problem since UML remounts /tmp. To handle both cases mount
the home directory explicity.
---
tools/runner.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/runner.py b/tools/runner.py
index 7c177f1f..5f837097 100644
--- a/tools/runner.py
+++ b/tools/runner.py
@@ -451,6 +451,9 @@ class QemuRunner(RunnerAbstract):
def prepare_environment(self):
mounts = [ MountInfo('debugfs', 'debugfs', '/sys/kernel/debug',
'', 0) ]
+ mounts.append(MountInfo('hostfs', 'hostfs', self.args.testhome,
+ self.args.testhome, 0))
+
if self.args.log:
mounts.append(MountInfo('9p', 'logdir', self.args.log,
'trans=virtio,version=9p2000.L,msize=10240', 0))
@@ -513,6 +516,9 @@ class UmlRunner(RunnerAbstract):
mounts.append(MountInfo('hostfs', 'hostfs', self.args.result_parent,
self.args.result_parent, 0))
+ mounts.append(MountInfo('hostfs', 'hostfs', self.args.testhome,
+ self.args.testhome, 0))
+
self._prepare_mounts(extra=mounts)
super().prepare_environment()
--
2.34.1
Show replies by date
Inside the virtual environments /tmp is mounted as its own FS and not
taken from the host. This poses issues if any output files are directly
under /tmp since test-runner tries to mount the parent directory (/tmp).
The can be fixed by ensuring these output files are either not under
/tmp or at least one folder down the tree (e.g. /tmp/outputs/outfile.txt).
Now this requirement is enforced and test-runner will not start if any
output files parent directory is /tmp.
---
tools/runner.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/runner.py b/tools/runner.py
index 5f837097..90818ef1 100644
--- a/tools/runner.py
+++ b/tools/runner.py
@@ -311,6 +311,9 @@ class RunnerAbstract:
gid = int(os.environ.get('SUDO_GID', os.getgid()))
if self.args.log:
+ if self.args.log == '/tmp':
+ raise Exception('Log directly cannot be /tmp')
+
append_gid_uid = True
if not os.path.exists(self.args.log):
@@ -324,12 +327,16 @@ class RunnerAbstract:
self.args.monitor_parent = os.path.abspath(
os.path.join(self.args.monitor, os.pardir))
+ if self.args.monitor_parent == '/tmp':
+ raise Exception('--monitor cannot be directly under /tmp')
if self.args.result:
append_gid_uid = True
self.args.result_parent = os.path.abspath(
os.path.join(self.args.result, os.pardir))
+ if self.args.result_parent == '/tmp':
+ raise Exception('--result cannot be directly under /tmp')
if append_gid_uid:
self.args.SUDO_UID = uid
--
2.34.1
If the user specifies the same parent directory for several outfiles
skip mounting since it already exists. For example:
--monitor /outfiles/monitor.txt --result /outfiles/result.txt
---
tools/runner.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/runner.py b/tools/runner.py
index 90818ef1..bf28d9ad 100644
--- a/tools/runner.py
+++ b/tools/runner.py
@@ -289,7 +289,13 @@ class RunnerAbstract:
# For QEMU/UML runners
def _prepare_mounts(self, extra=[]):
+ mounted = []
+
for entry in mounts_common + extra:
+ if entry.target in mounted:
+ print("%s already mounted, skipping" % entry.target)
+ continue
+
try:
os.lstat(entry.target)
except:
@@ -298,6 +304,8 @@ class RunnerAbstract:
mount(entry.source, entry.target, entry.fstype, entry.flags,
entry.options)
+ mounted.append(entry.target)
+
for entry in dev_table:
os.symlink(entry.target, entry.linkpath)
--
2.34.1
This test was just piping the PSK files into /tmp/iwd/ssidCCMP.psk
which is a bit fragile if the storage dir was ever to change. Instead
use copy_to_storage and the 'name' keyword to copy the file.
---
autotests/testAddressRandomization/connection_test.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/autotests/testAddressRandomization/connection_test.py
b/autotests/testAddressRandomization/connection_test.py
index 32163e0f..f9f62f7a 100644
--- a/autotests/testAddressRandomization/connection_test.py
+++ b/autotests/testAddressRandomization/connection_test.py
@@ -46,7 +46,7 @@ class Test(unittest.TestCase):
perm_addr = device.address
# 1. Test per-network deterministic MAC generation
- os.system('cat pernetwork.psk > /tmp/iwd/ssidCCMP.psk')
+ IWD.copy_to_storage('pernetwork.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr)
# try again to ensure the generation was deterministic
@@ -54,7 +54,7 @@ class Test(unittest.TestCase):
self.assertEqual(new_addr, new_addr2)
# 2. Test FullAddressRandomization
- os.system('cat full_random.psk > /tmp/iwd/ssidCCMP.psk')
+ IWD.copy_to_storage('full_random.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr)
# try again to make sure the generation was random
@@ -62,7 +62,7 @@ class Test(unittest.TestCase):
self.assertNotEqual(new_addr, new_addr2)
# 3. Test AddressOverride
- os.system('cat override.psk > /tmp/iwd/ssidCCMP.psk')
+ IWD.copy_to_storage('override.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertEqual(new_addr, 'e6:f6:38:a9:02:02')
--
2.34.1
The signal agent notifications were changed which breaks this test.
Specifically commit ce227e7b94 sends a notification when connected
which breaks the 'agent.calls' check. Since this check is done both
after connecting and once already connected the initial value may
be 1 or 0. Because of this that check was removed entirely.
---
autotests/testRSSIAgent/connection_test.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/autotests/testRSSIAgent/connection_test.py
b/autotests/testRSSIAgent/connection_test.py
index 160a17b3..4ffa3d2c 100644
--- a/autotests/testRSSIAgent/connection_test.py
+++ b/autotests/testRSSIAgent/connection_test.py
@@ -56,7 +56,6 @@ class Test(unittest.TestCase):
# at least) uses a moving-window average value over the last RSSI
# measurements received from the driver and it changes gradually.
# Normally 1 second is enough.
- self.assertEqual(agent.calls, 0)
for centre, level in rssi_pairs:
rule.signal = centre
agent.level = -1
--
2.34.1