diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 04:23:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 04:23:18 +0000 |
commit | b90161ccd3b318f3314a23cb10c387651ad35831 (patch) | |
tree | a47dc087160299ce02d728cbf031d84af6281537 /tests/yanglint/CMakeLists.txt | |
parent | Adding upstream version 2.1.30. (diff) | |
download | libyang2-upstream.tar.xz libyang2-upstream.zip |
Adding upstream version 2.1.148.upstream/2.1.148upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/yanglint/CMakeLists.txt')
-rw-r--r-- | tests/yanglint/CMakeLists.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/yanglint/CMakeLists.txt b/tests/yanglint/CMakeLists.txt new file mode 100644 index 0000000..c1e081a --- /dev/null +++ b/tests/yanglint/CMakeLists.txt @@ -0,0 +1,36 @@ +if(WIN32) + set(YANGLINT_INTERACTIVE OFF) +else() + set(YANGLINT_INTERACTIVE ON) +endif() + +function(add_yanglint_test) + cmake_parse_arguments(ADDTEST "" "NAME;VIA;SCRIPT" "" ${ARGN}) + set(TEST_NAME yanglint_${ADDTEST_NAME}) + + if(${ADDTEST_VIA} STREQUAL "tclsh") + set(WRAPPER ${PATH_TCLSH}) + else() + message(FATAL_ERROR "build: unexpected wrapper '${ADDTEST_VIA}'") + endif() + + add_test(NAME ${TEST_NAME} COMMAND ${WRAPPER} ${CMAKE_CURRENT_SOURCE_DIR}/${ADDTEST_SCRIPT}) + set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT "TESTS_DIR=${CMAKE_CURRENT_SOURCE_DIR}") + set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT "YANG_MODULES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/modules") + set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT "YANGLINT=${PROJECT_BINARY_DIR}") +endfunction(add_yanglint_test) + +if(ENABLE_TESTS) + # tests of interactive mode using tclsh + find_program(PATH_TCLSH NAMES tclsh) + if(NOT PATH_TCLSH) + message(WARNING "'tclsh' not found! The yanglint(1) interactive tests will not be available.") + else() + if(YANGLINT_INTERACTIVE) + add_yanglint_test(NAME interactive VIA tclsh SCRIPT interactive/all.tcl) + add_yanglint_test(NAME non-interactive VIA tclsh SCRIPT non-interactive/all.tcl) + else() + add_yanglint_test(NAME non-interactive VIA tclsh SCRIPT non-interactive/all.tcl) + endif() + endif() +endif() |