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/dir-path/buildfile | 45 +++ old-tests/variable/dir-path/test.out | 22 ++ old-tests/variable/dir-path/test.sh | 3 + old-tests/variable/expansion/buildfile | 26 ++ old-tests/variable/expansion/test.out | 6 + old-tests/variable/expansion/test.sh | 3 + old-tests/variable/null/buildfile | 22 ++ old-tests/variable/null/test.out | 7 + old-tests/variable/null/test.sh | 3 + old-tests/variable/override/build/bootstrap.build | 2 + old-tests/variable/override/buildfile | 58 ++++ old-tests/variable/override/cache | 13 + .../variable/override/p/build/bootstrap.build | 1 + old-tests/variable/override/p/buildfile | 49 ++++ old-tests/variable/override/p/loader | 1 + old-tests/variable/override/simple | 3 + old-tests/variable/override/test.sh | 312 +++++++++++++++++++++ old-tests/variable/prepend/buildfile | 14 + old-tests/variable/prepend/test.out | 4 + old-tests/variable/prepend/test.sh | 3 + old-tests/variable/qualified/buildfile | 27 ++ old-tests/variable/qualified/test.out | 12 + old-tests/variable/qualified/test.sh | 3 + .../variable/representation/build/bootstrap.build | 4 + old-tests/variable/representation/buildfile | 34 +++ old-tests/variable/representation/driver.cxx | 10 + old-tests/variable/representation/test.out | 20 ++ old-tests/variable/representation/test.sh | 4 + old-tests/variable/type-pattern-append/buildfile | 59 ++++ old-tests/variable/type-pattern-append/test.out | 7 + old-tests/variable/type-pattern-append/test.sh | 3 + old-tests/variable/type-pattern/buildfile | 39 +++ old-tests/variable/type/buildfile | 84 ++++++ old-tests/variable/type/test.out | 12 + old-tests/variable/type/test.sh | 3 + 35 files changed, 918 insertions(+) create mode 100644 old-tests/variable/dir-path/buildfile create mode 100644 old-tests/variable/dir-path/test.out create mode 100755 old-tests/variable/dir-path/test.sh create mode 100644 old-tests/variable/expansion/buildfile create mode 100644 old-tests/variable/expansion/test.out create mode 100755 old-tests/variable/expansion/test.sh create mode 100644 old-tests/variable/null/buildfile create mode 100644 old-tests/variable/null/test.out create mode 100755 old-tests/variable/null/test.sh create mode 100644 old-tests/variable/override/build/bootstrap.build create mode 100644 old-tests/variable/override/buildfile create mode 100644 old-tests/variable/override/cache create mode 100644 old-tests/variable/override/p/build/bootstrap.build create mode 100644 old-tests/variable/override/p/buildfile create mode 100644 old-tests/variable/override/p/loader create mode 100644 old-tests/variable/override/simple create mode 100755 old-tests/variable/override/test.sh create mode 100644 old-tests/variable/prepend/buildfile create mode 100644 old-tests/variable/prepend/test.out create mode 100755 old-tests/variable/prepend/test.sh create mode 100644 old-tests/variable/qualified/buildfile create mode 100644 old-tests/variable/qualified/test.out create mode 100755 old-tests/variable/qualified/test.sh create mode 100644 old-tests/variable/representation/build/bootstrap.build create mode 100644 old-tests/variable/representation/buildfile create mode 100644 old-tests/variable/representation/driver.cxx create mode 100644 old-tests/variable/representation/test.out create mode 100755 old-tests/variable/representation/test.sh create mode 100644 old-tests/variable/type-pattern-append/buildfile create mode 100644 old-tests/variable/type-pattern-append/test.out create mode 100755 old-tests/variable/type-pattern-append/test.sh create mode 100644 old-tests/variable/type-pattern/buildfile create mode 100644 old-tests/variable/type/buildfile create mode 100644 old-tests/variable/type/test.out create mode 100755 old-tests/variable/type/test.sh (limited to 'old-tests/variable') diff --git a/old-tests/variable/dir-path/buildfile b/old-tests/variable/dir-path/buildfile new file mode 100644 index 0000000..5c99f07 --- /dev/null +++ b/old-tests/variable/dir-path/buildfile @@ -0,0 +1,45 @@ +# Untyped dir path reversability. +# +x = s/foo/bar/ +print -e=$x +print -e $x + +y = $x +print -e=$y +print -e $y +print + +# Typed dir path reversability and expansion. +# +x = [dir_path] foo/bar/ +print -I$x +print -I$x/baz +print -I $x +print [strings] -I $x +print -I $x/baz +print + +y = $x # No longer typed but still not original. +print -I$y +print -I$y/baz +print -I $y +print [strings] -I $y +print -I $y/baz +print + +z = [strings] $x # Re-typed. +print $z +print + +# The root case. +# +r = [dir_path] / +print $r/foo + +r += foo +print [strings] $r + +r += bar +print [strings] $r + +./: diff --git a/old-tests/variable/dir-path/test.out b/old-tests/variable/dir-path/test.out new file mode 100644 index 0000000..e608c42 --- /dev/null +++ b/old-tests/variable/dir-path/test.out @@ -0,0 +1,22 @@ +-e=s/foo/bar/ +-e s/foo/bar/ +-e=s/foo/bar/ +-e s/foo/bar/ + +-Ifoo/bar +-Ifoo/bar/baz +-I foo/bar/ +-I foo/bar +-I foo/bar/baz + +-Ifoo/bar +-Ifoo/bar/baz +-I foo/bar/ +-I foo/bar +-I foo/bar/baz + +foo/bar + +//foo +/foo +/foo/bar diff --git a/old-tests/variable/dir-path/test.sh b/old-tests/variable/dir-path/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/dir-path/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/expansion/buildfile b/old-tests/variable/expansion/buildfile new file mode 100644 index 0000000..3f28372 --- /dev/null +++ b/old-tests/variable/expansion/buildfile @@ -0,0 +1,26 @@ +foo = FOO + +print $foo +print $(foo) + +# Invalid. +# +#print $ +#print $() +#print $(foo bar) +#print $(foo{bar}) + +# Indirect. +# +FOO = foo +print $($FOO) +print $($(FOO)) +print $($($FOO)) + +# Quoted name. +# +"b a r" = BAR +print $("b a r") +#print $"b a r" + +./: diff --git a/old-tests/variable/expansion/test.out b/old-tests/variable/expansion/test.out new file mode 100644 index 0000000..5056f04 --- /dev/null +++ b/old-tests/variable/expansion/test.out @@ -0,0 +1,6 @@ +FOO +FOO +FOO +FOO +foo +BAR diff --git a/old-tests/variable/expansion/test.sh b/old-tests/variable/expansion/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/expansion/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/null/buildfile b/old-tests/variable/null/buildfile new file mode 100644 index 0000000..3fa1a9e --- /dev/null +++ b/old-tests/variable/null/buildfile @@ -0,0 +1,22 @@ +#v = [null=junk] # error: unexpected value for attribute null: junk +#v = [null] junk # error: empty null value expected instead of 'junk' + +print $v0 # Undefined. + +v1 = [null] +print $v1 + +v2 = x +v2 = [null] +print $v2 + +v3a = [null] +v3b = $v3a +print $v3b +v3b = ($v3a) +print $v3b +print ($v3b) + +print [null] + +./: diff --git a/old-tests/variable/null/test.out b/old-tests/variable/null/test.out new file mode 100644 index 0000000..5119a71 --- /dev/null +++ b/old-tests/variable/null/test.out @@ -0,0 +1,7 @@ +[null] +[null] +[null] +[null] +[null] +[null] +[null] diff --git a/old-tests/variable/null/test.sh b/old-tests/variable/null/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/null/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - 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 < + +using namespace std; + +int +main (int argc, const char* argv[]) +{ + for (int i (1); i < argc; ++i) + cout << "'" << argv[i] << "'" << endl; +} diff --git a/old-tests/variable/representation/test.out b/old-tests/variable/representation/test.out new file mode 100644 index 0000000..84e7250 --- /dev/null +++ b/old-tests/variable/representation/test.out @@ -0,0 +1,20 @@ +'-L/' +'-L/foo/' +'..' +'../' +'/' +'//' +'///' +'//foo/' +'foo@bar' +'foo/@bar/' +'foo@' +'@bar' +'@' +'@@' +'foo%bar' +'foo%' +'%bar' +'foo%bar' +'x%foo@y%bar' +'x%foo/@y%bar/' diff --git a/old-tests/variable/representation/test.sh b/old-tests/variable/representation/test.sh new file mode 100755 index 0000000..da9e0e9 --- /dev/null +++ b/old-tests/variable/representation/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +b test + diff --git a/old-tests/variable/type-pattern-append/buildfile b/old-tests/variable/type-pattern-append/buildfile new file mode 100644 index 0000000..a91b340 --- /dev/null +++ b/old-tests/variable/type-pattern-append/buildfile @@ -0,0 +1,59 @@ +# Typed append/prepend. +# +#dir{a*}: x += [bool] true +#dir{p*}: x =+ [bool] true + +[string] typed = [null] +dir{a*}: typed += abc # ok +dir{p*}: typed =+ abc # ok + +# Prepend/append before/after assignment. +# +[string] x1 = [null] +dir{*}: x1 += A +dir{*}: x1 = b +dir{*}: x1 += c +dir{*}: x1 =+ a +print $(dir{./}:x1) + +# Without stem, mixed prepend/append. +# +dir{*}: x2 += b +dir{*}: x2 += c +#dir{*}: x2 =+ a # error +print $(dir{./}:x2) + +dir{*}: x3 =+ b +dir{*}: x3 =+ a +#dir{*}: x3 += c # error +print $(dir{./}:x3) + +# With stem, typing. +# +x4 = a +dir{*}: x4 += b +dir{*}: x4 += c +print $(dir{./}:x4) + +[string] x5 = b +dir{*}: x5 =+ a +x = $(dir{./}:x5) +print $(dir{./}:x5) + +x6 = [string] a +sub/: +{ + dir{*}: x6 += b + dir{*}: x6 += [null] + print $(dir{./}:x6) +} + +x7 = [string] b +dir{*}: x7 =+ a +sub/: +{ + dir{*}: x7 += c + print $(dir{./}:x7) +} + +./: diff --git a/old-tests/variable/type-pattern-append/test.out b/old-tests/variable/type-pattern-append/test.out new file mode 100644 index 0000000..e8e2242 --- /dev/null +++ b/old-tests/variable/type-pattern-append/test.out @@ -0,0 +1,7 @@ +abc +b c +a b +a b c +ab +ab +abc diff --git a/old-tests/variable/type-pattern-append/test.sh b/old-tests/variable/type-pattern-append/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/type-pattern-append/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - diff --git a/old-tests/variable/type-pattern/buildfile b/old-tests/variable/type-pattern/buildfile new file mode 100644 index 0000000..dd218ac --- /dev/null +++ b/old-tests/variable/type-pattern/buildfile @@ -0,0 +1,39 @@ +#dir/foo{*}: x = y # directory +#foo{*.*}: x = y # multiple wildcards +#foo{*}: x = y # unknown target type +#file{*}: x += y # append + +# Use --verbose 6 to examine. +# + +dir{*}: x = y + +x = z +dir{*-foo}: x = $x # 'z' + +x = G +file{*-foo}: x = x +file{xfoo}: x = $x # 'G' +file{-foo}: x = $x # 'x' +file{x-foo}: x = $x # 'x' +file{bar-*-foo}: x = X +file{bar-x}: x = $x # 'G' +file{bar--foo}: x = $x # 'X' +file{bar-x-foo}: x = $x # 'X' + +file{*-fox}: x = 1 +file{fox-*}: x = 2 +file{fox-fox}: x = $x # '2' +file{*-fox}: x = 3 +file{fox-x-fox}: x = $x # still '2'! + +*-foz: x = z # any target +file{x-foz}: x = $x # 'z' + +# These should all be the same. +# +*: x1 = X1 +{*}: x2 = X2 +*{*}: x3 = X3 + +./: diff --git a/old-tests/variable/type/buildfile b/old-tests/variable/type/buildfile new file mode 100644 index 0000000..a22cddd --- /dev/null +++ b/old-tests/variable/type/buildfile @@ -0,0 +1,84 @@ +# Variable typing. +# + +#[string] str3 = foo +#[bool] str3 = false # error: changing str3 type from string to bool + +#[bool string] str3 = foo # error: multiple variable types: bool, string + +#[junk] jnk = foo # error: unknown variable attribute junk + +[string] str1 = bar +str1 =+ foo +str1 += baz +print $str1 + +str2 = bar +[string] str2 =+ foo +str2 += baz +print $str2 + +# Value typing. +# + +#v = [bool string] true # error: multiple value types: string, bool +#v = [string=junk] true # error: unexpected value for attribute string: junk + +#[string] var = +#var = [bool] true # error: confliction variable var type string and value type bool + +#var = [string] false +#var += [bool] true # error: confliction original value type string and append/prepend value type bool + +v1a = [uint64] 00 +v1b += [uint64] 00 +v1c =+ [uint64] 00 +print $v1a $v1b $v1c # 0 0 0 + +v2 = [uint64] 00 +v2 = [string] 00 +print $v2 # 00 + +#v3a = [uint64] 00 +#v3a += [string] 00 # error: confliction original value type uint64 and append/prepend value type string + +#v3b = [uint64] 00 +#v3b =+ [string] 00 # error: confliction original value type uint64 and append/prepend value type string + +v4a = 01 +v4a += [uint64] 01 +print $v4a # 2 + +v4b = 01 +v4b =+ [uint64] 01 +print $v4b # 2 + +v5a = 01 +sub/: +{ + v5a += [uint64] 01 + print $v5a # 2 +} + +v5b = 01 +sub/: +{ + v5b =+ [uint64] 01 + print $v5b # 2 +} + +v6 = [uint64 null] +v6 += 00 +print $v6 # 0 + +v7 = [string null] +v7 += [uint64] 00 +print $v7 # 0 + +print [uint64] 00 # 0 + +v8 = [uint64] 01 +v8 = abc +print $v8 # abc + +./: diff --git a/old-tests/variable/type/test.out b/old-tests/variable/type/test.out new file mode 100644 index 0000000..5218221 --- /dev/null +++ b/old-tests/variable/type/test.out @@ -0,0 +1,12 @@ +foobarbaz +foobarbaz +0 0 0 +00 +2 +2 +2 +2 +0 +0 +0 +abc diff --git a/old-tests/variable/type/test.sh b/old-tests/variable/type/test.sh new file mode 100755 index 0000000..c745b76 --- /dev/null +++ b/old-tests/variable/type/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +b -q | diff --strip-trailing-cr -u test.out - -- cgit v1.1