aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2021-01-13 11:09:56 -0500
committerScott Murray <scott.murray@konsulko.com>2021-01-13 11:15:51 -0500
commit5a7414cbc1b371f4b83f94eaaf7501765b6bec26 (patch)
treef4d5d4b2aa2be93d89d5512e00bcd302db4fe6e4
parent003ccc0db802f97349451b3f291188d8518e5232 (diff)
Support specifying CAN interface for testskoi_10.93.0koi_10.92.0koi/10.93.0koi/10.92.010.93.010.92.0
Add AGL_CAN_INTERFACE environment variable hook to allow specifying the CAN interface to be used in the CAN tests. This is required when using an interface other than the default of "can0", since the specific interface is needed for playback of CAN data to test binding behavior. The switch in AGL CI to using vcan0 on all test boards will require this hook. Bug-AGL: SPEC-3756 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: If84731ae39fd65f8fa88d24ddc0370da63ca5489
-rw-r--r--README.md1
-rw-r--r--pyagl/tests/test_can.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/README.md b/README.md
index e99f9c7..e4d6625 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,7 @@ Some specific tests are dependent on additional configuration via the following
* AGL_AVAILABLE_INTERFACES - optional, specify which of ethernet, wifi, and bluetooth interfaces are available. The value is a comma separated list, with a default value of "ethernet,wifi,bluetooth".
* AGL_BTMAP_RECIPIENT - optional, when running Bluetooth MAP tests, this would be used as phone number to write text messages to.
* AGL_BTMAP_TEXT - optional, when running Bluetooth MAP tests, messages will be composed with this text.
+* AGL_CAN_INTERFACE - optional, specify the CAN interface to use for CAN testing, default value is "can0".
* AGL_PBAP_PHONENUM - optional , when running Bluetooth PBAP tests, this phone number will be used to .search().
* AGL_PBAP_VCF - optional, for the Bluetooh PBAP tests query a contact entry out of the phonebook.
* AGL_BT_TEST_ADDR - optional, for the Bluetooth tests pair/connect/disconnect with an actual Bluetooth device(phone)'s address . The address should have the DBus address style as "dev_00_01_02_03_04_05" instead of a regular colon-separated MAC address.
diff --git a/pyagl/tests/test_can.py b/pyagl/tests/test_can.py
index 4766f55..6081ee9 100644
--- a/pyagl/tests/test_can.py
+++ b/pyagl/tests/test_can.py
@@ -63,6 +63,7 @@ class canplayer:
def __init__(self, service : cs):
self.service = service
self.remote = service.ip != 'localhost'
+ self.interface = os.environ.get('AGL_CAN_INTERFACE', 'can0')
self.args = [ '/usr/bin/canplayer', '-I' ]
async def play(self, filename : str):
@@ -70,6 +71,8 @@ class canplayer:
filename = '/tmp/' + filename
args = self.args
args.append(filename)
+ if self.interface != "can0":
+ args.append(self.interface + "=can0")
self.ssh = await asyncssh.connect(self.service.ip, username='root', known_hosts=None)
self.task = await self.ssh.create_process(' '.join(args))
else:
@@ -77,6 +80,8 @@ class canplayer:
data = path.joinpath('data', 'can', filename)
args = self.args
args.append(str(data))
+ if self.interface != "can0":
+ args.append(self.interface + "=can0")
self.task = subprocess.Popen(args)
async def stop(self):