aboutsummaryrefslogtreecommitdiff
path: root/old-tests/variable/override
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-01 12:07:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-01 12:07:18 +0200
commit0ed86c76239d4f2904ea4ae1a77902a9e0db2a6d (patch)
tree5e8e1d43a0140f5739b21be7cbe120ebb9360d4f /old-tests/variable/override
parent12fc75188cc1f0a8c4c443c04e7a022131198c36 (diff)
Move old tests to old-tests/
Diffstat (limited to 'old-tests/variable/override')
-rw-r--r--old-tests/variable/override/build/bootstrap.build2
-rw-r--r--old-tests/variable/override/buildfile58
-rw-r--r--old-tests/variable/override/cache13
-rw-r--r--old-tests/variable/override/p/build/bootstrap.build1
-rw-r--r--old-tests/variable/override/p/buildfile49
-rw-r--r--old-tests/variable/override/p/loader1
-rw-r--r--old-tests/variable/override/simple3
-rwxr-xr-xold-tests/variable/override/test.sh312
8 files changed, 439 insertions, 0 deletions
diff --git a/old-tests/variable/override/build/bootstrap.build b/old-tests/variable/override/build/bootstrap.build
new file mode 100644
index 0000000..1c2e239
--- /dev/null
+++ b/old-tests/variable/override/build/bootstrap.build
@@ -0,0 +1,2 @@
+project = override
+amalgamation = # Disabled.
diff --git a/old-tests/variable/override/buildfile b/old-tests/variable/override/buildfile
new file mode 100644
index 0000000..c090e81
--- /dev/null
+++ b/old-tests/variable/override/buildfile
@@ -0,0 +1,58 @@
+if ($t != [null])
+{
+ [$t] v = [null]
+}
+
+print "/ :" $(/: v)
+
+if ($a == as)
+{
+ v = x
+}
+elif ($a == ap)
+{
+ v += s
+}
+elif ($a == pr)
+{
+ v =+ p
+}
+
+print ". :" $v
+
+d/:
+{
+ if ($d_a == as)
+ {
+ v = x
+ }
+ elif ($d_a == ap)
+ {
+ v += s
+ }
+ elif ($d_a == pr)
+ {
+ v =+ p
+ }
+
+ print "d :" $v
+
+
+ if ($d_t_a == as)
+ {
+ file{t}: v = x
+ }
+ elif ($d_t_a == ap)
+ {
+ file{t}: v += s
+ }
+ elif ($d_t_a == pr)
+ {
+ file{t}: v =+ p
+ }
+
+ print "d/t :" $(file{t}: v)
+}
+
+include p/
+./:
diff --git a/old-tests/variable/override/cache b/old-tests/variable/override/cache
new file mode 100644
index 0000000..8378688
--- /dev/null
+++ b/old-tests/variable/override/cache
@@ -0,0 +1,13 @@
+x = [string] 0
+print $x
+
+x = [uint64] 1
+print $x
+
+y = 0
+print $y
+
+[uint64] y = [null]
+print $y
+
+./:
diff --git a/old-tests/variable/override/p/build/bootstrap.build b/old-tests/variable/override/p/build/bootstrap.build
new file mode 100644
index 0000000..723e2a3
--- /dev/null
+++ b/old-tests/variable/override/p/build/bootstrap.build
@@ -0,0 +1 @@
+project = override-p
diff --git a/old-tests/variable/override/p/buildfile b/old-tests/variable/override/p/buildfile
new file mode 100644
index 0000000..527b9ae
--- /dev/null
+++ b/old-tests/variable/override/p/buildfile
@@ -0,0 +1,49 @@
+if ($p_a == as)
+{
+ v = x
+}
+elif ($p_a == ap)
+{
+ v += s
+}
+elif ($p_a == pr)
+{
+ v =+ p
+}
+
+print "p :" $v
+
+d/:
+{
+ if ($p_d_a == as)
+ {
+ v = x
+ }
+ elif ($p_d_a == ap)
+ {
+ v += s
+ }
+ elif ($p_d_a == pr)
+ {
+ v =+ p
+ }
+
+ print "p/d :" $v
+
+ if ($p_d_t_a == as)
+ {
+ file{t}: v = x
+ }
+ elif ($p_d_t_a == ap)
+ {
+ file{t}: v += s
+ }
+ elif ($p_d_t_a == pr)
+ {
+ file{t}: v =+ p
+ }
+
+ print "p/d/t :" $(file{t}: v)
+}
+
+./:
diff --git a/old-tests/variable/override/p/loader b/old-tests/variable/override/p/loader
new file mode 100644
index 0000000..f298dcc
--- /dev/null
+++ b/old-tests/variable/override/p/loader
@@ -0,0 +1 @@
+include ../buildfile
diff --git a/old-tests/variable/override/simple b/old-tests/variable/override/simple
new file mode 100644
index 0000000..899daa2
--- /dev/null
+++ b/old-tests/variable/override/simple
@@ -0,0 +1,3 @@
+print $foo
+
+./:
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 <<EOF
+/ : X
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test ./:v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test ./p/:v=X <<EOF
+/ :
+. :
+d :
+d/t :
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v=X --buildfile loader ./p/ <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test /v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v=X p_a=as <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test %v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test %v=X p_a=as <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : x
+p/d : x
+p/d/t : x
+EOF
+
+test /v=X d_a=as p_d_a=as <<EOF
+/ :
+. : X
+d : x
+d/t : x
+p : X
+p/d : x
+p/d/t : x
+EOF
+
+test %v+=S %v=+P a=as <<EOF
+/ :
+. : P x S
+d : P x S
+d/t : P x S
+p : P x S
+p/d : P x S
+p/d/t : P x S
+EOF
+
+test %v+=S %v=+P a=as p_a=as <<EOF
+/ :
+. : P x S
+d : P x S
+d/t : P x S
+p : x
+p/d : x
+p/d/t : x
+EOF
+
+# Append/Prepend in override.
+#
+test v+=S <<EOF
+/ :
+. : S
+d : S
+d/t : S
+p : S
+p/d : S
+p/d/t : S
+EOF
+
+test v+=S a=as <<EOF
+/ :
+. : x S
+d : x S
+d/t : x S
+p : x S
+p/d : x S
+p/d/t : x S
+EOF
+
+test %v=+P a=as p_a=as <<EOF
+/ :
+. : P x
+d : P x
+d/t : P x
+p : x
+p/d : x
+p/d/t : x
+EOF
+
+test %v+=S v=+P a=as p_a=as <<EOF
+/ :
+. : P x S
+d : P x S
+d/t : P x S
+p : P x
+p/d : P x
+p/d/t : P x
+EOF
+
+# Append/Prepend in both.
+#
+test v=X a=ap d_a=ap p_a=ap p_d_a=ap <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v+=S v=+P a=as d_a=ap d_t_a=ap p_a=ap p_d_a=ap p_d_t_a=ap <<EOF
+/ :
+. : P x S
+d : P x s S
+d/t : P x s s S
+p : P x s S
+p/d : P x s s S
+p/d/t : P x s s s S
+EOF
+
+# These ones are surprising. I guess the moral is we shouldn't do "blind"
+# cross-project append/prepend.
+#
+test %v=X a=as d_a=ap p_a=ap p_d_a=ap <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : x s
+p/d : x s s
+p/d/t : x s s
+EOF
+
+test %v+=S a=as d_a=ap p_a=ap p_d_a=ap <<EOF
+/ :
+. : x S
+d : x s S
+d/t : x s S
+p : x s
+p/d : x s s
+p/d/t : x s s
+EOF
+
+test %v+=S a=as d_a=ap p_a=ap p_d_a=ap ./ p/ <<EOF
+/ :
+. : x S
+d : x s S
+d/t : x s S
+p : x s S
+p/d : x s s S
+p/d/t : x s s S
+EOF
+
+# Typed override.
+#
+test v+=S v=+P t=string <<EOF
+/ :
+. : PS
+d : PS
+d/t : PS
+p : PS
+p/d : PS
+p/d/t : PS
+EOF
+
+test v+=S v=+P t=string a=as d_a=ap d_t_a=ap p_a=ap p_d_a=ap p_d_t_a=ap <<EOF
+/ :
+. : PxS
+d : PxsS
+d/t : PxssS
+p : PxsS
+p/d : PxssS
+p/d/t : PxsssS
+EOF
+
+# Cache overwrite.
+#
+test --buildfile cache x+=01 y+=01 <<EOF
+001
+2
+0 01
+1
+EOF