From 0ed86c76239d4f2904ea4ae1a77902a9e0db2a6d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 1 Dec 2016 12:07:18 +0200 Subject: Move old tests to old-tests/ --- old-tests/variable/override/test.sh | 312 ++++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100755 old-tests/variable/override/test.sh (limited to 'old-tests/variable/override/test.sh') diff --git a/old-tests/variable/override/test.sh b/old-tests/variable/override/test.sh new file mode 100755 index 0000000..a8b08b2 --- /dev/null +++ b/old-tests/variable/override/test.sh @@ -0,0 +1,312 @@ +#! /usr/bin/env bash + +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 () +{ + if [ "$verbose" = "y" ]; then + b $* + else + b -q $* 2>/dev/null + fi + + if [ $? -eq 0 ]; then + error "succeeded: b $*" + fi + + return 0 +} + +function test () +{ + 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 $*" + fi +} + +fail foo=bar[] # error: unexpected [ in variable assignment 'foo=bar[]' +fail foo=[string]bar # error: typed override of variable foo +fail "!foo=bar" "!foo=BAR" # error: multiple global overrides of variable foo +fail "foo=bar" "foo=BAR" # error: multiple project overrides of variable foo +fail "%foo=bar" "%foo=BAR" # error: multiple project overrides of variable foo + +test --buildfile simple foo=bar ./ ./ <<< "bar" # Multiple bootstraps of the same project. + +# Visibility/qualification. +# +test !v=X <