aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-04-30 22:55:13 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-02 11:41:23 +0300
commit4ebe65d7dda10909995c7460050811f05205e0ee (patch)
tree28c9c2c10ff2066483ab6ca1408fcf5362cceaf8 /tests
parent58d5690f5a0e706e2ea8b899819d0c3db22f4793 (diff)
Add support for default and excluding git ref filters
Diffstat (limited to 'tests')
-rwxr-xr-xtests/common/git/init29
-rw-r--r--tests/common/git/state0/libbar.tarbin71680 -> 71680 bytes
-rw-r--r--tests/common/git/state0/libfoo.tarbin296960 -> 307200 bytes
-rw-r--r--tests/common/git/state0/libfox.tarbin133120 -> 133120 bytes
-rw-r--r--tests/common/git/state0/style-basic.tarbin71680 -> 71680 bytes
-rw-r--r--tests/common/git/state0/style.tarbin133120 -> 133120 bytes
-rw-r--r--tests/common/git/state1/libbaz.tarbin61440 -> 61440 bytes
-rw-r--r--tests/common/git/state1/libfoo.tarbin378880 -> 389120 bytes
-rw-r--r--tests/common/git/state1/libfox.tarbin133120 -> 133120 bytes
-rw-r--r--tests/common/git/state1/style-basic.tarbin71680 -> 71680 bytes
-rw-r--r--tests/common/git/state1/style.tarbin133120 -> 133120 bytes
-rw-r--r--tests/rep-add.test2
-rw-r--r--tests/rep-fetch-git-commit.test22
-rw-r--r--tests/rep-fetch-git-refname.test14
-rw-r--r--tests/rep-fetch-git.test11
-rw-r--r--tests/rep-fetch.test149
16 files changed, 193 insertions, 34 deletions
diff --git a/tests/common/git/init b/tests/common/git/init
index 1c15bd6..4fac21e 100755
--- a/tests/common/git/init
+++ b/tests/common/git/init
@@ -106,16 +106,41 @@ git -C libbar.git commit -am 'Create'
# submodules.
#
git -C libfoo.git init
+
+cat <<EOF >libfoo.git/manifest
+: 1
+name: libfoo
+version: 0.0.1
+summary: libfoo
+license: MIT
+url: http://example.org
+email: pkg@example.org
+EOF
+
git -C libfoo.git add '*'
git -C libfoo.git submodule add ../style.git doc/style
git -C libfoo.git submodule add ../libbar.git libbar
git -C libfoo.git submodule update --init --recursive # Updates doc/style/basic.
git -C libfoo.git commit -am 'Create'
+git -C libfoo.git tag -a 'v0.0.1' -m 'Tag version 0.0.1'
-# Add tags for libfoo.git.
+# Increase libfoo version and add tags.
#
+cat <<EOF >libfoo.git/manifest
+: 1
+name: libfoo
+version: 1.0.0
+summary: libfoo
+license: MIT
+url: http://example.org
+email: pkg@example.org
+EOF
+
+git -C libfoo.git commit -am 'Increase version to 1.0.0'
+
git -C libfoo.git tag 'ltag'
-git -C libfoo.git tag -a 'atag' -m 'Create annotated tag'
+git -C libfoo.git tag -a 'atag' -m 'Create annotated tag'
+git -C libfoo.git tag -a 'v1.0.0' -m 'Tag version 1.0.0'
# Advance the master branch to make tags not to mark a branch tip.
#
diff --git a/tests/common/git/state0/libbar.tar b/tests/common/git/state0/libbar.tar
index 58b58bd..1db19e5 100644
--- a/tests/common/git/state0/libbar.tar
+++ b/tests/common/git/state0/libbar.tar
Binary files differ
diff --git a/tests/common/git/state0/libfoo.tar b/tests/common/git/state0/libfoo.tar
index 7aa0a9d..b2fa494 100644
--- a/tests/common/git/state0/libfoo.tar
+++ b/tests/common/git/state0/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state0/libfox.tar b/tests/common/git/state0/libfox.tar
index 81d6c85..fe226a3 100644
--- a/tests/common/git/state0/libfox.tar
+++ b/tests/common/git/state0/libfox.tar
Binary files differ
diff --git a/tests/common/git/state0/style-basic.tar b/tests/common/git/state0/style-basic.tar
index 481705c..63904e2 100644
--- a/tests/common/git/state0/style-basic.tar
+++ b/tests/common/git/state0/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state0/style.tar b/tests/common/git/state0/style.tar
index 127f82f..8c6c6ea 100644
--- a/tests/common/git/state0/style.tar
+++ b/tests/common/git/state0/style.tar
Binary files differ
diff --git a/tests/common/git/state1/libbaz.tar b/tests/common/git/state1/libbaz.tar
index 572c56b..7ca795c 100644
--- a/tests/common/git/state1/libbaz.tar
+++ b/tests/common/git/state1/libbaz.tar
Binary files differ
diff --git a/tests/common/git/state1/libfoo.tar b/tests/common/git/state1/libfoo.tar
index 4512930..af5212b 100644
--- a/tests/common/git/state1/libfoo.tar
+++ b/tests/common/git/state1/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state1/libfox.tar b/tests/common/git/state1/libfox.tar
index 4046ded..6e108ba 100644
--- a/tests/common/git/state1/libfox.tar
+++ b/tests/common/git/state1/libfox.tar
Binary files differ
diff --git a/tests/common/git/state1/style-basic.tar b/tests/common/git/state1/style-basic.tar
index 604e8c8..cd6416e 100644
--- a/tests/common/git/state1/style-basic.tar
+++ b/tests/common/git/state1/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state1/style.tar b/tests/common/git/state1/style.tar
index dab3fd7..d2c2a70 100644
--- a/tests/common/git/state1/style.tar
+++ b/tests/common/git/state1/style.tar
Binary files differ
diff --git a/tests/rep-add.test b/tests/rep-add.test
index 9b52efd..30653e2 100644
--- a/tests/rep-add.test
+++ b/tests/rep-add.test
@@ -51,7 +51,7 @@ rep_list += -d cfg
$clone_cfg;
$* 'git://example.org/repo#' 2>>EOE != 0
- error: invalid git repository location 'git://example.org/repo#': missing reference name or commit id for git repository
+ error: invalid git repository location 'git://example.org/repo#': missing refname or commit id for git repository
EOE
}
diff --git a/tests/rep-fetch-git-commit.test b/tests/rep-fetch-git-commit.test
index da08718..c756552 100644
--- a/tests/rep-fetch-git-commit.test
+++ b/tests/rep-fetch-git-commit.test
@@ -10,10 +10,12 @@
+git -C ../style-basic log '--pretty=format:%H' --all --grep='README' | \
set commit
- : no-branch
+ : no-refname
+ :
+ : Here we also test that a commit can be specified without leading '@'.
:
{
- $clone_root_cfg && $rep_add "$rep/state0/style-basic.git#@$commit";
+ $clone_root_cfg && $rep_add "$rep/state0/style-basic.git#$commit";
if ($git_protocol == 'https-dumb')
warn = "$warn_repo_hist$reason_dumb$warn_dumb"
@@ -22,15 +24,15 @@
end;
$* 2>>~"%EOE%"
- %fetching git:.+style-basic#@$commit%
+ %fetching git:.+style-basic#$commit%
%querying .+style-basic\.git%?
- $warn
%fetching from .+style-basic\.git%
+ $warn
1 package\(s\) in 1 repository\(s\)
EOE
}
- : branch
+ : refname
:
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#stable@$commit";
@@ -44,8 +46,8 @@
$* 2>>~"%EOE%"
%fetching git:.+style-basic#stable@$commit%
%querying .+style-basic\.git%?
- $warn
%fetching from .+style-basic\.git%
+ $warn
1 package\(s\) in 1 repository\(s\)
EOE
}
@@ -61,7 +63,7 @@
warn = "$warn_ref_hist$reason_dumb$warn_dumb"
end
- : no-branch
+ : no-refname
:
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#@$commit";
@@ -69,13 +71,13 @@
$* 2>>~"%EOE%"
%fetching git:.+style-basic#@$commit%
%querying .+style-basic\.git%?
- $warn
%fetching from .+style-basic.\git%
+ $warn
1 package\(s\) in 1 repository\(s\)
EOE
}
- : branch
+ : refname
:
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#stable@$commit";
@@ -83,8 +85,8 @@
$* 2>>~"%EOE%"
%fetching git:.+style-basic#stable@$commit%
%querying .+style-basic\.git%?
- $warn
%fetching from .+style-basic\.git%
+ $warn
1 package\(s\) in 1 repository\(s\)
EOE
}
diff --git a/tests/rep-fetch-git-refname.test b/tests/rep-fetch-git-refname.test
index ca1e0ff..a9842d5 100644
--- a/tests/rep-fetch-git-refname.test
+++ b/tests/rep-fetch-git-refname.test
@@ -14,8 +14,8 @@
$* 2>>~"%EOE%"
%fetching git:.+libfoo$fragment%
%querying .+libfoo\.git%
- $warn
%fetching from .+libfoo\.git%
+ $warn
1 package\(s\) in 1 repository\(s\)
EOE
}
@@ -75,16 +75,16 @@
$pkg_checkout libfoo/1.0.0 2>>~"%EOE%";
checking out libfoo/1.0.0
%querying .+style\.git%?
- $warn1
%fetching submodule 'doc/style' from .+style\.git%
+ $warn1
%submodule path 'doc/style': checked out .+%
%querying .+style-basic\.git%?
- $warn2
%fetching submodule 'doc/style/basic' from .+style-basic\.git%
+ $warn2
%submodule path 'doc/style/basic': checked out .+%
%querying .+libbar\.git%?
- $warn3
%fetching submodule 'libbar' from .+libbar\.git%
+ $warn3
%submodule path 'libbar': checked out .+%
distributing libfoo/1.0.0
checked out libfoo/1.0.0
@@ -106,8 +106,8 @@
$* 2>>~"%EOE%" 1>&2;
%fetching git:.+libfoo$fragment%
%querying .+libfoo\.git%
- $warn
%fetching from .+libfoo\.git%
+ $warn
%warning: unable to rmdir .?libbar.?: .+%
1 package\(s\) in 1 repository\(s\)
EOE
@@ -125,12 +125,12 @@
$pkg_checkout libfoo/1.0.0 2>>~"%EOE%";
checking out libfoo/1.0.0
%querying .+style\.git%?
- $warn1
%fetching submodule 'doc/style' from .+style\.git%
+ $warn1
%submodule path 'doc/style': checked out .+%
%querying .+libbaz\.git%?
- $warn2
%fetching submodule 'libbaz' from .+libbaz\.git%
+ $warn2
%submodule path 'libbaz': checked out .+%
distributing libfoo/1.0.0
checked out libfoo/1.0.0
diff --git a/tests/rep-fetch-git.test b/tests/rep-fetch-git.test
index 697d967..d92bf4a 100644
--- a/tests/rep-fetch-git.test
+++ b/tests/rep-fetch-git.test
@@ -44,17 +44,10 @@ else
rep_git = "$rep"
end
-: none
+: branch
:
{
- fragment = ''
- .include rep-fetch-git-refname.test
-}
-
-: refname
-:
-{
- refname = '#master'
+ fragment = '#master'
.include rep-fetch-git-refname.test
}
diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test
index 47be179..6f563d4 100644
--- a/tests/rep-fetch.test
+++ b/tests/rep-fetch.test
@@ -610,15 +610,14 @@ else
$* 2>>~%EOE% &cfg/.bpkg/repos/*/***
%fetching git:.+libfox#master%
%querying .+libfox\.git%
- %.{0,2}
%fetching from .+libfox\.git%
+ %warning: .+%{0,2}
%querying .+libbar\.git%?
- %.{0,2}
%fetching submodule 'libbar' from .+libbar\.git%
+ %warning: .+%{0,2}
%submodule path 'libbar': checked out '.+'%
2 package(s) in 1 repository(s)
EOE
-
}
: re-fetching
@@ -635,8 +634,8 @@ else
$* 2>>~%EOE%
%fetching git:.+libfoo#master%
%info: location changed for git:.+libfoo#master%
- % info: new location https://.+libfoo.git#master%
- % info: old location git://.+libfoo.git#master%
+ % info: new location https://.+libfoo\.git#master%
+ % info: old location git://.+libfoo\.git#master%
%querying .+libfoo\.git%
1 package(s) in 1 repository(s)
EOE
@@ -671,4 +670,144 @@ else
$pkg_status libfoo >'libfoo unknown'
}
+
+ : ref-filters
+ :
+ {
+ test.cleanups += &?cfg/.bpkg/repos/*/***
+
+ : pattern
+ :
+ {
+ : matching
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#v**" 2>>~%EOE%
+ %added .+libfoo#v\*\*%
+ %querying .+libfoo\.git%
+ %fetching from .+libfoo\.git%
+ %warning: .+%{0,2}
+ 2 package(s) in 1 repository(s)
+ EOE
+ }
+
+ : non-matching
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#tags/mast*" 2>>~%EOE%
+ %added .+libfoo#tags/mast\*%
+ %querying .+libfoo\.git%
+ 0 package(s) in 1 repository(s)
+ EOE
+ }
+ }
+
+ : name
+ :
+ {
+ : non-matching
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#foo" 2>>~%EOE% != 0
+ %added .+libfoo#foo%
+ %querying .+libfoo\.git%
+ error: reference 'foo' is not found
+ EOE
+ }
+ }
+
+ : commit
+ :
+ {
+ : non-matching-pattern
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#foo*@9ab039761936802d61b8e591d6812a4dd4605029" 2>>~%EOE% != 0
+ %added .+libfoo#foo\*@9ab039761936802d61b8e591d6812a4dd4605029%
+ %querying .+libfoo\.git%
+ error: no names match pattern 'foo*'
+ EOE
+ }
+
+ : unexisting
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#9ab039761936802d61b8e591d6812a4dd4605029" 2>>~%EOE% != 0
+ %added .+libfoo#9ab039761936802d61b8e591d6812a4dd4605029%
+ %querying .+libfoo\.git%
+ %fetching from .+libfoo\.git%
+ %warning: .+%{0,2}
+ error: unable to fetch commit 9ab039761936802d61b8e591d6812a4dd4605029
+ EOE
+ }
+ }
+
+ : exclusion
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#mast*,-master" 2>>~%EOE%
+ %added .+libfoo#mast\*,-master%
+ %querying .+libfoo\.git%
+ 0 package(s) in 1 repository(s)
+ EOE
+ }
+
+ : inclusion
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git#tags/mast*,+master" 2>>~%EOE%
+ %added .+libfoo#tags/mast\*,\+master%
+ %querying .+libfoo\.git%
+ %fetching from .+libfoo\.git%
+ %warning: .+%{0,2}
+ 1 package(s) in 1 repository(s)
+ EOE
+ }
+
+ : default
+ :
+ {
+ : no-fragment
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git" 2>>~%EOE%
+ %added .+libfoo%
+ %querying .+libfoo\.git%
+ %fetching from .+libfoo\.git%
+ %warning: .+%{0,2}
+ 2 package(s) in 1 repository(s)
+ EOE
+ }
+
+ : with-exclusion
+ :
+ {
+ $clone_root_cfg;
+
+ $* "$rep_git/state0/libfoo.git##-/tags/v1*" 2>>~%EOE%
+ %added .+libfoo##-/tags/v1\*%
+ %querying .+libfoo\.git%
+ %fetching from .+libfoo\.git%
+ %warning: .+%{0,2}
+ 1 package(s) in 1 repository(s)
+ EOE
+ }
+ }
+ }
}