mirror of
https://git.code.sf.net/p/openocd/code
synced 2025-05-10 01:15:12 +00:00
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>
55 lines
1.7 KiB
INI
55 lines
1.7 KiB
INI
# 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
|