[Cryptech Tech] More tests and a bug

Joachim Strömbergson joachim at secworks.se
Wed Apr 2 16:44:21 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Aloha!

Rob Austein wrote:
> Python has a unit test framework, and there is a pyexpect package if 
> it comes to that; don't know how hard it would be to integrate the 
> latter into the former.

I like the Python unit test framework.

The problem I have right now is not related to the question of doing
unit tests or not. But how to handle async read and write and still be
able to catch the specific response to a command and parse the response
to have something to do unit test assertion on.

hash_tester currently have a response thread that handles read
operations and parsing from the serial interface. The main thread
creates the reader thread and then sends commands to coretest in the
FPGA via the serial interface. In order to be able to do unit testing I
need the reader process to be able to match responses with commands. And
still not end up synchronize the communication.

The idea I have right now is to create a third thread that are connected
to the main thread and the reader thread with two Python queues. This
thread is responsible for doing the specific matching.

We now that the order of commands and responses are strictly ordered so
there are no real issue with doing a wrong match related to the same
address.

The reader could do the matching as well as the reading. But it looks
like a good separation of duty having a separate thread and it allows
the reader thread to be more responsive. Esp when we start increase the
bitrate. The long message tests I'm doing now (with 10000 block
messages) takes LONG time over 9600 kbps.

- -- 
Med vänlig hälsning, Yours

Joachim Strömbergson - Alltid i harmonisk svängning.
========================================================================
 Joachim Strömbergson          Secworks AB          joachim at secworks.se
========================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJTPD5lAAoJEF3cfFQkIuyNrn8P/RDpkTd1X2huII7rXJA7S389
Lih3QGUVz2n6C/aWKgR7zOM4Cnp+1rjp5Lyuq++9h3gpAVlocTRg44H7t75/uSPl
cmAz4aGhp1YPovWtEZzxmbKAHBxIf6skpbnFO+6uH+tRVSUvUBFfRylKV4kZUnY3
xZzZD7z68qJ6/xveFg8XONeBSr6TSLMjDwp2q3CZtiB4Vg2wBzJVBOoMVE9Kclor
fyV1cpZKaNln8qeQ348eGXqq6LfZu2w9VMo8YkRQZm5JleRf0yHG8Gsrz+/K2axk
y/os1mGUz6YVf71jvGMLQKAtKszxDTMmtrVREUD5nUWxndUdIa3nc9gXMO4I1ys7
6IuJM+4f2HjzAhkaz9s4R2Y3pZ6uWrjNWPFA7oIBrL7SpY2/5a4D6ZzuEyDz3vte
A6hJCiS2xKEmuJW5WggxcPkq8KnoIHsbegN6w0bmz6I2vOwytas89YPmydWU9gR1
elMDBLWrS6JL4P5RtLv0NPI/y22FsPPTL5MnO9TTY9vuhcJX20b9WjEBwgPn0bKe
w6AOrkpmn21LTV4efo9XqHJRqKOY83x5GbP4FrppzjMEMRtgpjpmmnqNyZcbeEqf
fGvErVeMCOULeSIYNsmcae6Q3MUqBRFb+O6ET4g78FaQN47Q4ErkPSLG8si0qcHv
Ct8sTEGtLwLlt8uNRFhn
=Uzwn
-----END PGP SIGNATURE-----



More information about the Tech mailing list