From d1fbf22469df93e69b1a9154b4809502b6b39183 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Wed, 9 Dec 2020 14:59:48 -0800 Subject: [PATCH] unhide the associated .init and .lock files as well... --- bitelab/__init__.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/bitelab/__init__.py b/bitelab/__init__.py index 39c4892..fd3bca1 100644 --- a/bitelab/__init__.py +++ b/bitelab/__init__.py @@ -77,16 +77,19 @@ class SerialConsole(DefROAttribute): defattrname = 'console' async def activate(self, brd): - cmd = ('devfs', '-m', brd.attrs['devfspath'], 'rule', 'apply', - 'path', os.path.basename(self._value), 'unhide', ) - sub = await asyncio.create_subprocess_exec(*cmd, - stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + devname = os.path.basename(self._value) + + for i in (devname, devname + '.*'): + cmd = ('devfs', '-m', brd.attrs['devfspath'], 'rule', + 'apply', 'path', i, 'unhide', ) + sub = await asyncio.create_subprocess_exec(*cmd, + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) - ret = await sub.wait() + ret = await sub.wait() - if ret: - raise RuntimeError('activate failed: %d' % ret) + if ret: + raise RuntimeError('activate failed: %d' % ret) class BoardImpl: def __init__(self, name, brdclass, options): @@ -942,12 +945,18 @@ class TestAttrs(unittest.IsolatedAsyncioTestCase): await sc.activate(brd) - cse.assert_called_with('devfs', '-m', devfspath, 'rule', + cse.assert_any_call('devfs', '-m', devfspath, 'rule', 'apply', 'path', os.path.basename(await sc.getvalue()), 'unhide', stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + cse.assert_any_call('devfs', '-m', devfspath, 'rule', + 'apply', 'path', + os.path.basename(await sc.getvalue()) + '.*', 'unhide', + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) + wrap_subprocess_exec(cse, retcode=1) with self.assertRaises(RuntimeError): await sc.activate(brd)