diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-26 22:00:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-03-02 20:04:26 +0300 |
commit | 780290277a51853b2e515b16898ca0fcfa1e9e71 (patch) | |
tree | e045dd9cc4ce2726f915897157785cb40b48756f /tests | |
parent | 046f9282dc7778f5df326456f1630919a5607f11 (diff) |
Update rep-fetch
Diffstat (limited to 'tests')
19 files changed, 317 insertions, 25 deletions
diff --git a/tests/rep-remove/extra/libbar-1.1.0+1.tar.gz b/tests/common/prereq-cycle/extra/libbar-1.1.0+1.tar.gz Binary files differindex 890e9e2..890e9e2 100644 --- a/tests/rep-remove/extra/libbar-1.1.0+1.tar.gz +++ b/tests/common/prereq-cycle/extra/libbar-1.1.0+1.tar.gz diff --git a/tests/rep-remove/extra/repositories b/tests/common/prereq-cycle/extra/repositories index ecaa454..ecaa454 100644 --- a/tests/rep-remove/extra/repositories +++ b/tests/common/prereq-cycle/extra/repositories diff --git a/tests/rep-remove/math/libbar-1.0.0.tar.gz b/tests/common/prereq-cycle/math/libbar-1.0.0.tar.gz Binary files differindex 97e6e32..97e6e32 100644 --- a/tests/rep-remove/math/libbar-1.0.0.tar.gz +++ b/tests/common/prereq-cycle/math/libbar-1.0.0.tar.gz diff --git a/tests/rep-remove/math/repositories b/tests/common/prereq-cycle/math/repositories index 14d6ce0..14d6ce0 100644 --- a/tests/rep-remove/math/repositories +++ b/tests/common/prereq-cycle/math/repositories diff --git a/tests/rep-remove/stable/libfoo-1.0.0.tar.gz b/tests/common/prereq-cycle/stable/libfoo-1.0.0.tar.gz Binary files differindex 5e7fa17..5e7fa17 100644 --- a/tests/rep-remove/stable/libfoo-1.0.0.tar.gz +++ b/tests/common/prereq-cycle/stable/libfoo-1.0.0.tar.gz diff --git a/tests/rep-remove/stable/repositories b/tests/common/prereq-cycle/stable/repositories index b49d922..b49d922 100644 --- a/tests/rep-remove/stable/repositories +++ b/tests/common/prereq-cycle/stable/repositories diff --git a/tests/rep-fetch-git.test b/tests/rep-fetch-git.test index 45badc3..0d512eb 100644 --- a/tests/rep-fetch-git.test +++ b/tests/rep-fetch-git.test @@ -6,7 +6,6 @@ # the final states. See tests/common/git/init script for more details. # -rep_add += -d cfg 2>! test.cleanups += &cfg/.bpkg/repositories/*/*** +if ($git_protocol == 'local') diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test index 499541f..b0d73bd 100644 --- a/tests/rep-fetch.test +++ b/tests/rep-fetch.test @@ -32,6 +32,28 @@ # | |-- libhello-1.0.0.tar.gz # | `-- repositories # | +# |-- circle +# | |-- extra -> stable (prerequisite) +# | | |-- libbar-1.1.0+1.tar.gz +# | | `-- repositories +# | |-- math -> extra (prerequisite) +# | | |-- libbar-1.0.0.tar.gz +# | | `-- repositories +# | `-- stable -> math (prerequisite) +# | |-- libfoo-1.0.0.tar.gz +# | `-- repositories +# | +# |-- no-circle +# | |-- extra +# | | |-- libbar-1.1.0+1.tar.gz +# | | `-- repositories +# | |-- math +# | | |-- libbar-1.0.0.tar.gz +# | | `-- repositories +# | `-- stable -> extra (prerequisite) +# | |-- libfoo-1.0.0.tar.gz +# | `-- repositories +# | # `-- git/* (see rep-fetch-git.test) # Prepare repositories used by tests if running in the local mode. @@ -58,6 +80,13 @@ $rep_create $out/bar/testing &$out/bar/testing/packages $rep_create $out/bar/unstable &$out/bar/unstable/packages + # Create 'cycle/*' repositories. + # + cp -r $src/cycle $out/cycle + $rep_create $out/cycle/extra &$out/cycle/extra/packages + $rep_create $out/cycle/math &$out/cycle/math/packages + $rep_create $out/cycle/stable &$out/cycle/stable/packages + # Create git repositories. # $git_extract $src/git/state0/libfoo.tar @@ -71,6 +100,10 @@ $git_extract $src/git/state1/style-basic.tar &$out_git/state1/*** end +rep_add += -d cfg 2>! +rep_list += -d cfg --prerequisites --complements +pkg_status += -d cfg + : no-repos : $clone_cfg; @@ -84,8 +117,6 @@ $* 2>>/EOE != 0 { test.options += --auth all - rep_add += -d cfg 2>! - : hello : { @@ -129,7 +160,7 @@ $* 2>>/EOE != 0 : both : { - $clone_root_cfg && $rep_add $rep/hello && $rep_add $rep/bar/unstable; + $clone_root_cfg && $rep_add $rep/hello $rep/bar/unstable; $* --trust-yes 2>>EOE &cfg/.bpkg/certificates/**; fetching bpkg:build2.org/rep-fetch/bar/unstable @@ -151,6 +182,139 @@ $* 2>>/EOE != 0 6 package(s) in 6 repository(s) EOE } + + : location-args + : + { + $clone_root_cfg; + + $* --trust-yes $rep/bar/unstable 2>>EOE; + added bpkg:build2.org/rep-fetch/bar/unstable + fetching bpkg:build2.org/rep-fetch/bar/unstable + fetching bpkg:build2.org/rep-fetch/foo/testing (prerequisite of bpkg:build2.org/rep-fetch/bar/unstable) + fetching bpkg:build2.org/rep-fetch/foo/stable (complements bpkg:build2.org/rep-fetch/foo/testing) + fetching bpkg:build2.org/rep-fetch/bar/testing (complements bpkg:build2.org/rep-fetch/bar/unstable) + fetching bpkg:build2.org/rep-fetch/bar/stable (complements bpkg:build2.org/rep-fetch/bar/testing) + 5 package(s) in 5 repository(s) + EOE + + $* 'bpkg:build2.org/rep-fetch/bar/unstable' 2>>EOE; + fetching bpkg:build2.org/rep-fetch/bar/unstable + fetching bpkg:build2.org/rep-fetch/foo/testing (prerequisite of bpkg:build2.org/rep-fetch/bar/unstable) + fetching bpkg:build2.org/rep-fetch/foo/stable (complements bpkg:build2.org/rep-fetch/foo/testing) + fetching bpkg:build2.org/rep-fetch/bar/testing (complements bpkg:build2.org/rep-fetch/bar/unstable) + fetching bpkg:build2.org/rep-fetch/bar/stable (complements bpkg:build2.org/rep-fetch/bar/testing) + 5 package(s) in 5 repository(s) + EOE + + $rep_list >>"EOO" + bpkg:build2.org/rep-fetch/bar/unstable ($rep/bar/unstable) + complement bpkg:build2.org/rep-fetch/bar/testing ($rep/bar/testing) + complement bpkg:build2.org/rep-fetch/bar/stable ($rep/bar/stable) + prerequisite bpkg:build2.org/rep-fetch/foo/stable ($rep/foo/stable) + prerequisite bpkg:build2.org/rep-fetch/foo/testing ($rep/foo/testing) + complement bpkg:build2.org/rep-fetch/foo/stable ($rep/foo/stable) + prerequisite bpkg:build2.org/rep-fetch/foo/testing ($rep/foo/testing) + complement bpkg:build2.org/rep-fetch/foo/stable ($rep/foo/stable) + EOO + } + + : prerequisites-cycle + : + { + $clone_root_cfg; + + $* --trust-yes $rep/cycle/stable 2>>EOE; + added bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/math (prerequisite of bpkg:build2.org/rep-fetch/cycle/stable) + fetching bpkg:build2.org/rep-fetch/cycle/extra (prerequisite of bpkg:build2.org/rep-fetch/cycle/math) + 3 package(s) in 3 repository(s) + EOE + + $rep_list >>"EOO" + bpkg:build2.org/rep-fetch/cycle/stable ($rep/cycle/stable) + prerequisite bpkg:build2.org/rep-fetch/cycle/math ($rep/cycle/math) + prerequisite bpkg:build2.org/rep-fetch/cycle/extra ($rep/cycle/extra) + prerequisite bpkg:build2.org/rep-fetch/cycle/stable ($rep/cycle/stable) + EOO + } + + : unreferenced-prerequisite + : + { + +$clone_root_cfg + + # Create the no-cycle repository as the new state of the cycle repository. + # The cycle dependency is now broken (extra/ doesn't depend on stable/ + # anymore) and the extra/ prerequisite is moved from math/ to stable/. + # + nc_rep = [dir_path] $~/pkg/1/build2.org/rep-fetch/cycle/ + +mkdir -p $path.directory($nc_rep) + +cp -r $src/no-cycle "$nc_rep" # Strip trailing slash. + + +$rep_create $nc_rep/extra 2>! &$nc_rep/extra/packages + +$rep_create $nc_rep/math 2>! &$nc_rep/math/packages + +$rep_create $nc_rep/stable 2>! &$nc_rep/stable/packages + + math_rep = $nc_rep/math + stable_rep = $nc_rep/stable + + : remove + : + { + $clone_cfg; + + $* --trust-yes $rep/cycle/stable 2>>EOE; + added bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/math (prerequisite of bpkg:build2.org/rep-fetch/cycle/stable) + fetching bpkg:build2.org/rep-fetch/cycle/extra (prerequisite of bpkg:build2.org/rep-fetch/cycle/math) + 3 package(s) in 3 repository(s) + EOE + + $* --trust-yes $stable_rep 2>>EOE; + updated bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/extra (prerequisite of bpkg:build2.org/rep-fetch/cycle/stable) + 2 package(s) in 2 repository(s) + EOE + + $rep_list >>"EOO" + bpkg:build2.org/rep-fetch/cycle/stable ($nc_rep/stable) + prerequisite bpkg:build2.org/rep-fetch/cycle/extra ($nc_rep/extra) + EOO + } + + : no-remove + : + { + $clone_cfg; + + $* --trust-yes $rep/cycle/stable 2>>EOE; + added bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/math (prerequisite of bpkg:build2.org/rep-fetch/cycle/stable) + fetching bpkg:build2.org/rep-fetch/cycle/extra (prerequisite of bpkg:build2.org/rep-fetch/cycle/math) + 3 package(s) in 3 repository(s) + EOE + + $* --trust-yes $math_rep $stable_rep 2>>EOE; + added bpkg:build2.org/rep-fetch/cycle/math + updated bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/math + fetching bpkg:build2.org/rep-fetch/cycle/stable + fetching bpkg:build2.org/rep-fetch/cycle/extra (prerequisite of bpkg:build2.org/rep-fetch/cycle/stable) + 3 package(s) in 3 repository(s) + EOE + + $rep_list >>"EOO" + bpkg:build2.org/rep-fetch/cycle/math ($nc_rep/math) + bpkg:build2.org/rep-fetch/cycle/stable ($nc_rep/stable) + prerequisite bpkg:build2.org/rep-fetch/cycle/extra ($nc_rep/extra) + EOO + } + } } : git-repos @@ -160,38 +324,94 @@ if ($git_supported != true) # Skip git repository tests. # } -elif ($remote != true) -{ - git_protocol = 'local' - .include rep-fetch-git.test -} else { - : https-dumb + : proto : + if ($remote != true) { - git_protocol = 'https-dumb' + git_protocol = 'local' .include rep-fetch-git.test } - - : https-smart - : + else { - git_protocol = 'https-smart' - .include rep-fetch-git.test + : https-dumb + : + { + git_protocol = 'https-dumb' + .include rep-fetch-git.test + } + + : https-smart + : + { + git_protocol = 'https-smart' + .include rep-fetch-git.test + } + + : https-smart-unadv + : + { + git_protocol = 'https-smart-unadv' + .include rep-fetch-git.test + } + + : git + : + { + git_protocol = 'git' + .include rep-fetch-git.test + } } - : https-smart-unadv + : re-clone : + : Test that repository is re-cloned on the location change. Here this happens + : due to the scheme change. + : + if ($remote == true) { - git_protocol = 'https-smart-unadv' - .include rep-fetch-git.test + $clone_root_cfg && $rep_add "$rep_git_git/state0/libfoo.git#master"; + $* 2>! &cfg/.bpkg/repositories/*/***; + $rep_add "$rep_git_https_smart_unadv/state0/libfoo.git#master"; + + $* 2>>~"%EOE%" + %fetching git:.+libfoo#master% + %info: re-cloning git:.+libfoo#master due to location change% + % info: new location https://.+libfoo.git#master% + % info: old location git://.+libfoo.git#master% + %.+ + %Submodule 'libbar' .+https://.+libbar.+% + %.+ + EOE } - : git + : cleanup-failed + : + : Test that configuration is cleaned up if fetch fails after the repository + : filesystem state is changed. : { - git_protocol = 'git' - .include rep-fetch-git.test + $clone_root_cfg && $rep_add "$rep_git/state0/libfoo.git#master"; + + # Extract the repository path from the output line like this: + # + # Cloning into 'cfg\.bpkg\tmp\f9be881264703b5d\master'... + # + $* 2>&1 | sed -n -e "s/Cloning into '\(.+master\)'\.{3}/\$1/p" | \ + sed -n -e 's%(.+[\\/])tmp([\\/].+)%$1repositories$2%p' | \ + set r; + + # Break the repo (drop the remote repository URL) and try to re-fetch. + # + rm "$r/.git/config"; + + $* 2>>~%EOE% != 0; + %.+ + warning: repository state is now broken and will be cleaned up + info: run 'bpkg rep-fetch' to update + EOE + + $pkg_status libfoo >'unknown' } } diff --git a/tests/rep-fetch/cycle b/tests/rep-fetch/cycle new file mode 120000 index 0000000..2116ab2 --- /dev/null +++ b/tests/rep-fetch/cycle @@ -0,0 +1 @@ +../common/prereq-cycle
\ No newline at end of file diff --git a/tests/rep-fetch/no-cycle/extra/libbar-1.1.0+1.tar.gz b/tests/rep-fetch/no-cycle/extra/libbar-1.1.0+1.tar.gz Binary files differnew file mode 100644 index 0000000..890e9e2 --- /dev/null +++ b/tests/rep-fetch/no-cycle/extra/libbar-1.1.0+1.tar.gz diff --git a/tests/rep-fetch/no-cycle/extra/repositories b/tests/rep-fetch/no-cycle/extra/repositories new file mode 100644 index 0000000..5b70556 --- /dev/null +++ b/tests/rep-fetch/no-cycle/extra/repositories @@ -0,0 +1 @@ +: 1 diff --git a/tests/rep-fetch/no-cycle/math/libbar-1.0.0.tar.gz b/tests/rep-fetch/no-cycle/math/libbar-1.0.0.tar.gz Binary files differnew file mode 100644 index 0000000..97e6e32 --- /dev/null +++ b/tests/rep-fetch/no-cycle/math/libbar-1.0.0.tar.gz diff --git a/tests/rep-fetch/no-cycle/math/repositories b/tests/rep-fetch/no-cycle/math/repositories new file mode 100644 index 0000000..5b70556 --- /dev/null +++ b/tests/rep-fetch/no-cycle/math/repositories @@ -0,0 +1 @@ +: 1 diff --git a/tests/rep-fetch/no-cycle/stable/libfoo-1.0.0.tar.gz b/tests/rep-fetch/no-cycle/stable/libfoo-1.0.0.tar.gz Binary files differnew file mode 100644 index 0000000..5e7fa17 --- /dev/null +++ b/tests/rep-fetch/no-cycle/stable/libfoo-1.0.0.tar.gz diff --git a/tests/rep-fetch/no-cycle/stable/repositories b/tests/rep-fetch/no-cycle/stable/repositories new file mode 100644 index 0000000..14d6ce0 --- /dev/null +++ b/tests/rep-fetch/no-cycle/stable/repositories @@ -0,0 +1,3 @@ +: 1 +location: ../extra +: diff --git a/tests/rep-remove.test b/tests/rep-remove.test index 0dea240..3717449 100644 --- a/tests/rep-remove.test +++ b/tests/rep-remove.test @@ -48,9 +48,72 @@ end rep_add += -d cfg 2>! rep_fetch += -d cfg --auth all --trust-yes 2>! -rep_list += -d cfg +rep_list += -d cfg --prerequisites --complements pkg_status += -d cfg +: invalid-args +: +{ + : clean-all + : + $* --clean --all 2>>EOE != 0 + error: both --clean and --all|-a specified + info: run 'bpkg help rep-remove' for more information + EOE + + : clean-repos + : + $* --clean $rep/extra 2>>EOE != 0 + error: both --clean and repository argument specified + info: run 'bpkg help rep-remove' for more information + EOE + + : all-repos + : + $* --all $rep/extra 2>>EOE != 0 + error: both --all|-a and repository argument specified + info: run 'bpkg help rep-remove' for more information + EOE + + : none + : + $* 2>>EOE != 0 + error: repository name or location argument expected + info: run 'bpkg help rep-remove' for more information + EOE +} + +: clean +: +{ + $clone_cfg; + $rep_add $rep/extra && $rep_fetch; + + $* --clean 2>>"EOE"; + cleaned bpkg:build2.org/rep-remove/extra + EOE + + $rep_list >>"EOE"; + bpkg:build2.org/rep-remove/extra ($rep/extra) + EOE + + $pkg_status libbar >'unknown' +} + +: all +: +{ + $clone_cfg; + $rep_add $rep/extra && $rep_fetch; + + $* --all 2>>"EOE"; + removed bpkg:build2.org/rep-remove/extra + EOE + + $rep_list >:""; + $pkg_status libbar >'unknown' +} + : by-name : { @@ -61,7 +124,8 @@ pkg_status += -d cfg removed bpkg:build2.org/rep-remove/extra EOE - $rep_list >:"" + $rep_list >:""; + $pkg_status libbar >'unknown' } : prerequisites-cycle @@ -89,7 +153,7 @@ pkg_status += -d cfg removed bpkg:build2.org/rep-remove/testing EOE - $rep_list --prerequisites --complements >>"EOO"; + $rep_list >>"EOO"; bpkg:build2.org/rep-remove/math ($rep/math) prerequisite bpkg:build2.org/rep-remove/extra ($rep/extra) prerequisite bpkg:build2.org/rep-remove/stable ($rep/stable) diff --git a/tests/rep-remove/extra b/tests/rep-remove/extra new file mode 120000 index 0000000..2047cd9 --- /dev/null +++ b/tests/rep-remove/extra @@ -0,0 +1 @@ +../common/prereq-cycle/extra/
\ No newline at end of file diff --git a/tests/rep-remove/math b/tests/rep-remove/math new file mode 120000 index 0000000..9f6610d --- /dev/null +++ b/tests/rep-remove/math @@ -0,0 +1 @@ +../common/prereq-cycle/math/
\ No newline at end of file diff --git a/tests/rep-remove/stable b/tests/rep-remove/stable new file mode 120000 index 0000000..b29c92b --- /dev/null +++ b/tests/rep-remove/stable @@ -0,0 +1 @@ +../common/prereq-cycle/stable/
\ No newline at end of file |