Testing yanglint is divided into two ways. It is either tested in interactive mode using the tcl command 'expect' or non-interactively, classically from the command line. For both modes, unit testing was used using the tcl package tcltest.
The sample commands in this chapter using tclsh
are called in the interactive
or non-interactive
directories.
In the build directory designated for cmake, enter:
ctest -R yanglint
In the interactive directory, run:
tclsh all.tcl
In the non-interactive directory, run:
tclsh all.tcl
tclsh clear.test
or alternatively:
tclsh all.tcl -file clear.test
tclsh clear.test -match clear_ietf_yang_library
or alternatively:
tclsh all.tcl -file clear.test -match clear_ietf_yang_library
Test names are assumed to consist of the command name:
tclsh all.tcl -match clear*
In the interactive directory, run:
tclsh clear.test -match clear_ietf_yang_library -load "exp_internal 1"
In the interactive directory, run:
tclsh clear.test -match clear_ietf_yang_library -load "log_user 1"
Probably only possible to do via -verbose ""
You can write commands interact
and interpreter
from 'Expect' package into some test. However, the most useful are the exp_internal
and log_user
, which can also be written directly into the test. See also the rlwrap tool. You can also use other debugging methods used in tcl programming.
Sort of...
Add it to the ly.tcl file. If you need to call other subfunctions in it, add them to namespace ly::private.
Look in the common.tcl file in the "uti" namespace, which contains general tcl functions that can be used in both interactive and non-interactive tests.