Skip to content

Instantly share code, notes, and snippets.

@triffid
Created February 7, 2014 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triffid/8855704 to your computer and use it in GitHub Desktop.
Save triffid/8855704 to your computer and use it in GitHub Desktop.
aprinter test_latency fix
diff --git a/host_stuff/test_latency.py b/host_stuff/test_latency.py
index d1c3645..55e8054 100755
--- a/host_stuff/test_latency.py
+++ b/host_stuff/test_latency.py
@@ -4,6 +4,7 @@ from __future__ import print_function
import sys
import argparse
import time
+import re
import littlevent.close
import littlevent.error
import littlevent.loop
@@ -52,13 +53,14 @@ class Program (littlevent.close.Obj):
if self.writing:
print('ERROR: early response')
return self._quit()
- if data != 'ok\n':
- print('ERROR: unexpected response: >{}<'.format(data))
- return self._quit()
- self.done_count += 1
- if self.done_count >= self.want_count:
- return self._finished()
- self._write()
+ if re.search('^ok', data, re.M):
+ self.done_count += 1
+ if self.done_count >= self.want_count:
+ return self._finished()
+ self._write()
+ return
+ print('WARN: unexpected response: >{}<'.format(data))
+ return
def _write_handler (self, err):
assert self.writing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment