diff options
author | Roman Potashow <justgook@gmail.com> | 2016-07-28 16:31:14 +0300 |
---|---|---|
committer | Roman Potashow <justgook@gmail.com> | 2016-07-28 16:31:14 +0300 |
commit | b4730f84c950e6e0a6b9c8692bf0ed33bcc28028 (patch) | |
tree | 6403b96931f33b2382390ee4dc79d2869e371428 /Documentation | |
parent | 043946f58e17c650eab0ca56b5fc1086c74a2ae7 (diff) | |
download | akka-serial-b4730f84c950e6e0a6b9c8692bf0ed33bcc28028.tar.gz akka-serial-b4730f84c950e6e0a6b9c8692bf0ed33bcc28028.tar.bz2 akka-serial-b4730f84c950e6e0a6b9c8692bf0ed33bcc28028.zip |
Add testing Documentation
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/testing.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Documentation/testing.md b/Documentation/testing.md new file mode 100644 index 0000000..8b13086 --- /dev/null +++ b/Documentation/testing.md @@ -0,0 +1,40 @@ +#Testing + +`flow-samples` directory contains fully functional application examples of flow. To run an example, change to the base directory of flow and run sbt samples<SampleName>/run. +All projects, including samples, can be listed by running sbt projects. + +To be able connect You can use real device (arduino) burned with sample-echo (`dev/arduino-terminal`) code, or create Virtual Serial Port pair + +[socat (SOcket CAT)](http://www.dest-unreach.org/socat/) – multipurpose relay – is a command line based utility that establishes two bidirectional byte streams and transfers data between them. +socat is #4 on the Top 100 Network Security Tools list, available in most distro repositories (on Debian/Ubuntu sudo apt-get install socat does the trick), really light on resources, and very efficient. + +To create a pair of VSP’s +```socat -d -d pty,raw,echo=0 pty,raw,echo=0``` + +you will get something like +``` +socat[5894] N PTY is /dev/ttys002 +socat[5894] N PTY is /dev/ttys003 +socat[5894] N starting data transfer loop with FDs [5,5] and [7,7] +``` +and that’s it! As long as the socat is running, you have a pair of VSP’s open (their names are printed by socat on initialization). See [socat man page](http://www.dest-unreach.org/socat/doc/socat.html) for more details on what the above command does. +Now You can connect to first socket ( in this case `/dev/ttys002`) using some sample (or Your code), and use second for monitoring or/and sending messages +To send - use command +``` +echo 'Hello World' > /dev/ttys003 +``` +To listen - use command +``` +cat < /dev/ttys003 +``` + +Connecting executable and VSP +``` +socat -d -d pty,raw,echo=0 "exec:myprog ...,pty,raw,echo=0" +``` +where the executable `myprog` will be connected with the VSP through stdio. + +For example Echo-server would look like +``` +socat -d -d pty,raw,echo=0 "exec:/bin/cat,pty,raw,echo=0" +```
\ No newline at end of file |