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
31
testing/tcl_commands/test-target-configure-cget-command.cfg
Normal file
31
testing/tcl_commands/test-target-configure-cget-command.cfg
Normal file
@@ -0,0 +1,31 @@
|
||||
# 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
|
||||
|
||||
{*}[target_create_first_args] {*}[simple_configure_options]
|
||||
|
||||
set target_name [lindex [target names] 0]
|
||||
|
||||
check_matches testee {$target_name cget -type}
|
||||
|
||||
foreach {opt arg} [simple_configure_options] {
|
||||
check_syntax_err {$target_name cget $opt extra_arg}
|
||||
check_matches [dict get [simple_configure_options] $opt] \
|
||||
{$target_name cget $opt}
|
||||
}
|
||||
|
||||
check_error_matches .*-event.* {$target_name cget -event}
|
||||
$target_name cget -event examine-start
|
||||
check_syntax_err {$target_name cget -event examine-start extra_arg}
|
||||
|
||||
check_syntax_err {$target_name configure}
|
||||
|
||||
foreach {opt arg} [simple_configure_options] {
|
||||
$target_name configure $opt [$target_name cget $opt]
|
||||
}
|
||||
|
||||
shutdown
|
||||
Reference in New Issue
Block a user