# This file is sourced by init.sh, *before* its initialization. # This goes hand in hand with the "9>&2;" in tests/Makefile.am's # TESTS_ENVIRONMENT definition. stderr_fileno_=9 # Map settings of "none" to the empty string. test _"$LOCALE_FR" = _none && LOCALE_FR= test _"$LOCALE_FR_UTF8" = _none && LOCALE_FR_UTF8= # Unset key environment variables. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Derive this list by searching for string literals as the first # argument to getenv: # git grep getenv|perl -nle '/\bgetenv *\("(.+?)"\)/ and print $1'|sort -u grep vars_=' GREP_COLOR GREP_COLORS GREP_OPTIONS TERM ' envvar_check_fail=0 for v_ in $vars_ do $as_unset $v_ if eval test \"\${$v_+set}\" = set; then echo "$0: the $v_ environment variable is set --" \ ' unset it and rerun this test' >&2 envvar_check_fail=1 fi done test "$envvar_check_fail" = 1 && fail_ "failed to unset the above envvars" require_timeout_() { ( timeout 10s true ) > /dev/null 2>&1 \ || skip_ your system lacks the timeout program timeout 10s false; test $? = 1 \ || skip_ your system has a non-GNU timeout program } require_pcre_() { echo . | grep -P . 2>err || skip_ no PCRE support compare /dev/null err || fail_ PCRE available, but stderr not empty. } # Some tests would fail without this particular locale. # If the locale is not available, just skip the test. require_en_utf8_locale_() { path_prepend_ . case $(get-mb-cur-max en_US.UTF-8) in [3456]) ;; *) skip_ 'en_US.UTF-8 locale not found' ;; esac } require_tr_utf8_locale_() { path_prepend_ . case $(get-mb-cur-max tr_TR.UTF-8) in [3456]) ;; *) skip_ 'tr_TR.UTF-8 locale not found' ;; esac } require_ru_RU_koi8_r() { path_prepend_ . case $(get-mb-cur-max ru_RU.KOI8-R) in 1) ;; *) skip_ 'ru_RU.KOI8-R locale not found' ;; esac } require_compiled_in_MB_support() { require_en_utf8_locale_ printf 'é' | LC_ALL=en_US.UTF-8 grep '[[:lower:]]' \ || skip_ this test requires MBS support } expensive_() { if test "$RUN_EXPENSIVE_TESTS" != yes; then skip_ 'expensive: disabled by default This test is relatively expensive, so it is disabled by default. To run it anyway, rerun make check with the RUN_EXPENSIVE_TESTS environment variable set to yes. E.g., env RUN_EXPENSIVE_TESTS=yes make check or use the shortcut target of the toplevel Makefile, make check-expensive ' fi }