[m-rev.] for review: make the test suite work with MSYS2

Peter Wang novalazy at gmail.com
Tue Jun 13 15:21:47 AEST 2023


On Mon, 12 Jun 2023 03:38:34 +1000 Julien Fischer <jfischer at opturion.com> wrote:
> 
> For review by anyone.
> ---------------------
> 
> Make the test suite work with MSYS2.
> 
> tools/bootcheck:
>      On MSYS2, translate paths written to .options and _FLAGS files into
>      Windows-style paths.
> 
>      On MYS2, pass --strip-trailing-cr to diff.
> 
> Julien.
> 

> @@ -2014,6 +2044,10 @@ if test -s "${HOME}"/.bootcheck_diff_opts
>   then
>       DIFF_OPTS=$(cat "${HOME}"/.bootcheck_diff_opts)
>       export DIFF_OPTS
> +elif "$env_is_msys2"
> +then
> +    DIFF_OPTS=--strip-trailing-cr
> +    export DIFF_OPTS
>   fi

Perhaps DIFF_OPTS="${DIFF_OPTS:-} -u --strip-trailing-cr".

> @@ -2061,13 +2095,27 @@ then
> 
>           cp "${root}"/doc/mdb_command_test.inp tests/debugger
> 
> -        ${SED} -e "s:@WORKSPACE@:${WORKSPACE}:" \
> -            < tests/WS_FLAGS.ws \
> -            > tests/WS_FLAGS
> +        if "$env_is_msys2"
> +        then
> +            # XXX Parameter expansion with pattern substitutions is a bash-ism
> +            # that is not supported by POSIX sh. (It shouldn't matter here as
> +            # bash is the default shell used by MSYS2 anyway.)
> +            ${SED} -e "s:@WORKSPACE@:${WORKSPACE/:/\\:}:" \
> +                < tests/WS_FLAGS.ws \
> +                > tests/WS_FLAGS

Is that escaping the colon in a drive letter? Why is it necessary?

I suggest using a different delimiter for the s command, e.g. comma.

Peter


More information about the reviews mailing list