diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-06-03 16:43:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-06-18 15:17:29 +0300 |
commit | b0e481a653b01e4329bccb1d101d56e3e878e960 (patch) | |
tree | bba1a4cae73ec4ece95f408e079a15d664e49927 /tests/variable | |
parent | 0d692ec857340a0f16a03d6a7ef38fe864a83cfc (diff) |
Port to MinGW
Diffstat (limited to 'tests/variable')
-rwxr-xr-x | tests/variable/expansion/test.sh | 2 | ||||
-rwxr-xr-x | tests/variable/null/test.sh | 2 | ||||
-rwxr-xr-x | tests/variable/override/test.sh | 30 | ||||
-rwxr-xr-x | tests/variable/prepend/test.sh | 2 | ||||
-rwxr-xr-x | tests/variable/qualified/test.sh | 2 | ||||
-rwxr-xr-x | tests/variable/type/test.sh | 2 |
6 files changed, 31 insertions, 9 deletions
diff --git a/tests/variable/expansion/test.sh b/tests/variable/expansion/test.sh index afcb3bd..c745b76 100755 --- a/tests/variable/expansion/test.sh +++ b/tests/variable/expansion/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -b -q | diff -u test.out - +b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/null/test.sh b/tests/variable/null/test.sh index afcb3bd..c745b76 100755 --- a/tests/variable/null/test.sh +++ b/tests/variable/null/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -b -q | diff -u test.out - +b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/override/test.sh b/tests/variable/override/test.sh index 63a792f..e960929 100755 --- a/tests/variable/override/test.sh +++ b/tests/variable/override/test.sh @@ -2,6 +2,25 @@ verbose=n +# By default when MSYS2 executable (bash.exe in particular) runs another +# executable it converts arguments that look like POSIX paths to Windows +# representations. More about it at: +# +# http://www.mingw.org/wiki/Posix_path_conversion +# +# So when you run b /v=X, build2 gets 'C:/msys64/v=X' argument instead of +# '/v=X'. To disable this behavior set MSYS2_ARG_CONV_EXCL environment +# variable, so all arguments starting with / will not be converted. You can +# list more prefixes using ';' as a separator. +# +export MSYS2_ARG_CONV_EXCL=/ + +tmp_file=`mktemp` + +# Remove temporary file on exit. Cover the case when exit due to an error. +# +trap 'rm -f $tmp_file' EXIT + function error () { echo "$*" 1>&2; exit 1; } function fail () @@ -21,10 +40,13 @@ function fail () function test () { - # There is no way to get the exit code in process substitution - # so ruin the output. - # - diff -u - <(b -q $* || echo "<invalid output>") + b -q $* >$tmp_file + + if [ $? -ne 0 ]; then + error "failed: b -q $* >$tmp_file" + fi + + diff --strip-trailing-cr -u - $tmp_file if [ $? -ne 0 ]; then error "failed: b $*" diff --git a/tests/variable/prepend/test.sh b/tests/variable/prepend/test.sh index afcb3bd..c745b76 100755 --- a/tests/variable/prepend/test.sh +++ b/tests/variable/prepend/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -b -q | diff -u test.out - +b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/qualified/test.sh b/tests/variable/qualified/test.sh index afcb3bd..c745b76 100755 --- a/tests/variable/qualified/test.sh +++ b/tests/variable/qualified/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -b -q | diff -u test.out - +b -q | diff --strip-trailing-cr -u test.out - diff --git a/tests/variable/type/test.sh b/tests/variable/type/test.sh index afcb3bd..c745b76 100755 --- a/tests/variable/type/test.sh +++ b/tests/variable/type/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -b -q | diff -u test.out - +b -q | diff --strip-trailing-cr -u test.out - |