Skip to content

Commit 5b2a3b9

Browse files
committed
[cherry-pick update] testing: add tests targeting JTAG scan commands
This is an update of a cherry-picked commit c43b2a2 ("[cherry-pick] testing: add tests targeting JTAG scan commands"). Link: https://review.openocd.org/c/openocd/+/8507/15 The tests can be run via `make check` when JTAG `dummy` adapter is enabled. Change-Id: I6097460b7991d831d7b12b5037b331ba6addeeb4 Signed-off-by: Evgeniy Naydanov <[email protected]>
1 parent f7e2a0c commit 5b2a3b9

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ DIST_SUBDIRS += testing
3434
SUBDIRS += tools/syntacore
3535
DIST_SUBDIRS += tools/syntacore
3636

37+
SUBDIRS += testing
38+
DIST_SUBDIRS += testing
39+
3740
# common flags used in openocd build
3841
AM_CFLAGS = $(GCC_WARNINGS)
3942
AM_LDFLAGS =

testing/tcl_commands/test-drscan-command.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace import jtag_dummy_testing::*
55

66
set ntaps 1
77
setup $ntaps
8+
init
89

910
set tap [lindex [jtag names] 0]
1011

testing/tcl_commands/test-irscan-command.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace import jtag_dummy_testing::*
55

66
set ntaps 1
77
setup $ntaps
8+
init
89

910
set tap [lindex [jtag names] 0]
1011

testing/tcl_commands/test-jtag-execute-command.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ namespace import testing_helpers::*
44
namespace import jtag_dummy_testing::*
55

66
set ntaps 2
7-
setup $ntaps
87

8+
setup $ntaps
99
set tap [lindex [jtag names] 0]
1010
set second_tap [lindex [jtag names] 1]
1111

12+
check_generic_error {jtag execute scan $tap -ir 0}
13+
14+
init
15+
1216
set escaped_tap [string map {. {\.}} $tap]
1317

1418
jtag execute scan $tap

testing/tcl_commands/utils.tcl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ namespace eval testing_helpers {
2626
}
2727
}
2828

29+
proc check_generic_error script {
30+
tailcall check_for_error 1 {} $script
31+
}
32+
2933
proc check_invalid_arg script {
3034
tailcall check_for_error -603 {} $script
3135
}
@@ -50,8 +54,8 @@ namespace eval testing_helpers {
5054
Was expecting '$pattern'."
5155
}
5256

53-
namespace export check_invalid_arg check_syntax_err check_overflow_err \
54-
check_underflow_err check_matches
57+
namespace export check_generic_error check_invalid_arg check_syntax_err \
58+
check_overflow_err check_underflow_err check_matches
5559
}
5660

5761
namespace eval jtag_dummy_testing {
@@ -67,7 +71,6 @@ namespace eval jtag_dummy_testing {
6771
for {set i 0} {$i < $ntaps} {incr i} {
6872
jtag newtap "tap$i" tap -irlen 1
6973
}
70-
init
7174
dummy update_context
7275
dummy_set_default_handlers
7376

0 commit comments

Comments
 (0)