aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2020-09-30 17:27:16 -0400
committerScott Murray <scott.murray@konsulko.com>2020-09-30 19:27:36 -0400
commit30e59542153b567bb44bd36c3fb21d4e6fef5f83 (patch)
tree541265381750799ab72306f913d9523dd9f94b06
parentccd9a05cd6540c11601b83ccaa206127725bf5fd (diff)
CAN test rework to improve robustness
Changes: - Rework CAN test CAN data playing with canplayer to fix racing against listening for the binding events the data will result in. The previous use of a fixture to drive canplayer has been replaced with a small wrapper class that is inline in the test code to ensure the correct order of operations. - Copy required CAN test CAN data files used in the afb-test widget into pyagl/tests/data/can to remove dependency on test widget presence and contents. The previous prepare_replay_files fixture has been changed into a per-test fixture that scp's the file into /tmp on the target if running remotely. When running on target, they are used directly out of the pyagl install. - Improve test_Filter_Test_01_Step_2 using the updated canreplay file copied from agl-service-can-low-level, there are now several messages that test the filter range. - Add a tweak to cut the fixture parameter(s) off the test names when generating LAVA output. - Reordered test_auth to be after the write without authorization test to avoid spurious failures. Also removed the duplicate test in the J1939 tests and replaced it with an appropriate dependency. - Replace xfail marks on J1939 tests with logic to detect J1939 kernel support and mark them dynamically. - Add missing can_j1939 marking to the test test_low_can_subscribe_j1939_event. - Use known_hosts=None in asyncssh.connect calls to ensure remote testing is not affected by local SSH known_hosts configuration. - Tweak - Update some comment formatting to improve readability. - Simplify logic a bit in AGLBaseService.listener function. Bug-AGL: SPEC-3585 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I4ef660c175468ef57873c03a33cb5ec7e6f16568
-rw-r--r--MANIFEST.in2
-rw-r--r--pyagl/conftest.py32
-rw-r--r--pyagl/services/base.py27
-rw-r--r--pyagl/tests/data/can/test1.canreplay508
-rw-r--r--pyagl/tests/data/can/test2-3.canreplay219
-rw-r--r--pyagl/tests/data/can/testFilter01filteredOut.canreplay508
-rw-r--r--pyagl/tests/data/can/testFilter01pass-FD.canreplay8
-rw-r--r--pyagl/tests/data/can/testFilter01pass.canreplay8
-rw-r--r--pyagl/tests/data/can/testValueCAN_1.canreplay1
-rw-r--r--pyagl/tests/data/can/testValueCAN_2.canreplay1
-rw-r--r--pyagl/tests/data/can/testValueCAN_3.canreplay1
-rw-r--r--pyagl/tests/data/can/testValueJ1939_1.canreplay1
-rw-r--r--pyagl/tests/data/can/testj1939.canreplay1
-rw-r--r--pyagl/tests/test_can.py260
14 files changed, 1471 insertions, 106 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 7d48f9b..c6f454e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-include pyagl\ *
+include pyagl/data/*
include *.txt
include tox.ini
recursive-include templates *.json
diff --git a/pyagl/conftest.py b/pyagl/conftest.py
index f37de31..dd4dc31 100644
--- a/pyagl/conftest.py
+++ b/pyagl/conftest.py
@@ -14,9 +14,14 @@
# limitations under the License.
+import os
+import re
+import asyncio
import pytest
import argparse
import time
+import asyncssh
+import subprocess
class LavaAction(argparse.Action):
@@ -78,6 +83,8 @@ def pytest_report_teststatus(config, report):
if test_file.endswith('.py'):
test_file = test_file[:-3]
test_name = test_file + '_' + report.location[2][5:]
+ # Strip any fixture parameters
+ test_name = re.sub('\[.*\]$', '', test_name)
test_result = lava_result_convert(report.outcome)
# Generate expected LAVA testcase output
@@ -113,3 +120,28 @@ def pytest_report_teststatus(config, report):
category = report.outcome
return (category, short, verbose)
+
+async def ssh_helper(address, cmd):
+ ssh = await asyncssh.connect(address, username='root', known_hosts=None)
+ return await ssh.run(cmd)
+
+
+def pytest_collection_modifyitems(config, items):
+ # Check for J1939 support, mark those tests as skip if not present
+ have_j1939 = False
+ cmd = [ 'grep', '-q', '^CAN_J1939', '/proc/net/protocols' ]
+ address = os.environ.get('AGL_TGT_IP', 'localhost')
+ if address != 'localhost':
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ result = loop.run_until_complete(ssh_helper(address, ' '.join(cmd)))
+ have_j1939 = result.exit_status == 0
+ else:
+ result = subprocess.run(cmd)
+ have_j1939 = result.returncode == 0
+
+ if not have_j1939:
+ skip_j1939 = pytest.mark.skip(reason="J1939 protocol support not available")
+ for item in items:
+ if "can_j1939" in item.keywords:
+ item.add_marker(skip_j1939)
diff --git a/pyagl/services/base.py b/pyagl/services/base.py
index b64c256..e232163 100644
--- a/pyagl/services/base.py
+++ b/pyagl/services/base.py
@@ -44,7 +44,8 @@ class AFBT(IntEnum):
msgq = {}
-AFBLEN = 3 # usual AppFrameworkBinder responses/events have 3 items in the list - [messagetype, sessionid, payload]
+# AppFrameworkBinder responses/events have 3 items in the list - [messagetype, sessionid, payload]
+AFBLEN = 3
def newrand():
@@ -190,13 +191,15 @@ class AGLBaseService:
async def portfinder(self, runservice=False):
fieldsstr = '{sl}: {local_address} {rem_address} {st} {tx_queue}:{rx_queue} {tr}:{tmwhen} {retrnsmt} {uid}' \
' {timeout} {inode} {sref_cnt} {memloc} {rto} {pred_sclk} {ackquick} {congest} {slowstart}'
- # TODO:handle ssh timeouts, asyncssh does not support it apparently, and connect returns context_manager which
- # cannot be used with asyncio.wait_for
+ # TODO: handle ssh timeouts, asyncssh does not support it apparently,
+ # and connect returns context_manager which cannot be used with
+ # asyncio.wait_for
if self.ip == 'localhost' or self.ip == '127.0.0.1':
servicename = check_output(f"systemctl --all --no-legend | grep {self.service}-- | awk '{{print $1}}'", shell=True)
servicename = servicename.decode().strip().splitlines()
- servicename = servicename[-1] if len(servicename) else '' # it is possible that two matching services
- # are returned - one for uid 0 as root and 1001 as agl-driver, we want the latter
+ # it is possible that two matching services are returned
+ # - one for uid 0 as root and 1001 as agl-driver, we want the latter
+ servicename = servicename[-1] if len(servicename) else ''
if self.service not in servicename:
if runservice:
await self.runafmservice()
@@ -230,7 +233,7 @@ class AGLBaseService:
procnettcp = procnettcp.decode().splitlines()[1:]
else:
- async with asyncssh.connect(self.ip, username='root') as c:
+ async with asyncssh.connect(self.ip, username='root', known_hosts=None) as c:
servicename = await c.run(f"systemctl --all --no-legend | grep {self.service}-- | awk '{{print $1}}'", check=False)
servicename = servicename.stdout.strip().splitlines()
print(f"matching services: {servicename}")
@@ -322,16 +325,16 @@ class AGLBaseService:
result = check_output(f'systemctl start {servicename}', shell=True)
print(result)
- async def listener(self, stdout: bool = False, timeout=None):
+ async def listener(self, stdout: bool = False, timeout: float = None):
while True:
raw = None
try:
- if timeout is not None:
- raw = await asyncio.wait_for(self.response(), timeout=timeout)
- else:
- raw = await asyncio.wait_for(self.response(), timeout=self.timeout)
+ if timeout is None:
+ timeout = self.timeout
+ raw = await asyncio.wait_for(self.response(), timeout)
data = AFBResponse(raw)
- if stdout: print(data)
+ if stdout:
+ print(data)
yield data
except asyncio.TimeoutError:
diff --git a/pyagl/tests/data/can/test1.canreplay b/pyagl/tests/data/can/test1.canreplay
new file mode 100644
index 0000000..5669ef9
--- /dev/null
+++ b/pyagl/tests/data/can/test1.canreplay
@@ -0,0 +1,508 @@
+(1520951000.000000) can0 7E8#04410C1FD0000000
+(1520951000.200000) can0 7E8#04410C1FD1000000
+(1520951000.400000) can0 7E8#04410C1FD2000000
+(1520951000.600000) can0 7E8#04410C1FD3000000
+(1520951000.800000) can0 7E8#04410C1FD4000000
+(1520951001.000000) can0 7E8#04410C1FD5000000
+(1520951001.200000) can0 7E8#04410C1FD6000000
+(1520951001.400000) can0 7E8#04410C1FD7000000
+(1520951001.600000) can0 7E8#04410C1FD8000000
+(1520951001.800000) can0 7E8#04410C1FD9000000
+(1520951002.000000) can0 7E8#04410C1FDA000000
+(1520951002.200000) can0 7E8#04410C1FDB000000
+(1520951002.400000) can0 7E8#04410C1FDC000000
+(1520951002.600000) can0 7E8#04410C1FDD000000
+(1520951002.800000) can0 7E8#04410C1FDE000000
+(1520951003.000000) can0 7E8#04410C1FDF000000
+(1520951003.200000) can0 7E8#04410C1FE0000000
+(1520951003.400000) can0 7E8#04410C1FE1000000
+(1520951003.600000) can0 7E8#04410C1FE2000000
+(1520951003.800000) can0 7E8#04410C1FE3000000
+(1520951004.000000) can0 7E8#04410C1FE4000000
+(1520951004.200000) can0 7E8#04410C1FE5000000
+(1520951004.400000) can0 7E8#04410C1FE6000000
+(1520951004.600000) can0 7E8#04410C1FE7000000
+(1520951004.800000) can0 7E8#04410C1FE8000000
+(1520951005.000000) can0 7E8#04410C1FE9000000
+(1520951005.200000) can0 7E8#04410C1FEA000000
+(1520951005.400000) can0 7E8#04410C1FEB000000
+(1520951005.600000) can0 7E8#04410C1FEC000000
+(1520951005.800000) can0 7E8#04410C1FED000000
+(1520951006.000000) can0 7E8#04410C1FEE000000
+(1520951006.200000) can0 7E8#04410C1FEF000000
+(1520951006.400000) can0 7E8#04410C1FF0000000
+(1520951006.600000) can0 7E8#04410C1FF1000000
+(1520951006.800000) can0 7E8#04410C1FF2000000
+(1520951007.000000) can0 7E8#04410C1FF3000000
+(1520951007.200000) can0 7E8#04410C1FF4000000
+(1520951007.400000) can0 7E8#04410C1FF5000000
+(1520951007.600000) can0 7E8#04410C1FF6000000
+(1520951007.800000) can0 7E8#04410C1FF7000000
+(1520951008.000000) can0 7E8#04410C1FF8000000
+(1520951008.200000) can0 7E8#04410C1FF9000000
+(1520951008.400000) can0 7E8#04410C1FFA000000
+(1520951008.600000) can0 7E8#04410C1FFB000000
+(1520951008.800000) can0 7E8#04410C1FFC000000
+(1520951009.000000) can0 7E8#04410C1FFD000000
+(1520951009.200000) can0 7E8#04410C1FFE000000
+(1520951009.400000) can0 7E8#04410C1FFF000000
+(1520951009.600000) can0 7E8#04410C2000000000
+(1520951009.800000) can0 7E8#04410C2001000000
+(1520951010.000000) can0 7E8#04410C2001000000
+(1520951010.200000) can0 7E8#04410C2000000000
+(1520951010.400000) can0 7E8#04410C1FFF000000
+(1520951010.600000) can0 7E8#04410C1FFE000000
+(1520951010.800000) can0 7E8#04410C1FFD000000
+(1520951011.000000) can0 7E8#04410C1FFC000000
+(1520951011.200000) can0 7E8#04410C1FFB000000
+(1520951011.400000) can0 7E8#04410C1FFA000000
+(1520951011.600000) can0 7E8#04410C1FF9000000
+(1520951011.800000) can0 7E8#04410C1FF8000000
+(1520951012.000000) can0 7E8#04410C1FF7000000
+(1520951012.200000) can0 7E8#04410C1FF6000000
+(1520951012.400000) can0 7E8#04410C1FF5000000
+(1520951012.600000) can0 7E8#04410C1FF4000000
+(1520951012.800000) can0 7E8#04410C1FF3000000
+(1520951013.000000) can0 7E8#04410C1FF2000000
+(1520951013.200000) can0 7E8#04410C1FF1000000
+(1520951013.400000) can0 7E8#04410C1FF0000000
+(1520951013.600000) can0 7E8#04410C1FEF000000
+(1520951013.800000) can0 7E8#04410C1FEE000000
+(1520951014.000000) can0 7E8#04410C1FED000000
+(1520951014.200000) can0 7E8#04410C1FEC000000
+(1520951014.400000) can0 7E8#04410C1FEB000000
+(1520951014.600000) can0 7E8#04410C1FEA000000
+(1520951014.800000) can0 7E8#04410C1FE9000000
+(1520951015.000000) can0 7E8#04410C1FE8000000
+(1520951015.200000) can0 7E8#04410C1FE7000000
+(1520951015.400000) can0 7E8#04410C1FE6000000
+(1520951015.600000) can0 7E8#04410C1FE5000000
+(1520951015.800000) can0 7E8#04410C1FE4000000
+(1520951016.000000) can0 7E8#04410C1FE3000000
+(1520951016.200000) can0 7E8#04410C1FE2000000
+(1520951016.400000) can0 7E8#04410C1FE1000000
+(1520951016.600000) can0 7E8#04410C1FE0000000
+(1520951016.800000) can0 7E8#04410C1FDF000000
+(1520951017.000000) can0 7E8#04410C1FDE000000
+(1520951017.200000) can0 7E8#04410C1FDD000000
+(1520951017.400000) can0 7E8#04410C1FDC000000
+(1520951017.600000) can0 7E8#04410C1FDB000000
+(1520951017.800000) can0 7E8#04410C1FDA000000
+(1520951018.000000) can0 7E8#04410C1FD9000000
+(1520951018.200000) can0 7E8#04410C1FD8000000
+(1520951018.400000) can0 7E8#04410C1FD7000000
+(1520951018.600000) can0 7E8#04410C1FD6000000
+(1520951018.800000) can0 7E8#04410C1FD5000000
+(1520951019.000000) can0 7E8#04410C1FD4000000
+(1520951019.200000) can0 7E8#04410C1FD3000000
+(1520951019.400000) can0 7E8#04410C1FD2000000
+(1520951019.600000) can0 7E8#04410C1FD1000000
+(1520951019.800000) can0 7E8#04410C1FD0000000
+
+
+(1520951020.000000) can0 7E8#04410C1FD0000000
+(1520951020.200000) can0 7E8#04410C1FD1000000
+(1520951020.400000) can0 7E8#04410C1FD2000000
+(1520951020.600000) can0 7E8#04410C1FD3000000
+(1520951020.800000) can0 7E8#04410C1FD4000000
+(1520951021.000000) can0 7E8#04410C1FD5000000
+(1520951021.200000) can0 7E8#04410C1FD6000000
+(1520951021.400000) can0 7E8#04410C1FD7000000
+(1520951021.600000) can0 7E8#04410C1FD8000000
+(1520951021.800000) can0 7E8#04410C1FD9000000
+(1520951022.000000) can0 7E8#04410C1FDA000000
+(1520951022.200000) can0 7E8#04410C1FDB000000
+(1520951022.400000) can0 7E8#04410C1FDC000000
+(1520951022.600000) can0 7E8#04410C1FDD000000
+(1520951022.800000) can0 7E8#04410C1FDE000000
+(1520951023.000000) can0 7E8#04410C1FDF000000
+(1520951023.200000) can0 7E8#04410C1FE0000000
+(1520951023.400000) can0 7E8#04410C1FE1000000
+(1520951023.600000) can0 7E8#04410C1FE2000000
+(1520951023.800000) can0 7E8#04410C1FE3000000
+(1520951024.000000) can0 7E8#04410C1FE4000000
+(1520951024.200000) can0 7E8#04410C1FE5000000
+(1520951024.400000) can0 7E8#04410C1FE6000000
+(1520951024.600000) can0 7E8#04410C1FE7000000
+(1520951024.800000) can0 7E8#04410C1FE8000000
+(1520951025.000000) can0 7E8#04410C1FE9000000
+(1520951025.200000) can0 7E8#04410C1FEA000000
+(1520951025.400000) can0 7E8#04410C1FEB000000
+(1520951025.600000) can0 7E8#04410C1FEC000000
+(1520951025.800000) can0 7E8#04410C1FED000000
+(1520951026.000000) can0 7E8#04410C1FEE000000
+(1520951026.200000) can0 7E8#04410C1FEF000000
+(1520951026.400000) can0 7E8#04410C1FF0000000
+(1520951026.600000) can0 7E8#04410C1FF1000000
+(1520951026.800000) can0 7E8#04410C1FF2000000
+(1520951027.000000) can0 7E8#04410C1FF3000000
+(1520951027.200000) can0 7E8#04410C1FF4000000
+(1520951027.400000) can0 7E8#04410C1FF5000000
+(1520951027.600000) can0 7E8#04410C1FF6000000
+(1520951027.800000) can0 7E8#04410C1FF7000000
+(1520951028.000000) can0 7E8#04410C1FF8000000
+(1520951028.200000) can0 7E8#04410C1FF9000000
+(1520951028.400000) can0 7E8#04410C1FFA000000
+(1520951028.600000) can0 7E8#04410C1FFB000000
+(1520951028.800000) can0 7E8#04410C1FFC000000
+(1520951029.000000) can0 7E8#04410C1FFD000000
+(1520951029.200000) can0 7E8#04410C1FFE000000
+(1520951029.400000) can0 7E8#04410C1FFF000000
+(1520951029.600000) can0 7E8#04410C2000000000
+(1520951029.800000) can0 7E8#04410C2001000000
+(1520951030.000000) can0 7E8#04410C2001000000
+(1520951030.200000) can0 7E8#04410C2000000000
+(1520951030.400000) can0 7E8#04410C1FFF000000
+(1520951030.600000) can0 7E8#04410C1FFE000000
+(1520951030.800000) can0 7E8#04410C1FFD000000
+(1520951031.000000) can0 7E8#04410C1FFC000000
+(1520951031.200000) can0 7E8#04410C1FFB000000
+(1520951031.400000) can0 7E8#04410C1FFA000000
+(1520951031.600000) can0 7E8#04410C1FF9000000
+(1520951031.800000) can0 7E8#04410C1FF8000000
+(1520951032.000000) can0 7E8#04410C1FF7000000
+(1520951032.200000) can0 7E8#04410C1FF6000000
+(1520951032.400000) can0 7E8#04410C1FF5000000
+(1520951032.600000) can0 7E8#04410C1FF4000000
+(1520951032.800000) can0 7E8#04410C1FF3000000
+(1520951033.000000) can0 7E8#04410C1FF2000000
+(1520951033.200000) can0 7E8#04410C1FF1000000
+(1520951033.400000) can0 7E8#04410C1FF0000000
+(1520951033.600000) can0 7E8#04410C1FEF000000
+(1520951033.800000) can0 7E8#04410C1FEE000000
+(1520951034.000000) can0 7E8#04410C1FED000000
+(1520951034.200000) can0 7E8#04410C1FEC000000
+(1520951034.400000) can0 7E8#04410C1FEB000000
+(1520951034.600000) can0 7E8#04410C1FEA000000
+(1520951034.800000) can0 7E8#04410C1FE9000000
+(1520951035.000000) can0 7E8#04410C1FE8000000
+(1520951035.200000) can0 7E8#04410C1FE7000000
+(1520951035.400000) can0 7E8#04410C1FE6000000
+(1520951035.600000) can0 7E8#04410C1FE5000000
+(1520951035.800000) can0 7E8#04410C1FE4000000
+(1520951036.000000) can0 7E8#04410C1FE3000000
+(1520951036.200000) can0 7E8#04410C1FE2000000
+(1520951036.400000) can0 7E8#04410C1FE1000000
+(1520951036.600000) can0 7E8#04410C1FE0000000
+(1520951036.800000) can0 7E8#04410C1FDF000000
+(1520951037.000000) can0 7E8#04410C1FDE000000
+(1520951037.200000) can0 7E8#04410C1FDD000000
+(1520951037.400000) can0 7E8#04410C1FDC000000
+(1520951037.600000) can0 7E8#04410C1FDB000000
+(1520951037.800000) can0 7E8#04410C1FDA000000
+(1520951038.000000) can0 7E8#04410C1FD9000000
+(1520951038.200000) can0 7E8#04410C1FD8000000
+(1520951038.400000) can0 7E8#04410C1FD7000000
+(1520951038.600000) can0 7E8#04410C1FD6000000
+(1520951038.800000) can0 7E8#04410C1FD5000000
+(1520951039.000000) can0 7E8#04410C1FD4000000
+(1520951039.200000) can0 7E8#04410C1FD3000000
+(1520951039.400000) can0 7E8#04410C1FD2000000
+(1520951039.600000) can0 7E8#04410C1FD1000000
+(1520951039.800000) can0 7E8#04410C1FD0000000
+
+
+(1520951040.000000) can0 7E8#04410C1FD0000000
+(1520951040.200000) can0 7E8#04410C1FD1000000
+(1520951040.400000) can0 7E8#04410C1FD2000000
+(1520951040.600000) can0 7E8#04410C1FD3000000
+(1520951040.800000) can0 7E8#04410C1FD4000000
+(1520951041.000000) can0 7E8#04410C1FD5000000
+(1520951041.200000) can0 7E8#04410C1FD6000000
+(1520951041.400000) can0 7E8#04410C1FD7000000
+(1520951041.600000) can0 7E8#04410C1FD8000000
+(1520951041.800000) can0 7E8#04410C1FD9000000
+(1520951042.000000) can0 7E8#04410C1FDA000000
+(1520951042.200000) can0 7E8#04410C1FDB000000
+(1520951042.400000) can0 7E8#04410C1FDC000000
+(1520951042.600000) can0 7E8#04410C1FDD000000
+(1520951042.800000) can0 7E8#04410C1FDE000000
+(1520951043.000000) can0 7E8#04410C1FDF000000
+(1520951043.200000) can0 7E8#04410C1FE0000000
+(1520951043.400000) can0 7E8#04410C1FE1000000
+(1520951043.600000) can0 7E8#04410C1FE2000000
+(1520951043.800000) can0 7E8#04410C1FE3000000
+(1520951044.000000) can0 7E8#04410C1FE4000000
+(1520951044.200000) can0 7E8#04410C1FE5000000
+(1520951044.400000) can0 7E8#04410C1FE6000000
+(1520951044.600000) can0 7E8#04410C1FE7000000
+(1520951044.800000) can0 7E8#04410C1FE8000000
+(1520951045.000000) can0 7E8#04410C1FE9000000
+(1520951045.200000) can0 7E8#04410C1FEA000000
+(1520951045.400000) can0 7E8#04410C1FEB000000
+(1520951045.600000) can0 7E8#04410C1FEC000000
+(1520951045.800000) can0 7E8#04410C1FED000000
+(1520951046.000000) can0 7E8#04410C1FEE000000
+(1520951046.200000) can0 7E8#04410C1FEF000000
+(1520951046.400000) can0 7E8#04410C1FF0000000
+(1520951046.600000) can0 7E8#04410C1FF1000000
+(1520951046.800000) can0 7E8#04410C1FF2000000
+(1520951047.000000) can0 7E8#04410C1FF3000000
+(1520951047.200000) can0 7E8#04410C1FF4000000
+(1520951047.400000) can0 7E8#04410C1FF5000000
+(1520951047.600000) can0 7E8#04410C1FF6000000
+(1520951047.800000) can0 7E8#04410C1FF7000000
+(1520951048.000000) can0 7E8#04410C1FF8000000
+(1520951048.200000) can0 7E8#04410C1FF9000000
+(1520951048.400000) can0 7E8#04410C1FFA000000
+(1520951048.600000) can0 7E8#04410C1FFB000000
+(1520951048.800000) can0 7E8#04410C1FFC000000
+(1520951049.000000) can0 7E8#04410C1FFD000000
+(1520951049.200000) can0 7E8#04410C1FFE000000
+(1520951049.400000) can0 7E8#04410C1FFF000000
+(1520951049.600000) can0 7E8#04410C2000000000
+(1520951049.800000) can0 7E8#04410C2001000000
+(1520951050.000000) can0 7E8#04410C2001000000
+(1520951050.200000) can0 7E8#04410C2000000000
+(1520951050.400000) can0 7E8#04410C1FFF000000
+(1520951050.600000) can0 7E8#04410C1FFE000000
+(1520951050.800000) can0 7E8#04410C1FFD000000
+(1520951051.000000) can0 7E8#04410C1FFC000000
+(1520951051.200000) can0 7E8#04410C1FFB000000
+(1520951051.400000) can0 7E8#04410C1FFA000000
+(1520951051.600000) can0 7E8#04410C1FF9000000
+(1520951051.800000) can0 7E8#04410C1FF8000000
+(1520951052.000000) can0 7E8#04410C1FF7000000
+(1520951052.200000) can0 7E8#04410C1FF6000000
+(1520951052.400000) can0 7E8#04410C1FF5000000
+(1520951052.600000) can0 7E8#04410C1FF4000000
+(1520951052.800000) can0 7E8#04410C1FF3000000
+(1520951053.000000) can0 7E8#04410C1FF2000000
+(1520951053.200000) can0 7E8#04410C1FF1000000
+(1520951053.400000) can0 7E8#04410C1FF0000000
+(1520951053.600000) can0 7E8#04410C1FEF000000
+(1520951053.800000) can0 7E8#04410C1FEE000000
+(1520951054.000000) can0 7E8#04410C1FED000000
+(1520951054.200000) can0 7E8#04410C1FEC000000
+(1520951054.400000) can0 7E8#04410C1FEB000000
+(1520951054.600000) can0 7E8#04410C1FEA000000
+(1520951054.800000) can0 7E8#04410C1FE9000000
+(1520951055.000000) can0 7E8#04410C1FE8000000
+(1520951055.200000) can0 7E8#04410C1FE7000000
+(1520951055.400000) can0 7E8#04410C1FE6000000
+(1520951055.600000) can0 7E8#04410C1FE5000000
+(1520951055.800000) can0 7E8#04410C1FE4000000
+(1520951056.000000) can0 7E8#04410C1FE3000000
+(1520951056.200000) can0 7E8#04410C1FE2000000
+(1520951056.400000) can0 7E8#04410C1FE1000000
+(1520951056.600000) can0 7E8#04410C1FE0000000
+(1520951056.800000) can0 7E8#04410C1FDF000000
+(1520951057.000000) can0 7E8#04410C1FDE000000
+(1520951057.200000) can0 7E8#04410C1FDD000000
+(1520951057.400000) can0 7E8#04410C1FDC000000
+(1520951057.600000) can0 7E8#04410C1FDB000000
+(1520951057.800000) can0 7E8#04410C1FDA000000
+(1520951058.000000) can0 7E8#04410C1FD9000000
+(1520951058.200000) can0 7E8#04410C1FD8000000
+(1520951058.400000) can0 7E8#04410C1FD7000000
+(1520951058.600000) can0 7E8#04410C1FD6000000
+(1520951058.800000) can0 7E8#04410C1FD5000000
+(1520951059.000000) can0 7E8#04410C1FD4000000
+(1520951059.200000) can0 7E8#04410C1FD3000000
+(1520951059.400000) can0 7E8#04410C1FD2000000
+(1520951059.600000) can0 7E8#04410C1FD1000000
+(1520951059.800000) can0 7E8#04410C1FD0000000
+
+
+(1520951060.000000) can0 7E8#04410C1FD0000000
+(1520951060.200000) can0 7E8#04410C1FD1000000
+(1520951060.400000) can0 7E8#04410C1FD2000000
+(1520951060.600000) can0 7E8#04410C1FD3000000
+(1520951060.800000) can0 7E8#04410C1FD4000000
+(1520951061.000000) can0 7E8#04410C1FD5000000
+(1520951061.200000) can0 7E8#04410C1FD6000000
+(1520951061.400000) can0 7E8#04410C1FD7000000
+(1520951061.600000) can0 7E8#04410C1FD8000000
+(1520951061.800000) can0 7E8#04410C1FD9000000
+(1520951062.000000) can0 7E8#04410C1FDA000000
+(1520951062.200000) can0 7E8#04410C1FDB000000
+(1520951062.400000) can0 7E8#04410C1FDC000000
+(1520951062.600000) can0 7E8#04410C1FDD000000
+(1520951062.800000) can0 7E8#04410C1FDE000000
+(1520951063.000000) can0 7E8#04410C1FDF000000
+(1520951063.200000) can0 7E8#04410C1FE0000000
+(1520951063.400000) can0 7E8#04410C1FE1000000
+(1520951063.600000) can0 7E8#04410C1FE2000000
+(1520951063.800000) can0 7E8#04410C1FE3000000
+(1520951064.000000) can0 7E8#04410C1FE4000000
+(1520951064.200000) can0 7E8#04410C1FE5000000
+(1520951064.400000) can0 7E8#04410C1FE6000000
+(1520951064.600000) can0 7E8#04410C1FE7000000
+(1520951064.800000) can0 7E8#04410C1FE8000000
+(1520951065.000000) can0 7E8#04410C1FE9000000
+(1520951065.200000) can0 7E8#04410C1FEA000000
+(1520951065.400000) can0 7E8#04410C1FEB000000
+(1520951065.600000) can0 7E8#04410C1FEC000000
+(1520951065.800000) can0 7E8#04410C1FED000000
+(1520951066.000000) can0 7E8#04410C1FEE000000
+(1520951066.200000) can0 7E8#04410C1FEF000000
+(1520951066.400000) can0 7E8#04410C1FF0000000
+(1520951066.600000) can0 7E8#04410C1FF1000000
+(1520951066.800000) can0 7E8#04410C1FF2000000
+(1520951067.000000) can0 7E8#04410C1FF3000000
+(1520951067.200000) can0 7E8#04410C1FF4000000
+(1520951067.400000) can0 7E8#04410C1FF5000000
+(1520951067.600000) can0 7E8#04410C1FF6000000
+(1520951067.800000) can0 7E8#04410C1FF7000000
+(1520951068.000000) can0 7E8#04410C1FF8000000
+(1520951068.200000) can0 7E8#04410C1FF9000000
+(1520951068.400000) can0 7E8#04410C1FFA000000
+(1520951068.600000) can0 7E8#04410C1FFB000000
+(1520951068.800000) can0 7E8#04410C1FFC000000
+(1520951069.000000) can0 7E8#04410C1FFD000000
+(1520951069.200000) can0 7E8#04410C1FFE000000
+(1520951069.400000) can0 7E8#04410C1FFF000000
+(1520951069.600000) can0 7E8#04410C2000000000
+(1520951069.800000) can0 7E8#04410C2001000000
+(1520951070.000000) can0 7E8#04410C2001000000
+(1520951070.200000) can0 7E8#04410C2000000000
+(1520951070.400000) can0 7E8#04410C1FFF000000
+(1520951070.600000) can0 7E8#04410C1FFE000000
+(1520951070.800000) can0 7E8#04410C1FFD000000
+(1520951071.000000) can0 7E8#04410C1FFC000000
+(1520951071.200000) can0 7E8#04410C1FFB000000
+(1520951071.400000) can0 7E8#04410C1FFA000000
+(1520951071.600000) can0 7E8#04410C1FF9000000
+(1520951071.800000) can0 7E8#04410C1FF8000000
+(1520951072.000000) can0 7E8#04410C1FF7000000
+(1520951072.200000) can0 7E8#04410C1FF6000000
+(1520951072.400000) can0 7E8#04410C1FF5000000
+(1520951072.600000) can0 7E8#04410C1FF4000000
+(1520951072.800000) can0 7E8#04410C1FF3000000
+(1520951073.000000) can0 7E8#04410C1FF2000000
+(1520951073.200000) can0 7E8#04410C1FF1000000
+(1520951073.400000) can0 7E8#04410C1FF0000000
+(1520951073.600000) can0 7E8#04410C1FEF000000
+(1520951073.800000) can0 7E8#04410C1FEE000000
+(1520951074.000000) can0 7E8#04410C1FED000000
+(1520951074.200000) can0 7E8#04410C1FEC000000
+(1520951074.400000) can0 7E8#04410C1FEB000000
+(1520951074.600000) can0 7E8#04410C1FEA000000
+(1520951074.800000) can0 7E8#04410C1FE9000000
+(1520951075.000000) can0 7E8#04410C1FE8000000
+(1520951075.200000) can0 7E8#04410C1FE7000000
+(1520951075.400000) can0 7E8#04410C1FE6000000
+(1520951075.600000) can0 7E8#04410C1FE5000000
+(1520951075.800000) can0 7E8#04410C1FE4000000
+(1520951076.000000) can0 7E8#04410C1FE3000000
+(1520951076.200000) can0 7E8#04410C1FE2000000
+(1520951076.400000) can0 7E8#04410C1FE1000000
+(1520951076.600000) can0 7E8#04410C1FE0000000
+(1520951076.800000) can0 7E8#04410C1FDF000000
+(1520951077.000000) can0 7E8#04410C1FDE000000
+(1520951077.200000) can0 7E8#04410C1FDD000000
+(1520951077.400000) can0 7E8#04410C1FDC000000
+(1520951077.600000) can0 7E8#04410C1FDB000000
+(1520951077.800000) can0 7E8#04410C1FDA000000
+(1520951078.000000) can0 7E8#04410C1FD9000000
+(1520951078.200000) can0 7E8#04410C1FD8000000
+(1520951078.400000) can0 7E8#04410C1FD7000000
+(1520951078.600000) can0 7E8#04410C1FD6000000
+(1520951078.800000) can0 7E8#04410C1FD5000000
+(1520951079.000000) can0 7E8#04410C1FD4000000
+(1520951079.200000) can0 7E8#04410C1FD3000000
+(1520951079.400000) can0 7E8#04410C1FD2000000
+(1520951079.600000) can0 7E8#04410C1FD1000000
+(1520951079.800000) can0 7E8#04410C1FD0000000
+
+
+(1520951080.000000) can0 7E8#04410C1FD0000000
+(1520951080.200000) can0 7E8#04410C1FD1000000
+(1520951080.400000) can0 7E8#04410C1FD2000000
+(1520951080.600000) can0 7E8#04410C1FD3000000
+(1520951080.800000) can0 7E8#04410C1FD4000000
+(1520951081.000000) can0 7E8#04410C1FD5000000
+(1520951081.200000) can0 7E8#04410C1FD6000000
+(1520951081.400000) can0 7E8#04410C1FD7000000
+(1520951081.600000) can0 7E8#04410C1FD8000000
+(1520951081.800000) can0 7E8#04410C1FD9000000
+(1520951082.000000) can0 7E8#04410C1FDA000000
+(1520951082.200000) can0 7E8#04410C1FDB000000
+(1520951082.400000) can0 7E8#04410C1FDC000000
+(1520951082.600000) can0 7E8#04410C1FDD000000
+(1520951082.800000) can0 7E8#04410C1FDE000000
+(1520951083.000000) can0 7E8#04410C1FDF000000
+(1520951083.200000) can0 7E8#04410C1FE0000000
+(1520951083.400000) can0 7E8#04410C1FE1000000
+(1520951083.600000) can0 7E8#04410C1FE2000000
+(1520951083.800000) can0 7E8#04410C1FE3000000
+(1520951084.000000) can0 7E8#04410C1FE4000000
+(1520951084.200000) can0 7E8#04410C1FE5000000
+(1520951084.400000) can0 7E8#04410C1FE6000000
+(1520951084.600000) can0 7E8#04410C1FE7000000
+(1520951084.800000) can0 7E8#04410C1FE8000000
+(1520951085.000000) can0 7E8#04410C1FE9000000
+(1520951085.200000) can0 7E8#04410C1FEA000000
+(1520951085.400000) can0 7E8#04410C1FEB000000
+(1520951085.600000) can0 7E8#04410C1FEC000000
+(1520951085.800000) can0 7E8#04410C1FED000000
+(1520951086.000000) can0 7E8#04410C1FEE000000
+(1520951086.200000) can0 7E8#04410C1FEF000000
+(1520951086.400000) can0 7E8#04410C1FF0000000
+(1520951086.600000) can0 7E8#04410C1FF1000000
+(1520951086.800000) can0 7E8#04410C1FF2000000
+(1520951087.000000) can0 7E8#04410C1FF3000000
+(1520951087.200000) can0 7E8#04410C1FF4000000
+(1520951087.400000) can0 7E8#04410C1FF5000000
+(1520951087.600000) can0 7E8#04410C1FF6000000
+(1520951087.800000) can0 7E8#04410C1FF7000000
+(1520951088.000000) can0 7E8#04410C1FF8000000
+(1520951088.200000) can0 7E8#04410C1FF9000000
+(1520951088.400000) can0 7E8#04410C1FFA000000
+(1520951088.600000) can0 7E8#04410C1FFB000000
+(1520951088.800000) can0 7E8#04410C1FFC000000
+(1520951089.000000) can0 7E8#04410C1FFD000000
+(1520951089.200000) can0 7E8#04410C1FFE000000
+(1520951089.400000) can0 7E8#04410C1FFF000000
+(1520951089.600000) can0 7E8#04410C2000000000
+(1520951089.800000) can0 7E8#04410C2001000000
+(1520951090.000000) can0 7E8#04410C2001000000
+(1520951090.200000) can0 7E8#04410C2000000000
+(1520951090.400000) can0 7E8#04410C1FFF000000
+(1520951090.600000) can0 7E8#04410C1FFE000000
+(1520951090.800000) can0 7E8#04410C1FFD000000
+(1520951091.000000) can0 7E8#04410C1FFC000000
+(1520951091.200000) can0 7E8#04410C1FFB000000
+(1520951091.400000) can0 7E8#04410C1FFA000000
+(1520951091.600000) can0 7E8#04410C1FF9000000
+(1520951091.800000) can0 7E8#04410C1FF8000000
+(1520951092.000000) can0 7E8#04410C1FF7000000
+(1520951092.200000) can0 7E8#04410C1FF6000000
+(1520951092.400000) can0 7E8#04410C1FF5000000
+(1520951092.600000) can0 7E8#04410C1FF4000000
+(1520951092.800000) can0 7E8#04410C1FF3000000
+(1520951093.000000) can0 7E8#04410C1FF2000000
+(1520951093.200000) can0 7E8#04410C1FF1000000
+(1520951093.400000) can0 7E8#04410C1FF0000000
+(1520951093.600000) can0 7E8#04410C1FEF000000
+(1520951093.800000) can0 7E8#04410C1FEE000000
+(1520951094.000000) can0 7E8#04410C1FED000000
+(1520951094.200000) can0 7E8#04410C1FEC000000
+(1520951094.400000) can0 7E8#04410C1FEB000000
+(1520951094.600000) can0 7E8#04410C1FEA000000
+(1520951094.800000) can0 7E8#04410C1FE9000000
+(1520951095.000000) can0 7E8#04410C1FE8000000
+(1520951095.200000) can0 7E8#04410C1FE7000000
+(1520951095.400000) can0 7E8#04410C1FE6000000
+(1520951095.600000) can0 7E8#04410C1FE5000000
+(1520951095.800000) can0 7E8#04410C1FE4000000
+(1520951096.000000) can0 7E8#04410C1FE3000000
+(1520951096.200000) can0 7E8#04410C1FE2000000
+(1520951096.400000) can0 7E8#04410C1FE1000000
+(1520951096.600000) can0 7E8#04410C1FE0000000
+(1520951096.800000) can0 7E8#04410C1FDF000000
+(1520951097.000000) can0 7E8#04410C1FDE000000
+(1520951097.200000) can0 7E8#04410C1FDD000000
+(1520951097.400000) can0 7E8#04410C1FDC000000
+(1520951097.600000) can0 7E8#04410C1FDB000000
+(1520951097.800000) can0 7E8#04410C1FDA000000
+(1520951098.000000) can0 7E8#04410C1FD9000000
+(1520951098.200000) can0 7E8#04410C1FD8000000
+(1520951098.400000) can0 7E8#04410C1FD7000000
+(1520951098.600000) can0 7E8#04410C1FD6000000
+(1520951098.800000) can0 7E8#04410C1FD5000000
+(1520951099.000000) can0 7E8#04410C1FD4000000
+(1520951099.200000) can0 7E8#04410C1FD3000000
+(1520951099.400000) can0 7E8#04410C1FD2000000
+(1520951099.600000) can0 7E8#04410C1FD1000000
+(1520951099.800000) can0 7E8#04410C1FD0000000
diff --git a/pyagl/tests/data/can/test2-3.canreplay b/pyagl/tests/data/can/test2-3.canreplay
new file mode 100644
index 0000000..dd90518
--- /dev/null
+++ b/pyagl/tests/data/can/test2-3.canreplay
@@ -0,0 +1,219 @@
+(1481581765.286242) can0 3E9#0000
+(1481581765.346271) can0 3E9#0000
+(1481581765.406266) can0 3E9#0000
+(1481581765.466255) can0 3E9#0000
+(1481581765.526264) can0 3E9#0200
+(1481581765.586262) can0 3E9#0200
+(1481581765.646260) can0 3E9#0200
+(1481581765.706260) can0 3E9#0200
+(1481581765.766257) can0 3E9#0400
+(1481581765.826264) can0 3E9#0400
+(1481581765.886253) can0 3E9#0400
+(1481581765.946222) can0 3E9#0400
+(1481581766.006240) can0 3E9#0600
+(1481581766.066240) can0 3E9#0600
+(1481581766.126236) can0 3E9#0600
+(1481581766.186235) can0 3E9#0600
+(1481581766.246243) can0 3E9#0800
+(1481581766.306253) can0 3E9#0800
+(1481581766.366256) can0 3E9#0800
+(1481581766.426257) can0 3E9#0800
+(1481581766.486242) can0 3E9#0A00
+(1481581766.546247) can0 3E9#0A00
+(1481581766.606244) can0 3E9#0A00
+(1481581766.666242) can0 3E9#0A00
+(1481581766.726240) can0 3E9#0C00
+(1481581766.786252) can0 3E9#0C00
+(1481581766.846237) can0 3E9#0C00
+(1481581766.906245) can0 3E9#0C00
+(1481581766.966235) can0 3E9#0E00
+(1481581767.026244) can0 3E9#0E00
+(1481581767.086240) can0 3E9#0E00
+(1481581767.146200) can0 3E9#0E00
+(1481581767.206217) can0 3E9#1000
+(1481581767.266225) can0 3E9#1000
+(1481581767.326224) can0 3E9#1000
+(1481581767.386222) can0 3E9#1000
+(1481581767.446211) can0 3E9#1200
+(1481581767.506209) can0 3E9#1200
+(1481581767.566219) can0 3E9#1200
+(1481581767.626217) can0 3E9#1200
+(1481581767.686214) can0 3E9#1400
+(1481581767.746212) can0 3E9#1400
+(1481581767.806180) can0 3E9#1400
+(1481581767.866211) can0 3E9#1400
+(1481581767.926217) can0 3E9#1600
+(1481581767.986216) can0 3E9#1600
+(1481581768.046175) can0 3E9#1600
+(1481581768.106203) can0 3E9#1600
+(1481581768.166203) can0 3E9#1800
+(1481581768.226211) can0 3E9#1800
+(1481581768.286197) can0 3E9#1800
+(1481581768.346195) can0 3E9#1800
+(1481581768.406186) can0 3E9#1A00
+(1481581768.466194) can0 3E9#1A00
+(1481581768.526191) can0 3E9#1A00
+(1481581768.586191) can0 3E9#1A00
+(1481581768.646199) can0 3E9#1C00
+(1481581768.706206) can0 3E9#1C00
+(1481581768.766165) can0 3E9#1C00
+(1481581768.826194) can0 3E9#1C00
+(1481581768.886202) can0 3E9#1E00
+(1481581768.946200) can0 3E9#1E00
+(1481581769.006198) can0 3E9#1E00
+(1481581769.066208) can0 3E9#1E00
+(1481581769.126205) can0 3E9#2000
+(1481581769.186203) can0 3E9#2000
+(1481581769.246192) can0 3E9#2000
+(1481581769.306190) can0 3E9#2000
+(1481581769.366188) can0 3E9#2200
+(1481581769.426188) can0 3E9#2200
+(1481581769.486199) can0 3E9#2200
+(1481581769.546179) can0 3E9#2200
+(1481581769.606174) can0 3E9#2400
+(1481581769.666171) can0 3E9#2400
+(1481581769.726151) can0 3E9#2400
+(1481581769.786146) can0 3E9#2400
+(1481581769.846186) can0 3E9#2600
+(1481581769.906186) can0 3E9#2600
+(1481581769.966183) can0 3E9#2600
+(1481581770.026187) can0 3E9#2600
+(1481581770.086180) can0 3E9#2800
+(1481581770.146176) can0 3E9#2800
+(1481581770.206175) can0 3E9#2800
+(1481581770.266174) can0 3E9#2800
+(1481581770.326184) can0 3E9#2A00
+(1481581770.386181) can0 3E9#2A00
+(1481581770.446150) can0 3E9#2A00
+(1481581770.506150) can0 3E9#2A00
+(1481581770.566186) can0 3E9#2C00
+(1481581770.626174) can0 3E9#2C00
+(1481581770.686172) can0 3E9#2C00
+(1481581770.746142) can0 3E9#2C00
+(1481581770.806149) can0 3E9#2E00
+(1481581770.866148) can0 3E9#2E00
+(1481581770.926157) can0 3E9#2E00
+(1481581770.986144) can0 3E9#2E00
+(1481581771.046153) can0 3E9#3000
+(1481581771.106162) can0 3E9#3000
+(1481581771.166160) can0 3E9#3000
+(1481581771.226147) can0 3E9#3000
+(1481581771.286159) can0 3E9#3200
+(1481581771.346155) can0 3E9#3200
+(1481581771.406153) can0 3E9#3200
+(1481581771.466151) can0 3E9#3200
+(1481581778.571175) can0 3D9#004B8813000000
+(1481581779.342923) can0 3D9#004B8813000000
+(1481581779.541757) can0 3D9#004B8813000000
+(1481581779.738853) can0 3D9#004B8813000000
+(1481581779.927710) can0 3D9#004B8813000000
+(1481581780.087507) can0 3D9#004B8813000000
+(1481581782.185854) can0 3E9#00C8
+(1481581782.386485) can0 3E9#00C8
+(1481581782.587542) can0 3E9#00C8
+(1481581782.776569) can0 3E9#00C8
+(1481581782.949774) can0 3E9#00C8
+(1481581784.617935) can0 3E9#0000
+(1481581784.677931) can0 3E9#0000
+(1481581784.737939) can0 3E9#0000
+(1481581784.797908) can0 3E9#0000
+(1481581784.857937) can0 3E9#0200
+(1481581784.917945) can0 3E9#0200
+(1481581784.977937) can0 3E9#0200
+(1481581785.037938) can0 3E9#0200
+(1481581785.097931) can0 3E9#0400
+(1481581785.157931) can0 3E9#0400
+(1481581785.217936) can0 3E9#0400
+(1481581785.277926) can0 3E9#0400
+(1481581785.337923) can0 3E9#0600
+(1481581785.397912) can0 3E9#0600
+(1481581785.457912) can0 3E9#0600
+(1481581785.517908) can0 3E9#0600
+(1481581785.577926) can0 3E9#0800
+(1481581785.637916) can0 3E9#0800
+(1481581785.697925) can0 3E9#0800
+(1481581785.757921) can0 3E9#0800
+(1481581785.817920) can0 3E9#0A00
+(1481581785.877918) can0 3E9#0A00
+(1481581785.937916) can0 3E9#0A00
+(1481581785.997915) can0 3E9#0A00
+(1481581786.057925) can0 3E9#0C00
+(1481581786.117922) can0 3E9#0C00
+(1481581786.177919) can0 3E9#0C00
+(1481581786.237918) can0 3E9#0C00
+(1481581786.297918) can0 3E9#0E00
+(1481581786.357915) can0 3E9#0E00
+(1481581786.417873) can0 3E9#0E00
+(1481581786.477901) can0 3E9#0E00
+(1481581786.537890) can0 3E9#1000
+(1481581786.597869) can0 3E9#1000
+(1481581786.657899) can0 3E9#1000
+(1481581786.717897) can0 3E9#1000
+(1481581786.777894) can0 3E9#1200
+(1481581786.837882) can0 3E9#1200
+(1481581786.897891) can0 3E9#1200
+(1481581786.957889) can0 3E9#1200
+(1481581787.017887) can0 3E9#1400
+(1481581787.077896) can0 3E9#1400
+(1481581787.137854) can0 3E9#1400
+(1481581787.197883) can0 3E9#1400
+(1481581787.257892) can0 3E9#1600
+(1481581787.317851) can0 3E9#1600
+(1481581787.377877) can0 3E9#1600
+(1481581787.437876) can0 3E9#1600
+(1481581787.497875) can0 3E9#1800
+(1481581787.557882) can0 3E9#1800
+(1481581787.617875) can0 3E9#1800
+(1481581787.677881) can0 3E9#1800
+(1481581787.737867) can0 3E9#1A00
+(1481581787.797866) can0 3E9#1A00
+(1481581787.857864) can0 3E9#1A00
+(1481581787.917864) can0 3E9#1A00
+(1481581787.977871) can0 3E9#1C00
+(1481581788.037891) can0 3E9#1C00
+(1481581788.097847) can0 3E9#1C00
+(1481581788.157869) can0 3E9#1C00
+(1481581788.217875) can0 3E9#1E00
+(1481581788.277872) can0 3E9#1E00
+(1481581788.337872) can0 3E9#1E00
+(1481581788.397880) can0 3E9#1E00
+(1481581788.457878) can0 3E9#2000
+(1481581788.517849) can0 3E9#2000
+(1481581788.577866) can0 3E9#2000
+(1481581788.637864) can0 3E9#2000
+(1481581788.697862) can0 3E9#2200
+(1481581788.757861) can0 3E9#2200
+(1481581788.817858) can0 3E9#2200
+(1481581788.877857) can0 3E9#2200
+(1481581788.937855) can0 3E9#2400
+(1481581788.997854) can0 3E9#2400
+(1481581789.057823) can0 3E9#2400
+(1481581789.117822) can0 3E9#2400
+(1481581789.177859) can0 3E9#2600
+(1481581789.237857) can0 3E9#2600
+(1481581789.297855) can0 3E9#2600
+(1481581789.357854) can0 3E9#2600
+(1481581789.417853) can0 3E9#2800
+(1481581789.477850) can0 3E9#2800
+(1481581789.537849) can0 3E9#2800
+(1481581789.597821) can0 3E9#2800
+(1481581789.657855) can0 3E9#2A00
+(1481581789.717856) can0 3E9#2A00
+(1481581789.777854) can0 3E9#2A00
+(1481581789.837850) can0 3E9#2A00
+(1481581789.897849) can0 3E9#2C00
+(1481581789.957850) can0 3E9#2C00
+(1481581790.017847) can0 3E9#2C00
+(1481581790.077854) can0 3E9#2C00
+(1481581790.137823) can0 3E9#2E00
+(1481581790.197832) can0 3E9#2E00
+(1481581790.257819) can0 3E9#2E00
+(1481581790.317818) can0 3E9#2E00
+(1481581790.377797) can0 3E9#3000
+(1481581790.437825) can0 3E9#3000
+(1481581790.497832) can0 3E9#3000
+(1481581790.557823) can0 3E9#3000
+(1481581790.617829) can0 3E9#3200
+(1481581790.677827) can0 3E9#3200
+(1481581790.737826) can0 3E9#3200
+(1481581790.797827) can0 3E9#3200
diff --git a/pyagl/tests/data/can/testFilter01filteredOut.canreplay b/pyagl/tests/data/can/testFilter01filteredOut.canreplay
new file mode 100644
index 0000000..5bb0bfd
--- /dev/null
+++ b/pyagl/tests/data/can/testFilter01filteredOut.canreplay
@@ -0,0 +1,508 @@
+(1520951000.000000) can0 3D9##0004B8813000000
+(1520951000.200000) can0 3D9##0004B8813000000
+(1520951000.400000) can0 3D9##0004B8813000000
+(1520951000.600000) can0 3D9##0004B8813000000
+(1520951000.800000) can0 3D9##0004B8813000000
+(1520951001.000000) can0 3D9##0004B8813000000
+(1520951001.200000) can0 3D9##0004B8813000000
+(1520951001.400000) can0 3D9##0004B8813000000
+(1520951001.600000) can0 3D9##0004B8813000000
+(1520951001.800000) can0 3D9##0004B8813000000
+(1520951002.000000) can0 3D9##0004B8813000000
+(1520951002.200000) can0 3D9##0004B8813000000
+(1520951002.400000) can0 3D9##0004B8813000000
+(1520951002.600000) can0 3D9##0004B8813000000
+(1520951002.800000) can0 3D9##0004B8813000000
+(1520951003.000000) can0 3D9##0004B8813000000
+(1520951003.200000) can0 3D9##0004B8813000000
+(1520951003.400000) can0 3D9##0004B8813000000
+(1520951003.600000) can0 3D9##0004B8813000000
+(1520951003.800000) can0 3D9##0004B8813000000
+(1520951004.000000) can0 3D9##0004B8813000000
+(1520951004.200000) can0 3D9##0004B8813000000
+(1520951004.400000) can0 3D9##0004B8813000000
+(1520951004.600000) can0 3D9##0004B8813000000
+(1520951004.800000) can0 3D9##0004B8813000000
+(1520951005.000000) can0 3D9##0004B8813000000
+(1520951005.200000) can0 3D9##0004B8813000000
+(1520951005.400000) can0 3D9##0004B8813000000
+(1520951005.600000) can0 3D9##0004B8813000000
+(1520951005.800000) can0 3D9##0004B8813000000
+(1520951006.000000) can0 3D9##0004B8813000000
+(1520951006.200000) can0 3D9##0004B8813000000
+(1520951006.400000) can0 3D9##0004B8813000000
+(1520951006.600000) can0 3D9##0004B8813000000
+(1520951006.800000) can0 3D9##0004B8813000000
+(1520951007.000000) can0 3D9##0004B8813000000
+(1520951007.200000) can0 3D9##0004B8813000000
+(1520951007.400000) can0 3D9##0004B8813000000
+(1520951007.600000) can0 3D9##0004B8813000000
+(1520951007.800000) can0 3D9##0004B8813000000
+(1520951008.000000) can0 3D9##0004B8813000000
+(1520951008.200000) can0 3D9##0004B8813000000
+(1520951008.400000) can0 3D9##0004B8813000000
+(1520951008.600000) can0 3D9##0004B8813000000
+(1520951008.800000) can0 3D9##0004B8813000000
+(1520951009.000000) can0 3D9##0004B8813000000
+(1520951009.200000) can0 3D9##0004B8813000000
+(1520951009.400000) can0 3D9##0004B8813000000
+(1520951009.600000) can0 3D9##0004B8813000000
+(1520951009.800000) can0 3D9##0004B8813000000
+(1520951010.000000) can0 3D9##0004B8813000000
+(1520951010.200000) can0 3D9##0004B8813000000
+(1520951010.400000) can0 3D9##0004B8813000000
+(1520951010.600000) can0 3D9##0004B8813000000
+(1520951010.800000) can0 3D9##0004B8813000000
+(1520951011.000000) can0 3D9##0004B8813000000
+(1520951011.200000) can0 3D9##0004B8813000000
+(1520951011.400000) can0 3D9##0004B8813000000
+(1520951011.600000) can0 3D9##0004B8813000000
+(1520951011.800000) can0 3D9##0004B8813000000
+(1520951012.000000) can0 3D9##0004B8813000000
+(1520951012.200000) can0 3D9##0004B8813000000
+(1520951012.400000) can0 3D9##0004B8813000000
+(1520951012.600000) can0 3D9##0004B8813000000
+(1520951012.800000) can0 3D9##0004B8813000000
+(1520951013.000000) can0 3D9##0004B8813000000
+(1520951013.200000) can0 3D9##0004B8813000000
+(1520951013.400000) can0 3D9##0004B8813000000
+(1520951013.600000) can0 3D9##0004B8813000000
+(1520951013.800000) can0 3D9##0004B8813000000
+(1520951014.000000) can0 3D9##0004B8813000000
+(1520951014.200000) can0 3D9##0004B8813000000
+(1520951014.400000) can0 3D9##0004B8813000000
+(1520951014.600000) can0 3D9##0004B8813000000
+(1520951014.800000) can0 3D9##0004B8813000000
+(1520951015.000000) can0 3D9##0004B8813000000
+(1520951015.200000) can0 3D9##0004B8813000000
+(1520951015.400000) can0 3D9##0004B8813000000
+(1520951015.600000) can0 3D9##0004B8813000000
+(1520951015.800000) can0 3D9##0004B8813000000
+(1520951016.000000) can0 3D9##0004B8813000000
+(1520951016.200000) can0 3D9##0004B8813000000
+(1520951016.400000) can0 3D9##0004B8813000000
+(1520951016.600000) can0 3D9##0004B8813000000
+(1520951016.800000) can0 3D9##0004B8813000000
+(1520951017.000000) can0 3D9##0004B8813000000
+(1520951017.200000) can0 3D9##0004B8813000000
+(1520951017.400000) can0 3D9##0004B8813000000
+(1520951017.600000) can0 3D9##0004B8813000000
+(1520951017.800000) can0 3D9##0004B8813000000
+(1520951018.000000) can0 3D9##0004B8813000000
+(1520951018.200000) can0 3D9##0004B8813000000
+(1520951018.400000) can0 3D9##0004B8813000000
+(1520951018.600000) can0 3D9##0004B8813000000
+(1520951018.800000) can0 3D9##0004B8813000000
+(1520951019.000000) can0 3D9##0004B8813000000
+(1520951019.200000) can0 3D9##0004B8813000000
+(1520951019.400000) can0 3D9##0004B8813000000
+(1520951019.600000) can0 3D9##0004B8813000000
+(1520951019.800000) can0 3D9##0004B8813000000
+
+
+(1520951020.000000) can0 3D9##0004B8813000000
+(1520951020.200000) can0 3D9##0004B8813000000
+(1520951020.400000) can0 3D9##0004B8813000000
+(1520951020.600000) can0 3D9##0004B8813000000
+(1520951020.800000) can0 3D9##0004B8813000000
+(1520951021.000000) can0 3D9##0004B8813000000
+(1520951021.200000) can0 3D9##0004B8813000000
+(1520951021.400000) can0 3D9##0004B8813000000
+(1520951021.600000) can0 3D9##0004B8813000000
+(1520951021.800000) can0 3D9##0004B8813000000
+(1520951022.000000) can0 3D9##0004B8813000000
+(1520951022.200000) can0 3D9##0004B8813000000
+(1520951022.400000) can0 3D9##0004B8813000000
+(1520951022.600000) can0 3D9##0004B8813000000
+(1520951022.800000) can0 3D9##0004B8813000000
+(1520951023.000000) can0 3D9##0004B8813000000
+(1520951023.200000) can0 3D9##0004B8813000000
+(1520951023.400000) can0 3D9##0004B8813000000
+(1520951023.600000) can0 3D9##0004B8813000000
+(1520951023.800000) can0 3D9##0004B8813000000
+(1520951024.000000) can0 3D9##0004B8813000000
+(1520951024.200000) can0 3D9##0004B8813000000
+(1520951024.400000) can0 3D9##0004B8813000000
+(1520951024.600000) can0 3D9##0004B8813000000
+(1520951024.800000) can0 3D9##0004B8813000000
+(1520951025.000000) can0 3D9##0004B8813000000
+(1520951025.200000) can0 3D9##0004B8813000000
+(1520951025.400000) can0 3D9##0004B8813000000
+(1520951025.600000) can0 3D9##0004B8813000000
+(1520951025.800000) can0 3D9##0004B8813000000
+(1520951026.000000) can0 3D9##0004B8813000000
+(1520951026.200000) can0 3D9##0004B8813000000
+(1520951026.400000) can0 3D9##0004B8813000000
+(1520951026.600000) can0 3D9##0004B8813000000
+(1520951026.800000) can0 3D9##0004B8813000000
+(1520951027.000000) can0 3D9##0004B8813000000
+(1520951027.200000) can0 3D9##0004B8813000000
+(1520951027.400000) can0 3D9##0004B8813000000
+(1520951027.600000) can0 3D9##0004B8813000000
+(1520951027.800000) can0 3D9##0004B8813000000
+(1520951028.000000) can0 3D9##0004B8813000000
+(1520951028.200000) can0 3D9##0004B8813000000
+(1520951028.400000) can0 3D9##0004B8813000000
+(1520951028.600000) can0 3D9##0004B8813000000
+(1520951028.800000) can0 3D9##0004B8813000000
+(1520951029.000000) can0 3D9##0004B8813000000
+(1520951029.200000) can0 3D9##0004B8813000000
+(1520951029.400000) can0 3D9##0004B8813000000
+(1520951029.600000) can0 3D9##0004B8813000000
+(1520951029.800000) can0 3D9##0004B8813000000
+(1520951030.000000) can0 3D9##0004B8813000000
+(1520951030.200000) can0 3D9##0004B8813000000
+(1520951030.400000) can0 3D9##0004B8813000000
+(1520951030.600000) can0 3D9##0004B8813000000
+(1520951030.800000) can0 3D9##0004B8813000000
+(1520951031.000000) can0 3D9##0004B8813000000
+(1520951031.200000) can0 3D9##0004B8813000000
+(1520951031.400000) can0 3D9##0004B8813000000
+(1520951031.600000) can0 3D9##0004B8813000000
+(1520951031.800000) can0 3D9##0004B8813000000
+(1520951032.000000) can0 3D9##0004B8813000000
+(1520951032.200000) can0 3D9##0004B8813000000
+(1520951032.400000) can0 3D9##0004B8813000000
+(1520951032.600000) can0 3D9##0004B8813000000
+(1520951032.800000) can0 3D9##0004B8813000000
+(1520951033.000000) can0 3D9##0004B8813000000
+(1520951033.200000) can0 3D9##0004B8813000000
+(1520951033.400000) can0 3D9##0004B8813000000
+(1520951033.600000) can0 3D9##0004B8813000000
+(1520951033.800000) can0 3D9##0004B8813000000
+(1520951034.000000) can0 3D9##0004B8813000000
+(1520951034.200000) can0 3D9##0004B8813000000
+(1520951034.400000) can0 3D9##0004B8813000000
+(1520951034.600000) can0 3D9##0004B8813000000
+(1520951034.800000) can0 3D9##0004B8813000000
+(1520951035.000000) can0 3D9##0004B8813000000
+(1520951035.200000) can0 3D9##0004B8813000000
+(1520951035.400000) can0 3D9##0004B8813000000
+(1520951035.600000) can0 3D9##0004B8813000000
+(1520951035.800000) can0 3D9##0004B8813000000
+(1520951036.000000) can0 3D9##0004B8813000000
+(1520951036.200000) can0 3D9##0004B8813000000
+(1520951036.400000) can0 3D9##0004B8813000000
+(1520951036.600000) can0 3D9##0004B8813000000
+(1520951036.800000) can0 3D9##0004B8813000000
+(1520951037.000000) can0 3D9##0004B8813000000
+(1520951037.200000) can0 3D9##0004B8813000000
+(1520951037.400000) can0 3D9##0004B8813000000
+(1520951037.600000) can0 3D9##0004B8813000000
+(1520951037.800000) can0 3D9##0004B8813000000
+(1520951038.000000) can0 3D9##0004B8813000000
+(1520951038.200000) can0 3D9##0004B8813000000
+(1520951038.400000) can0 3D9##0004B8813000000
+(1520951038.600000) can0 3D9##0004B8813000000
+(1520951038.800000) can0 3D9##0004B8813000000
+(1520951039.000000) can0 3D9##0004B8813000000
+(1520951039.200000) can0 3D9##0004B8813000000
+(1520951039.400000) can0 3D9##0004B8813000000
+(1520951039.600000) can0 3D9##0004B8813000000
+(1520951039.800000) can0 3D9##0004B8813000000
+
+
+(1520951040.000000) can0 3D9##0004B8813000000
+(1520951040.200000) can0 3D9##0004B8813000000
+(1520951040.400000) can0 3D9##0004B8813000000
+(1520951040.600000) can0 3D9##0004B8813000000
+(1520951040.800000) can0 3D9##0004B8813000000
+(1520951041.000000) can0 3D9##0004B8813000000
+(1520951041.200000) can0 3D9##0004B8813000000
+(1520951041.400000) can0 3D9##0004B8813000000
+(1520951041.600000) can0 3D9##0004B8813000000
+(1520951041.800000) can0 3D9##0004B8813000000
+(1520951042.000000) can0 3D9##0004B8813000000
+(1520951042.200000) can0 3D9##0004B8813000000
+(1520951042.400000) can0 3D9##0004B8813000000
+(1520951042.600000) can0 3D9##0004B8813000000
+(1520951042.800000) can0 3D9##0004B8813000000
+(1520951043.000000) can0 3D9##0004B8813000000
+(1520951043.200000) can0 3D9##0004B8813000000
+(1520951043.400000) can0 3D9##0004B8813000000
+(1520951043.600000) can0 3D9##0004B8813000000
+(1520951043.800000) can0 3D9##0004B8813000000
+(1520951044.000000) can0 3D9##0004B8813000000
+(1520951044.200000) can0 3D9##0004B8813000000
+(1520951044.400000) can0 3D9##0004B8813000000
+(1520951044.600000) can0 3D9##0004B8813000000
+(1520951044.800000) can0 3D9##0004B8813000000
+(1520951045.000000) can0 3D9##0004B8813000000
+(1520951045.200000) can0 3D9##0004B8813000000
+(1520951045.400000) can0 3D9##0004B8813000000
+(1520951045.600000) can0 3D9##0004B8813000000
+(1520951045.800000) can0 3D9##0004B8813000000
+(1520951046.000000) can0 3D9##0004B8813000000
+(1520951046.200000) can0 3D9##0004B8813000000
+(1520951046.400000) can0 3D9##0004B8813000000
+(1520951046.600000) can0 3D9##0004B8813000000
+(1520951046.800000) can0 3D9##0004B8813000000
+(1520951047.000000) can0 3D9##0004B8813000000
+(1520951047.200000) can0 3D9##0004B8813000000
+(1520951047.400000) can0 3D9##0004B8813000000
+(1520951047.600000) can0 3D9##0004B8813000000
+(1520951047.800000) can0 3D9##0004B8813000000
+(1520951048.000000) can0 3D9##0004B8813000000
+(1520951048.200000) can0 3D9##0004B8813000000
+(1520951048.400000) can0 3D9##0004B8813000000
+(1520951048.600000) can0 3D9##0004B8813000000
+(1520951048.800000) can0 3D9##0004B8813000000
+(1520951049.000000) can0 3D9##0004B8813000000
+(1520951049.200000) can0 3D9##0004B8813000000
+(1520951049.400000) can0 3D9##0004B8813000000
+(1520951049.600000) can0 3D9##0004B8813000000
+(1520951049.800000) can0 3D9##0004B8813000000
+(1520951050.000000) can0 3D9##0004B8813000000
+(1520951050.200000) can0 3D9##0004B8813000000
+(1520951050.400000) can0 3D9##0004B8813000000
+(1520951050.600000) can0 3D9##0004B8813000000
+(1520951050.800000) can0 3D9##0004B8813000000
+(1520951051.000000) can0 3D9##0004B8813000000
+(1520951051.200000) can0 3D9##0004B8813000000
+(1520951051.400000) can0 3D9##0004B8813000000
+(1520951051.600000) can0 3D9##0004B8813000000
+(1520951051.800000) can0 3D9##0004B8813000000
+(1520951052.000000) can0 3D9##0004B8813000000
+(1520951052.200000) can0 3D9##0004B8813000000
+(1520951052.400000) can0 3D9##0004B8813000000
+(1520951052.600000) can0 3D9##0004B8813000000
+(1520951052.800000) can0 3D9##0004B8813000000
+(1520951053.000000) can0 3D9##0004B8813000000
+(1520951053.200000) can0 3D9##0004B8813000000
+(1520951053.400000) can0 3D9##0004B8813000000
+(1520951053.600000) can0 3D9##0004B8813000000
+(1520951053.800000) can0 3D9##0004B8813000000
+(1520951054.000000) can0 3D9##0004B8813000000
+(1520951054.200000) can0 3D9##0004B8813000000
+(1520951054.400000) can0 3D9##0004B8813000000
+(1520951054.600000) can0 3D9##0004B8813000000
+(1520951054.800000) can0 3D9##0004B8813000000
+(1520951055.000000) can0 3D9##0004B8813000000
+(1520951055.200000) can0 3D9##0004B8813000000
+(1520951055.400000) can0 3D9##0004B8813000000
+(1520951055.600000) can0 3D9##0004B8813000000
+(1520951055.800000) can0 3D9##0004B8813000000
+(1520951056.000000) can0 3D9##0004B8813000000
+(1520951056.200000) can0 3D9##0004B8813000000
+(1520951056.400000) can0 3D9##0004B8813000000
+(1520951056.600000) can0 3D9##0004B8813000000
+(1520951056.800000) can0 3D9##0004B8813000000
+(1520951057.000000) can0 3D9##0004B8813000000
+(1520951057.200000) can0 3D9##0004B8813000000
+(1520951057.400000) can0 3D9##0004B8813000000
+(1520951057.600000) can0 3D9##0004B8813000000
+(1520951057.800000) can0 3D9##0004B8813000000
+(1520951058.000000) can0 3D9##0004B8813000000
+(1520951058.200000) can0 3D9##0004B8813000000
+(1520951058.400000) can0 3D9##0004B8813000000
+(1520951058.600000) can0 3D9##0004B8813000000
+(1520951058.800000) can0 3D9##0004B8813000000
+(1520951059.000000) can0 3D9##0004B8813000000
+(1520951059.200000) can0 3D9##0004B8813000000
+(1520951059.400000) can0 3D9##0004B8813000000
+(1520951059.600000) can0 3D9##0004B8813000000
+(1520951059.800000) can0 3D9##0004B8813000000
+
+
+(1520951060.000000) can0 3D9##0004B8813000000
+(1520951060.200000) can0 3D9##0004B8813000000
+(1520951060.400000) can0 3D9##0004B8813000000
+(1520951060.600000) can0 3D9##0004B8813000000
+(1520951060.800000) can0 3D9##0004B8813000000
+(1520951061.000000) can0 3D9##0004B8813000000
+(1520951061.200000) can0 3D9##0004B8813000000
+(1520951061.400000) can0 3D9##0004B8813000000
+(1520951061.600000) can0 3D9##0004B8813000000
+(1520951061.800000) can0 3D9##0004B8813000000
+(1520951062.000000) can0 3D9##0004B8813000000
+(1520951062.200000) can0 3D9##0004B8813000000
+(1520951062.400000) can0 3D9##0004B8813000000
+(1520951062.600000) can0 3D9##0004B8813000000
+(1520951062.800000) can0 3D9##0004B8813000000
+(1520951063.000000) can0 3D9##0004B8813000000
+(1520951063.200000) can0 3D9##0004B8813000000
+(1520951063.400000) can0 3D9##0004B8813000000
+(1520951063.600000) can0 3D9##0004B8813000000
+(1520951063.800000) can0 3D9##0004B8813000000
+(1520951064.000000) can0 3D9##0004B8813000000
+(1520951064.200000) can0 3D9##0004B8813000000
+(1520951064.400000) can0 3D9##0004B8813000000
+(1520951064.600000) can0 3D9##0004B8813000000
+(1520951064.800000) can0 3D9##0004B8813000000
+(1520951065.000000) can0 3D9##0004B8813000000
+(1520951065.200000) can0 3D9##0004B8813000000
+(1520951065.400000) can0 3D9##0004B8813000000
+(1520951065.600000) can0 3D9##0004B8813000000
+(1520951065.800000) can0 3D9##0004B8813000000
+(1520951066.000000) can0 3D9##0004B8813000000
+(1520951066.200000) can0 3D9##0004B8813000000
+(1520951066.400000) can0 3D9##0004B8813000000
+(1520951066.600000) can0 3D9##0004B8813000000
+(1520951066.800000) can0 3D9##0004B8813000000
+(1520951067.000000) can0 3D9##0004B8813000000
+(1520951067.200000) can0 3D9##0004B8813000000
+(1520951067.400000) can0 3D9##0004B8813000000
+(1520951067.600000) can0 3D9##0004B8813000000
+(1520951067.800000) can0 3D9##0004B8813000000
+(1520951068.000000) can0 3D9##0004B8813000000
+(1520951068.200000) can0 3D9##0004B8813000000
+(1520951068.400000) can0 3D9##0004B8813000000
+(1520951068.600000) can0 3D9##0004B8813000000
+(1520951068.800000) can0 3D9##0004B8813000000
+(1520951069.000000) can0 3D9##0004B8813000000
+(1520951069.200000) can0 3D9##0004B8813000000
+(1520951069.400000) can0 3D9##0004B8813000000
+(1520951069.600000) can0 3D9##0004B8813000000
+(1520951069.800000) can0 3D9##0004B8813000000
+(1520951070.000000) can0 3D9##0004B8813000000
+(1520951070.200000) can0 3D9##0004B8813000000
+(1520951070.400000) can0 3D9##0004B8813000000
+(1520951070.600000) can0 3D9##0004B8813000000
+(1520951070.800000) can0 3D9##0004B8813000000
+(1520951071.000000) can0 3D9##0004B8813000000
+(1520951071.200000) can0 3D9##0004B8813000000
+(1520951071.400000) can0 3D9##0004B8813000000
+(1520951071.600000) can0 3D9##0004B8813000000
+(1520951071.800000) can0 3D9##0004B8813000000
+(1520951072.000000) can0 3D9##0004B8813000000
+(1520951072.200000) can0 3D9##0004B8813000000
+(1520951072.400000) can0 3D9##0004B8813000000
+(1520951072.600000) can0 3D9##0004B8813000000
+(1520951072.800000) can0 3D9##0004B8813000000
+(1520951073.000000) can0 3D9##0004B8813000000
+(1520951073.200000) can0 3D9##0004B8813000000
+(1520951073.400000) can0 3D9##0004B8813000000
+(1520951073.600000) can0 3D9##0004B8813000000
+(1520951073.800000) can0 3D9##0004B8813000000
+(1520951074.000000) can0 3D9##0004B8813000000
+(1520951074.200000) can0 3D9##0004B8813000000
+(1520951074.400000) can0 3D9##0004B8813000000
+(1520951074.600000) can0 3D9##0004B8813000000
+(1520951074.800000) can0 3D9##0004B8813000000
+(1520951075.000000) can0 3D9##0004B8813000000
+(1520951075.200000) can0 3D9##0004B8813000000
+(1520951075.400000) can0 3D9##0004B8813000000
+(1520951075.600000) can0 3D9##0004B8813000000
+(1520951075.800000) can0 3D9##0004B8813000000
+(1520951076.000000) can0 3D9##0004B8813000000
+(1520951076.200000) can0 3D9##0004B8813000000
+(1520951076.400000) can0 3D9##0004B8813000000
+(1520951076.600000) can0 3D9##0004B8813000000
+(1520951076.800000) can0 3D9##0004B8813000000
+(1520951077.000000) can0 3D9##0004B8813000000
+(1520951077.200000) can0 3D9##0004B8813000000
+(1520951077.400000) can0 3D9##0004B8813000000
+(1520951077.600000) can0 3D9##0004B8813000000
+(1520951077.800000) can0 3D9##0004B8813000000
+(1520951078.000000) can0 3D9##0004B8813000000
+(1520951078.200000) can0 3D9##0004B8813000000
+(1520951078.400000) can0 3D9##0004B8813000000
+(1520951078.600000) can0 3D9##0004B8813000000
+(1520951078.800000) can0 3D9##0004B8813000000
+(1520951079.000000) can0 3D9##0004B8813000000
+(1520951079.200000) can0 3D9##0004B8813000000
+(1520951079.400000) can0 3D9##0004B8813000000
+(1520951079.600000) can0 3D9##0004B8813000000
+(1520951079.800000) can0 3D9##0004B8813000000
+
+
+(1520951080.000000) can0 3D9##0004B8813000000
+(1520951080.200000) can0 3D9##0004B8813000000
+(1520951080.400000) can0 3D9##0004B8813000000
+(1520951080.600000) can0 3D9##0004B8813000000
+(1520951080.800000) can0 3D9##0004B8813000000
+(1520951081.000000) can0 3D9##0004B8813000000
+(1520951081.200000) can0 3D9##0004B8813000000
+(1520951081.400000) can0 3D9##0004B8813000000
+(1520951081.600000) can0 3D9##0004B8813000000
+(1520951081.800000) can0 3D9##0004B8813000000
+(1520951082.000000) can0 3D9##0004B8813000000
+(1520951082.200000) can0 3D9##0004B8813000000
+(1520951082.400000) can0 3D9##0004B8813000000
+(1520951082.600000) can0 3D9##0004B8813000000
+(1520951082.800000) can0 3D9##0004B8813000000
+(1520951083.000000) can0 3D9##0004B8813000000
+(1520951083.200000) can0 3D9##0004B8813000000
+(1520951083.400000) can0 3D9##0004B8813000000
+(1520951083.600000) can0 3D9##0004B8813000000
+(1520951083.800000) can0 3D9##0004B8813000000
+(1520951084.000000) can0 3D9##0004B8813000000
+(1520951084.200000) can0 3D9##0004B8813000000
+(1520951084.400000) can0 3D9##0004B8813000000
+(1520951084.600000) can0 3D9##0004B8813000000
+(1520951084.800000) can0 3D9##0004B8813000000
+(1520951085.000000) can0 3D9##0004B8813000000
+(1520951085.200000) can0 3D9##0004B8813000000
+(1520951085.400000) can0 3D9##0004B8813000000
+(1520951085.600000) can0 3D9##0004B8813000000
+(1520951085.800000) can0 3D9##0004B8813000000
+(1520951086.000000) can0 3D9##0004B8813000000
+(1520951086.200000) can0 3D9##0004B8813000000
+(1520951086.400000) can0 3D9##0004B8813000000
+(1520951086.600000) can0 3D9##0004B8813000000
+(1520951086.800000) can0 3D9##0004B8813000000
+(1520951087.000000) can0 3D9##0004B8813000000
+(1520951087.200000) can0 3D9##0004B8813000000
+(1520951087.400000) can0 3D9##0004B8813000000
+(1520951087.600000) can0 3D9##0004B8813000000
+(1520951087.800000) can0 3D9##0004B8813000000
+(1520951088.000000) can0 3D9##0004B8813000000
+(1520951088.200000) can0 3D9##0004B8813000000
+(1520951088.400000) can0 3D9##0004B8813000000
+(1520951088.600000) can0 3D9##0004B8813000000
+(1520951088.800000) can0 3D9##0004B8813000000
+(1520951089.000000) can0 3D9##0004B8813000000
+(1520951089.200000) can0 3D9##0004B8813000000
+(1520951089.400000) can0 3D9##0004B8813000000
+(1520951089.600000) can0 3D9##0004B8813000000
+(1520951089.800000) can0 3D9##0004B8813000000
+(1520951090.000000) can0 3D9##0004B8813000000
+(1520951090.200000) can0 3D9##0004B8813000000
+(1520951090.400000) can0 3D9##0004B8813000000
+(1520951090.600000) can0 3D9##0004B8813000000
+(1520951090.800000) can0 3D9##0004B8813000000
+(1520951091.000000) can0 3D9##0004B8813000000
+(1520951091.200000) can0 3D9##0004B8813000000
+(1520951091.400000) can0 3D9##0004B8813000000
+(1520951091.600000) can0 3D9##0004B8813000000
+(1520951091.800000) can0 3D9##0004B8813000000
+(1520951092.000000) can0 3D9##0004B8813000000
+(1520951092.200000) can0 3D9##0004B8813000000
+(1520951092.400000) can0 3D9##0004B8813000000
+(1520951092.600000) can0 3D9##0004B8813000000
+(1520951092.800000) can0 3D9##0004B8813000000
+(1520951093.000000) can0 3D9##0004B8813000000
+(1520951093.200000) can0 3D9##0004B8813000000
+(1520951093.400000) can0 3D9##0004B8813000000
+(1520951093.600000) can0 3D9##0004B8813000000
+(1520951093.800000) can0 3D9##0004B8813000000
+(1520951094.000000) can0 3D9##0004B8813000000
+(1520951094.200000) can0 3D9##0004B8813000000
+(1520951094.400000) can0 3D9##0004B8813000000
+(1520951094.600000) can0 3D9##0004B8813000000
+(1520951094.800000) can0 3D9##0004B8813000000
+(1520951095.000000) can0 3D9##0004B8813000000
+(1520951095.200000) can0 3D9##0004B8813000000
+(1520951095.400000) can0 3D9##0004B8813000000
+(1520951095.600000) can0 3D9##0004B8813000000
+(1520951095.800000) can0 3D9##0004B8813000000
+(1520951096.000000) can0 3D9##0004B8813000000
+(1520951096.200000) can0 3D9##0004B8813000000
+(1520951096.400000) can0 3D9##0004B8813000000
+(1520951096.600000) can0 3D9##0004B8813000000
+(1520951096.800000) can0 3D9##0004B8813000000
+(1520951097.000000) can0 3D9##0004B8813000000
+(1520951097.200000) can0 3D9##0004B8813000000
+(1520951097.400000) can0 3D9##0004B8813000000
+(1520951097.600000) can0 3D9##0004B8813000000
+(1520951097.800000) can0 3D9##0004B8813000000
+(1520951098.000000) can0 3D9##0004B8813000000
+(1520951098.200000) can0 3D9##0004B8813000000
+(1520951098.400000) can0 3D9##0004B8813000000
+(1520951098.600000) can0 3D9##0004B8813000000
+(1520951098.800000) can0 3D9##0004B8813000000
+(1520951099.000000) can0 3D9##0004B8813000000
+(1520951099.200000) can0 3D9##0004B8813000000
+(1520951099.400000) can0 3D9##0004B8813000000
+(1520951099.600000) can0 3D9##0004B8813000000
+(1520951099.800000) can0 3D9##0004B8813000000
diff --git a/pyagl/tests/data/can/testFilter01pass-FD.canreplay b/pyagl/tests/data/can/testFilter01pass-FD.canreplay
new file mode 100644
index 0000000..dd9772b
--- /dev/null
+++ b/pyagl/tests/data/can/testFilter01pass-FD.canreplay
@@ -0,0 +1,8 @@
+(1520951000.000000) can0 3DA##000000050000000
+(1520951000.000000) can0 3DA##000000074000000
+(1520951000.000000) can0 3DA##000000320000000
+(1520951000.000000) can0 3DA##000000194000000
+(1520951000.000000) can0 3DA##000000078000000
+(1520951000.000000) can0 3DA##000000190000000
+(1520951000.000000) can0 3DA##000000090000000
+(1520951001.100000) can0 3DA##000000080000000
diff --git a/pyagl/tests/data/can/testFilter01pass.canreplay b/pyagl/tests/data/can/testFilter01pass.canreplay
new file mode 100644
index 0000000..dfb6b14
--- /dev/null
+++ b/pyagl/tests/data/can/testFilter01pass.canreplay
@@ -0,0 +1,8 @@
+(1520951000.000000) can0 3D9#0000005000000000
+(1520951000.100000) can0 3D9#0000007400000000
+(1520951000.200000) can0 3D9#0000032000000000
+(1520951000.300000) can0 3D9#0000019400000000
+(1520951000.400000) can0 3D9#0000007800000000
+(1520951000.500000) can0 3D9#0000019000000000
+(1520951000.600000) can0 3D9#0000009000000000
+(1520951000.700000) can0 3D9#0000008000000000
diff --git a/pyagl/tests/data/can/testValueCAN_1.canreplay b/pyagl/tests/data/can/testValueCAN_1.canreplay
new file mode 100644
index 0000000..4d74037
--- /dev/null
+++ b/pyagl/tests/data/can/testValueCAN_1.canreplay
@@ -0,0 +1 @@
+(1481581765.766257) can0 3E9#0400 \ No newline at end of file
diff --git a/pyagl/tests/data/can/testValueCAN_2.canreplay b/pyagl/tests/data/can/testValueCAN_2.canreplay
new file mode 100644
index 0000000..b907241
--- /dev/null
+++ b/pyagl/tests/data/can/testValueCAN_2.canreplay
@@ -0,0 +1 @@
+(1491154074.555941) can0 7E8#04410C1FF5000000 \ No newline at end of file
diff --git a/pyagl/tests/data/can/testValueCAN_3.canreplay b/pyagl/tests/data/can/testValueCAN_3.canreplay
new file mode 100644
index 0000000..1624853
--- /dev/null
+++ b/pyagl/tests/data/can/testValueCAN_3.canreplay
@@ -0,0 +1 @@
+(1491154074.817723) can0 7E8#0341048C00000000 \ No newline at end of file
diff --git a/pyagl/tests/data/can/testValueJ1939_1.canreplay b/pyagl/tests/data/can/testValueJ1939_1.canreplay
new file mode 100644
index 0000000..d08971e
--- /dev/null
+++ b/pyagl/tests/data/can/testValueJ1939_1.canreplay
@@ -0,0 +1 @@
+(1481581765.346271) can0 09FD0202#EC5D0087C2FAFFFF
diff --git a/pyagl/tests/data/can/testj1939.canreplay b/pyagl/tests/data/can/testj1939.canreplay
new file mode 100644
index 0000000..90b89c9
--- /dev/null
+++ b/pyagl/tests/data/can/testj1939.canreplay
@@ -0,0 +1 @@
+(08255.460200) can0 0CF00203#CD402800043828FF
diff --git a/pyagl/tests/test_can.py b/pyagl/tests/test_can.py
index 70403df..d84fec3 100644
--- a/pyagl/tests/test_can.py
+++ b/pyagl/tests/test_can.py
@@ -19,6 +19,7 @@ import pytest
import logging
import asyncssh
import subprocess
+from pathlib import Path
from pyagl.services.base import AFBResponse, AFBT
@@ -41,32 +42,62 @@ async def service():
await svc.websocket.close()
-@pytest.fixture(scope='module')
-async def prepare_replay_files(service: cs):
- result = None
-
- if service.ip != 'localhost':
- async with asyncssh.connect(service.ip, username='root') as ssh:
- result = await ssh.run('unzip -jo /usr/AGL/apps/test/agl-service-can-low-level-test.wgt var/*.canreplay -d /tmp/canlowfixtures/')
- assert result.returncode == 0, "there was a problem during *.canreplay fixture extraction"
- else:
- result = subprocess.check_output('unzip -jo /usr/AGL/apps/test/agl-service-can-low-level-test.wgt var/*.canreplay -d /tmp/canlowfixtures/', shell=True)
-
-
-@pytest.fixture(scope='module')
-async def canplayer(service, prepare_replay_files, request):
+@pytest.fixture()
+async def prepare_replay_file(service: cs, request):
+ path = Path(__file__).parent
+ data = path.joinpath('data', 'can', request.param)
if service.ip != 'localhost':
- async with asyncssh.connect(service.ip, username='root') as ssh:
- result = await ssh.run(f'nohup canplayer -I /tmp/canlowfixtures/{request.param} < /dev/null > /dev/null 2>&1 &')
- yield None
- pid = await ssh.run("killall -9 canplayer")
- else: # running on target
- proc = subprocess.Popen(f'nohup canplayer -I /tmp/canlowfixtures/{request.param} < /dev/null > /dev/null 2>&1 &', shell=True)
- yield None
- subprocess.check_output('killall -9 canplayer', shell=True)
-
-
-# basic tests
+ async with asyncssh.connect(service.ip, username='root', known_hosts=None) as ssh:
+ await asyncssh.scp(str(data), (ssh, '/tmp/'))
+
+
+# Helper class to run canplayer
+class canplayer:
+ service: cs
+ filename: str
+ remote: bool
+ args = None
+ task = None
+ ssh = None
+
+ def __init__(self, service : cs):
+ self.service = service
+ self.remote = service.ip != 'localhost'
+ self.args = [ '/usr/bin/canplayer', '-I' ]
+
+ async def play(self, filename : str):
+ if self.remote:
+ filename = '/tmp/' + filename
+ args = self.args
+ args.append(filename)
+ self.ssh = await asyncssh.connect(self.service.ip, username='root', known_hosts=None)
+ self.task = await self.ssh.create_process(' '.join(args))
+ else:
+ path = Path(__file__).parent
+ data = path.joinpath('data', 'can', filename)
+ args = self.args
+ args.append(str(data))
+ self.task = subprocess.Popen(args)
+
+ async def stop(self):
+ if self.remote:
+ # Ideally we'd just call self.task.kill() here, but that does not work
+ # with OpenSSH's sshd as the remote side, as it does not implement
+ # signalling. Just running a killall over the open connection is the
+ # seemingly simplest solution. Other more complicated options would
+ # be to hook up the stdin and set the term type so that a break
+ # character can be sent, or tinkering with the command to get the pid
+ # over stdout so the specific process can be killed...
+ # Just closing the connection leaves the canplayer running in the
+ # background, which can throw off subsequent tests.
+ await self.ssh.run('killall -9 canplayer')
+ self.ssh.close()
+ else:
+ self.task.kill()
+ self.task = None
+
+
+# Common test CAN message contents
hsmessage = {'bus_name': 'hs',
'frame': {
'can_id': 1568,
@@ -75,7 +106,9 @@ hsmessage = {'bus_name': 'hs',
}}
-@pytest.mark.dependency
+# Basic tests
+
+@pytest.mark.dependency()
async def test_list(event_loop, service: cs):
msgid = await service.list()
resp = await service.afbresponse()
@@ -88,7 +121,7 @@ async def test_get(event_loop, service: cs):
assert resp.status == 'success', resp.info
-# @pytest.mark.dependency(depends=['test_list'])
+@pytest.mark.dependency(depends=['test_list'])
async def test_get_all_messages(event_loop, service: cs):
msgid = await service.list()
resp = await service.afbresponse()
@@ -99,18 +132,20 @@ async def test_get_all_messages(event_loop, service: cs):
assert resp.status == 'success', f'.get() failed with message {m}'
-async def test_auth(event_loop, service: cs):
- msgid = await service.auth()
- resp = await service.afbresponse()
- assert resp.status == 'success', resp.info
-
-
async def test_write_wo_auth(event_loop, service: cs):
msgid = await service.write({'signal_name': 'engine.speed', 'signal_value': 12})
resp = await service.afbresponse()
assert resp.type == AFBT.ERROR
+@pytest.mark.dependency()
+async def test_auth(event_loop, service: cs):
+ msgid = await service.auth()
+ resp = await service.afbresponse()
+ assert resp.status == 'success', resp.info
+
+
+@pytest.mark.dependency(depends=['test_auth'])
async def test_write(event_loop, service: cs):
msgid = await service.write({"signal_name": "hvac.temperature.left", "signal_value": 21})
resp = await service.afbresponse()
@@ -205,7 +240,7 @@ async def test_get_written_message(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.dependency
+@pytest.mark.dependency()
async def test_subscribe(event_loop, service: cs):
msgid = await service.subscribe('*')
resp = await service.afbresponse()
@@ -219,41 +254,61 @@ async def test_unsubscribe(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.parametrize('canplayer', ['test1.canreplay'], indirect=True)
-async def test_diagnostic_engine_speed_simulation(event_loop, service: cs, canplayer):
+@pytest.mark.parametrize('prepare_replay_file', ['test1.canreplay'], indirect=True)
+async def test_diagnostic_engine_speed_simulation(event_loop, service: cs, prepare_replay_file):
eventname = 'diagnostic_messages.engine.speed'
msgid = await service.subscribe(eventname)
resp = await service.afbresponse()
assert resp.status == 'success', f'Could not subscribe for {eventname}; info: {resp.info}'
- async for resp in service.listener():
- resp = await service.afbresponse()
- assert 'name' in resp.data
- assert resp.data['name'] == eventname
- break
+ async def listen(service: cs):
+ async for resp in service.listener():
+ assert 'name' in resp.data
+ assert resp.data['name'] == eventname
+ break
+
+ listener = asyncio.create_task(listen(service))
+ player = canplayer(service)
+ assert player is not None
+ await player.play('test1.canreplay')
+ await listener
+ await player.stop()
msgid = await service.unsubscribe(eventname)
- async for resp in service.listener(): # wait until the event queue flushes out and we get unsubscribe confirmation
+ # wait until the event queue flushes out and we get unsubscribe confirmation
+ async for resp in service.listener():
if resp.type != AFBT.RESPONSE: continue
if resp.msgid != msgid: continue
assert resp.status == 'success', f'Could not unsubscribe from {eventname}; info: {resp.info}'
break
-@pytest.mark.parametrize('canplayer', ['test2-3.canreplay'], indirect=True)
-async def test_Subscribe_all(event_loop, service: cs, canplayer):
+@pytest.mark.parametrize('prepare_replay_file', ['test2-3.canreplay'], indirect=True)
+async def test_Subscribe_all(event_loop, service: cs, prepare_replay_file):
eventname = 'messages.vehicle.average.speed'
msgid = await service.subscribe('*')
resp = await service.afbresponse()
assert resp.status == 'success', f'Could not subscribe for all events; info: {resp.info}'
- async for resp in service.listener():
- assert 'name' in resp.data
- assert resp.data['name'] == eventname
- break
+ async def listen(service: cs):
+ async for resp in service.listener():
+ assert 'name' in resp.data
+ logging.debug(f"{resp.data['name']} = {resp.data['value']} ({resp.data['timestamp']})")
+ if resp.data['name'] == 'diagnostic_messages.engine.speed':
+ continue
+ assert resp.data['name'] == eventname
+ break
+
+ listener = asyncio.create_task(listen(service))
+ player = canplayer(service)
+ assert player is not None
+ await player.play('test2-3.canreplay')
+ await listener
+ await player.stop()
msgid = await service.unsubscribe('*')
- async for resp in service.listener(): # wait until the event queue flushes out and we get unsubscribe confirmation
+ # wait until the event queue flushes out and we get unsubscribe confirmation
+ async for resp in service.listener():
if resp.type != AFBT.RESPONSE: continue
if resp.msgid != msgid: continue
assert resp.status == 'success', f'Could not unsubscribe from {eventname}; info: {resp.info}'
@@ -263,9 +318,8 @@ async def test_Subscribe_all(event_loop, service: cs, canplayer):
# Filter tests
-
-@pytest.mark.parametrize('canplayer', ['testFilter01filteredOut.canreplay'], indirect=True)
-async def test_Filter_Test_01_Step_1(event_loop, service: cs, canplayer):
+@pytest.mark.parametrize('prepare_replay_file', ['testFilter01filteredOut.canreplay'], indirect=True)
+async def test_Filter_Test_01_Step_1(event_loop, service: cs, prepare_replay_file):
minspeed = 30
maxspeed = 100
eventname = 'messages.engine.speed'
@@ -273,20 +327,29 @@ async def test_Filter_Test_01_Step_1(event_loop, service: cs, canplayer):
resp = await service.afbresponse()
assert resp.status == 'success', f'Could not subscribe for {eventname} events; info: {resp.info}'
- async for resp in service.listener():
- assert resp is None, "Test failed, was supposed to timeout and return None on this fixture, but returned data"
- break
+ async def listen(service: cs):
+ async for resp in service.listener():
+ assert resp is None, "Test failed, was supposed to timeout and return None on this fixture, but returned data"
+ break
+
+ listener = asyncio.create_task(listen(service))
+ player = canplayer(service)
+ assert player is not None
+ await player.play('testFilter01filteredOut.canreplay')
+ await listener
+ await player.stop()
msgid = await service.unsubscribe({'event': eventname, 'filter': {'min': minspeed, 'max': maxspeed}})
- async for resp in service.listener(): # discard events in the queue until it flushes out and we get unsub confirm
+ # wait until the event queue flushes out and we get unsubscribe confirmation
+ async for resp in service.listener():
if resp.type == AFBT.EVENT: continue
if resp.msgid != msgid: continue
assert resp.status == 'success', f'Could not unsubscribe from {eventname}; info: {resp.info}'
break
-@pytest.mark.parametrize('canplayer', ['testFilter01pass.canreplay'], indirect=True)
-async def test_Filter_Test_01_Step_2(event_loop, service: cs, canplayer):
+@pytest.mark.parametrize('prepare_replay_file', ['testFilter01pass.canreplay'], indirect=True)
+async def test_Filter_Test_01_Step_2(event_loop, service: cs, prepare_replay_file):
minspeed = 30
maxspeed = 100
eventname = 'messages.engine.speed'
@@ -294,22 +357,37 @@ async def test_Filter_Test_01_Step_2(event_loop, service: cs, canplayer):
resp = await service.afbresponse()
assert resp.status == 'success', f'Could not subscribe for {eventname} events; info: {resp.info}'
- async for resp in service.listener():
- assert 'name' in resp.data
- assert resp.data['name'] == eventname
- assert minspeed < resp.data['value'] < maxspeed
- break
+ async def listen(service: cs):
+ expected = [ 30.0, 100.0, 36.0, 32.0 ]
+ i = 0
+ async for resp in service.listener():
+ assert 'name' in resp.data
+ logging.debug(f"{resp.data['name']} = {resp.data['value']} ({resp.data['timestamp']})")
+ assert resp.data['name'] == eventname
+ assert minspeed <= resp.data['value'] <= maxspeed
+ assert resp.data['value'] == expected[i]
+ i += 1
+ if i == len(expected):
+ break
+
+ listener = asyncio.create_task(listen(service))
+ player = canplayer(service)
+ assert player is not None
+ await player.play('testFilter01pass.canreplay')
+ await listener
+ await player.stop()
msgid = await service.unsubscribe({'event': eventname, 'filter': {'min': minspeed, 'max': maxspeed}})
- async for resp in service.listener(): # discard events in the queue until it flushes out and we get unsub confirm
+ # wait until the event queue flushes out and we get unsubscribe confirmation
+ async for resp in service.listener():
if resp.type == AFBT.EVENT: continue
if resp.msgid != msgid: continue
assert resp.status == 'success', f'Could not unsubscribe from {eventname}; info: {resp.info}'
break
-@pytest.mark.parametrize('canplayer', ['test2-3.canreplay'], indirect=True)
-async def test_Filter_Test_01_Step_3(event_loop, service: cs, canplayer):
+@pytest.mark.parametrize('prepare_replay_file', ['test2-3.canreplay'], indirect=True)
+async def test_Filter_Test_01_Step_3(event_loop, service: cs, prepare_replay_file):
# this testcase is supposed to test event filter frequency
minspeed = 30
maxspeed = 100
@@ -320,9 +398,21 @@ async def test_Filter_Test_01_Step_3(event_loop, service: cs, canplayer):
assert resp.status == 'success', f'Could not subscribe for {eventname} events; info: {resp.info}'
resplist = []
- for i in range(2):
- resplist.append(await service.afbresponse())
-
+ async def listen(service: cs):
+ async for resp in service.listener():
+ logging.debug(f"{resp.data['name']} = {resp.data['value']} ({resp.data['timestamp']})")
+ resplist.append(resp)
+ if len(resplist) == 2:
+ break
+
+ listener = asyncio.create_task(listen(service))
+ player = canplayer(service)
+ assert player is not None
+ await player.play('test2-3.canreplay')
+ await listener
+ await player.stop()
+
+ assert len(resplist) == 2
for r in resplist:
assert 'name' in r.data
assert r.data['name'] == eventname
@@ -334,7 +424,8 @@ async def test_Filter_Test_01_Step_3(event_loop, service: cs, canplayer):
assert 1000000 - tolerance < delta < 1000000 + tolerance
msgid = await service.unsubscribe({'event': eventname, 'filter': {'frequency': 1, 'min': minspeed, 'max': maxspeed}})
- async for resp in service.listener(): # discard events in the queue until it flushes out and we get unsub confirm
+ # wait until the event queue flushes out and we get unsubscribe confirmation
+ async for resp in service.listener():
if resp.type == AFBT.EVENT: continue
if resp.msgid != msgid: continue
assert resp.status == 'success', f'Could not unsubscribe from {eventname}; info: {resp.info}'
@@ -348,7 +439,7 @@ async def test_Filter_Test_01_Step_3(event_loop, service: cs, canplayer):
# Un/Subscription tests
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
+@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_event(event_loop, service: cs):
msgid = await service.subscribe('Eng.Momentary.Overspeed.Enable')
resp = await service.afbresponse()
@@ -356,7 +447,6 @@ async def test_low_can_subscribe_j1939_event(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_unsubscribe_j1939_event(event_loop, service: cs):
msgid = await service.unsubscribe('Eng.Momentary.Overspeed.Enable')
@@ -365,7 +455,6 @@ async def test_low_can_unsubscribe_j1939_event(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_events(event_loop, service: cs):
msgid = await service.subscribe('Eng.*')
@@ -374,7 +463,6 @@ async def test_low_can_subscribe_j1939_events(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_unsubscribe_j1939_events(event_loop, service: cs):
msgid = await service.unsubscribe('Eng.*')
@@ -383,7 +471,6 @@ async def test_low_can_unsubscribe_j1939_events(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_pgn(event_loop, service: cs):
msgid = await service.subscribe({'pgn': 61442})
@@ -392,7 +479,6 @@ async def test_low_can_subscribe_j1939_pgn(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_unsubscribe_j1939_pgn(event_loop, service: cs):
msgid = await service.unsubscribe({'pgn': 61442})
@@ -401,7 +487,6 @@ async def test_low_can_unsubscribe_j1939_pgn(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_all_pgn(event_loop, service: cs):
msgid = await service.subscribe({'pgn': '*'})
@@ -410,7 +495,6 @@ async def test_low_can_subscribe_j1939_all_pgn(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_unsubscribe_j1939_all_pgn(event_loop, service: cs):
msgid = await service.unsubscribe({'pgn': '*'})
@@ -419,7 +503,6 @@ async def test_low_can_unsubscribe_j1939_all_pgn(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_id(event_loop, service: cs):
msgid = await service.subscribe({'id': 61442})
@@ -428,7 +511,6 @@ async def test_low_can_subscribe_j1939_id(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_unsubscribe_j1939_id(event_loop, service: cs):
msgid = await service.unsubscribe({'id': 61442})
@@ -437,7 +519,6 @@ async def test_low_can_unsubscribe_j1939_id(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_all_id(event_loop, service: cs):
msgid = await service.subscribe({'id': '*'})
@@ -446,7 +527,6 @@ async def test_low_can_subscribe_j1939_all_id(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_unsubscribe_j1939_all_id(event_loop, service: cs):
msgid = await service.unsubscribe({'id': '*'})
@@ -455,7 +535,6 @@ async def test_low_can_unsubscribe_j1939_all_id(event_loop, service: cs):
assert resp.status == 'success', resp.info
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_no_event(event_loop, service: cs):
msgid = await service.subscribe({'event': ''})
@@ -463,7 +542,6 @@ async def test_low_can_subscribe_j1939_no_event(event_loop, service: cs):
assert resp.type == AFBT.ERROR, f'Expected ERROR type messsage, got {resp.type}'
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_no_id(event_loop, service: cs):
msgid = await service.subscribe({'id': ''})
@@ -471,7 +549,6 @@ async def test_low_can_subscribe_j1939_no_id(event_loop, service: cs):
assert resp.type == AFBT.ERROR, f'Expected ERROR type messsage, got {resp.type}'
-@pytest.mark.xfail(reason="J1939 support may not be available in the kernel")
@pytest.mark.can_j1939
async def test_low_can_subscribe_j1939_no_pgn(event_loop, service: cs):
msgid = await service.subscribe({'pgn': ''})
@@ -482,7 +559,9 @@ async def test_low_can_subscribe_j1939_no_pgn(event_loop, service: cs):
# Write tests
-async def test_low_can_write_wo_auth(event_loop, service: cs):
+@pytest.mark.can_j1939
+@pytest.mark.dependency(depends=['test_auth'])
+async def test_low_can_write_j1939_wo_auth(event_loop, service: cs):
msgid = await service.write({'signal_name': 'Eng.Momentary.Overspeed.Enable', 'signal_value': 1})
async for resp in service.listener(): # using a listener because sometimes there are events in the queue from
# previous tests or subscriptions even they are properly unsubscribed and awaited for confirmation
@@ -493,14 +572,9 @@ async def test_low_can_write_wo_auth(event_loop, service: cs):
assert resp.msgid == msgid
break
-async def test_low_can_write_auth(event_loop, service: cs):
- msgid = await service.auth()
- resp = await service.afbresponse()
- assert resp.status == 'success', resp
-
-@pytest.mark.xfail(reason='J1939 write messages are failing')
-async def test_low_can_write_signal(event_loop, service: cs):
+@pytest.mark.can_j1939
+async def test_low_can_write_j1939_signal(event_loop, service: cs):
msgid = await service.write({'signal_name': 'Eng.Momentary.Overspeed.Enable', 'signal_value': 1})
resp = await service.afbresponse()
assert resp.type == AFBT.ERROR, resp