File tree Expand file tree Collapse file tree 4 files changed +51
-18
lines changed
workspace_tools/host_tests Expand file tree Collapse file tree 4 files changed +51
-18
lines changed Original file line number Diff line number Diff line change 2
2
#include " test_env.h"
3
3
4
4
int main () {
5
+ Serial *pc = new Serial (USBTX, USBRX);
6
+
5
7
MBED_HOSTTEST_TIMEOUT (20 );
6
8
MBED_HOSTTEST_SELECT (serial_nc_rx_auto);
7
9
MBED_HOSTTEST_DESCRIPTION (Serial NC RX);
8
10
MBED_HOSTTEST_START (" MBED_37" );
9
11
10
- Serial *pc = new Serial (NC, USBRX);
11
-
12
12
char c = pc->getc ();
13
13
14
- delete pc;
15
-
16
- // This should be true
17
- if (c == ' E' ) {
18
- Serial *pc = new Serial (USBTX, NC);
19
-
20
- pc->printf (" RX OK - Expected\r\n " );
21
-
22
- c = pc->getc ();
23
-
24
- // This should be false/not get here
25
- if (c == ' U' ) {
26
- pc->printf (" RX OK - Unexpected\r\n " );
27
- }
28
14
29
- delete pc;
15
+ // This should be true, sync the start of test
16
+ if (c == ' S' ) {
17
+ pc->printf (" RX OK - Start NC test\r\n " );
18
+
19
+ // disconnect TX and get char
20
+ delete pc;
21
+ pc = new Serial (NC, USBRX);
22
+ c = pc->getc ();
23
+ if (c == ' E' ) {
24
+ // ok disconnect Rx and answer to host
25
+ delete pc;
26
+ pc = new Serial (USBTX, NC);
27
+ pc->printf (" RX OK - Expected\r\n " );
28
+
29
+ c = pc->getc ();
30
+ // This should be false/not get here
31
+ if (c == ' U' ) {
32
+ pc->printf (" RX OK - Unexpected\r\n " );
33
+ }
34
+ }
35
+ delete pc;
30
36
}
31
37
32
38
while (1 ) {
Original file line number Diff line number Diff line change 2
2
#include " test_env.h"
3
3
4
4
int main () {
5
+ Serial *pc = new Serial (USBTX, USBRX);
6
+
5
7
MBED_HOSTTEST_TIMEOUT (20 );
6
8
MBED_HOSTTEST_SELECT (serial_nc_tx_auto);
7
9
MBED_HOSTTEST_DESCRIPTION (Serial NC TX);
8
10
MBED_HOSTTEST_START (" MBED_38" );
9
11
10
12
// Wait until we receive start signal from host test
11
- Serial *pc = new Serial (USBTX, USBRX);
12
13
char c = pc->getc ();
13
14
delete pc;
14
15
Original file line number Diff line number Diff line change @@ -25,6 +25,29 @@ class SerialNCRXTest():
25
25
26
26
def test (self , selftest ):
27
27
selftest .mbed .flush ();
28
+ # Wait 0.5 seconds to ensure mbed is listening
29
+ time .sleep (0.5 )
30
+
31
+ #handshake with target to sync test start
32
+ selftest .mbed .serial_write ("S" );
33
+
34
+ strip_chars = string .whitespace + "\0 "
35
+
36
+ out_str = selftest .mbed .serial_readline ()
37
+
38
+ if not out_str :
39
+ selftest .notify ("HOST: No output detected" )
40
+ return selftest .RESULT_IO_SERIAL
41
+
42
+ out_str_stripped = out_str .strip (strip_chars )
43
+
44
+ if out_str_stripped != "RX OK - Start NC test" :
45
+ selftest .notify ("HOST: Unexpected output. Expected 'RX OK - Expected' but received '%s'" % out_str_stripped )
46
+ return selftest .RESULT_FAILURE
47
+
48
+ # Wait 0.5 seconds to ensure mbed is listening
49
+ time .sleep (0.5 )
50
+
28
51
selftest .mbed .serial_write ("E" );
29
52
30
53
strip_chars = string .whitespace + "\0 "
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class SerialNCTXTest():
25
25
26
26
def test (self , selftest ):
27
27
selftest .mbed .flush ();
28
+ # Wait 0.5 seconds to ensure mbed is listening
29
+ time .sleep (0.5 )
30
+
28
31
selftest .mbed .serial_write ("S" );
29
32
30
33
strip_chars = string .whitespace + "\0 "
You can’t perform that action at this time.
0 commit comments