forked from auracaster/openocd
testing/tcl_commands: test target create, cget, configure
Introduce basic testing of error-handling in target configuration related commands. The tests can be run via `make check` when JTAG `dummy` adapter is enabled. Change-Id: Id0f382046dd70007d8e696d82d2396a7ccab7a33 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8644 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
f42540cc90
commit
1b2a2b8185
54
testing/tcl_commands/test-target-create-command.cfg
Normal file
54
testing/tcl_commands/test-target-create-command.cfg
Normal file
@@ -0,0 +1,54 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
namespace import testing_helpers::*
|
||||
namespace import configure_testing::*
|
||||
|
||||
adapter driver dummy
|
||||
jtag newtap tap cpu -irlen 5
|
||||
|
||||
check_syntax_err {target create}
|
||||
check_syntax_err {target create}
|
||||
check_syntax_err {target create test.target}
|
||||
check_error_matches -chain-position {target create test.target testee}
|
||||
|
||||
{*}[target_create_first_args] {*}[simple_configure_options]
|
||||
|
||||
foreach {opt arg} [simple_configure_options] {
|
||||
check_error_matches ".*${opt}.*" {{*}[target_create_first_args] $opt}
|
||||
}
|
||||
|
||||
foreach {opt1 arg1} [simple_configure_options] {
|
||||
foreach {opt2 arg2} [simple_configure_options] {
|
||||
check_error_matches ".*${opt2}.*" \
|
||||
{{*}[target_create_first_args] $opt1 $arg1 $opt2}
|
||||
check_error_matches {} \
|
||||
{{*}[target_create_first_args] $opt1 $opt2 $arg2}
|
||||
}
|
||||
}
|
||||
|
||||
check_error_matches ".*-type.*" \
|
||||
{{*}[target_create_first_args] -type}
|
||||
|
||||
check_error_matches ".*-type.*" \
|
||||
{{*}[target_create_first_args] {*}[simple_configure_options] -type}
|
||||
|
||||
check_error_matches {.*-event [^ ]+ .*} \
|
||||
{{*}[target_create_first_args] -event}
|
||||
|
||||
check_error_matches {.*not-an-event.*} \
|
||||
{{*}[target_create_first_args] -event not-an-event}
|
||||
|
||||
check_error_matches {.*-event examine-start [^ ]+.*} \
|
||||
{{*}[target_create_first_args] -event examine-start}
|
||||
|
||||
{*}[target_create_first_args] {*}[simple_configure_options] \
|
||||
-event examine-start body
|
||||
{*}[target_create_first_args] {*}[simple_configure_options] \
|
||||
-event examine-start body \
|
||||
-event examine-end another-body \
|
||||
-event examine-start new-body
|
||||
{*}[target_create_first_args] -event examine-start body {*}[simple_configure_options]
|
||||
|
||||
{*}[target_create_first_args] {*}[simple_configure_options] -defer-examine
|
||||
|
||||
shutdown
|
||||
Reference in New Issue
Block a user