From: Masatake YAMATO Date: Fri, 9 Jan 2026 03:44:00 +0000 (+0900) Subject: tests: (refactor) add ts_skip_config, a new helper function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e18b7a5edc784ad5e69b33d767fe8ec4867e237;p=thirdparty%2Futil-linux.git tests: (refactor) add ts_skip_config, a new helper function Signed-off-by: Masatake YAMATO --- diff --git a/tests/functions.sh b/tests/functions.sh index 4e1636927..4a00463a8 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -1164,15 +1164,6 @@ function ts_init_socket_to_file { fi } -function ts_has_ncurses_support { - grep -q '#define HAVE_LIBNCURSES' ${top_builddir}/config.h - if [ $? == 0 ]; then - echo "yes" - else - echo "no" - fi -} - # Get path to the ASan runtime DSO the given binary was compiled with function ts_get_asan_rt_path { local binary="${1?}" @@ -1232,6 +1223,15 @@ function ts_check_ipv6 { fi } +# ts_skip_config CONFIG SKIP_DESC +function ts_skip_config { + grep -q "#define $1" ${top_builddir}/config.h || ts_skip "$2" +} + +function ts_skip_ncurses { + ts_skip_config HAVE_LIBNCURSES "without-ncurses" +} + function ts_skip_netns { - grep -q '#define HAVE_LINUX_NET_NAMESPACE_H' ${top_builddir}/config.h || ts_skip "no netns support" + ts_skip_config HAVE_LINUX_NET_NAMESPACE_H "no netns support" } diff --git a/tests/ts/cal/color b/tests/ts/cal/color index 2dffefed3..359f6a8f4 100755 --- a/tests/ts/cal/color +++ b/tests/ts/cal/color @@ -23,10 +23,7 @@ ts_init "$*" ts_check_test_command "$TS_CMD_CAL" ts_inhibit_custom_colorscheme -has_ncurses=$( ts_has_ncurses_support ) -if [ "$has_ncurses" != "yes" ]; then - ts_skip "without-ncurses" -fi +ts_skip_ncurses # --color output depends on terminal type export TERM=linux diff --git a/tests/ts/cal/colorw b/tests/ts/cal/colorw index 541e2f445..96da748c6 100755 --- a/tests/ts/cal/colorw +++ b/tests/ts/cal/colorw @@ -23,10 +23,7 @@ ts_init "$*" ts_check_test_command "$TS_CMD_CAL" ts_inhibit_custom_colorscheme -has_ncurses=$( ts_has_ncurses_support ) -if [ "$has_ncurses" != "yes" ]; then - ts_skip "without-ncurses" -fi +ts_skip_ncurses # --color output depends on terminal type export TERM=linux diff --git a/tests/ts/cal/weekarg b/tests/ts/cal/weekarg index 477cbd5df..006b03d69 100755 --- a/tests/ts/cal/weekarg +++ b/tests/ts/cal/weekarg @@ -24,10 +24,7 @@ ts_init "$*" ts_check_test_command "$TS_CMD_CAL" ts_inhibit_custom_colorscheme -has_ncurses=$( ts_has_ncurses_support ) -if [ "$has_ncurses" != "yes" ]; then - ts_skip "without-ncurses" -fi +ts_skip_ncurses export TERM=linux