diff --git a/tests/reftests/dune.inc b/tests/reftests/dune.inc index b955d9e6ea9..ee7ddf491da 100644 --- a/tests/reftests/dune.inc +++ b/tests/reftests/dune.inc @@ -271,6 +271,23 @@ %{targets} (run ./run.exe %{bin:opam} %{dep:pat-sub.test} %{read-lines:testing-env})))) +(rule + (alias reftest-repository) + (action + (diff repository.test repository.out))) + +(alias + (name reftest) + (deps (alias reftest-repository))) + +(rule + (targets repository.out) + (deps root-N0REP0) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{bin:opam} %{dep:repository.test} %{read-lines:testing-env})))) + (rule (alias reftest-show) (action diff --git a/tests/reftests/repository.test b/tests/reftests/repository.test new file mode 100644 index 00000000000..5eee1ba925d --- /dev/null +++ b/tests/reftests/repository.test @@ -0,0 +1,93 @@ +N0REP0 +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### opam update + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[default] synchronised from file://${BASEDIR}/REPO +Now run 'opam upgrade' to apply any package updates. +### opam switch create repos --empty +### opam list --all --short +first +### : repo addition +### opam repository add repo2 ./REPO2 +[repo2] Initialised +[NOTE] Repository repo2 has been added to the selections of switch repos only. + Run `opam repository add repo2 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### opam list --all --short +first +second +### : repo addition with no action +### opam repository add repo3 ./REPO3 --no-action +[NOTE] Repository repo3 has been added to the selections of switch repos only. + Run `opam repository add repo3 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### opam list --all --short +first +second +### opam update repo3 + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[repo3] Initialised +Now run 'opam upgrade' to apply any package updates. +### opam list --all --short +first +second +third +### : repo set-url +### opam repository remove repo3 +Repositories removed from the selections of switch repos. Use '--all' to forget about them altogether. +### opam repository set-url repo2 ./REPO3 +[repo2] Initialised +### opam list --all --short +first +third +### : repo set-url with no-action +### opam repository set-url repo2 ./REPO2 --no-action +### opam list --all --short +first +### opam update repo2 + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[repo2] Initialised +Now run 'opam upgrade' to apply any package updates. +### opam list --all --short +first +second +### : add with wrong url +### opam repository add repo4 ./REPO4 +[ERROR] Could not update repository "repo4": rsync failed +[ERROR] Initial repository fetch failed +# Return code 40 # +### opam repository add repo4 ./REPO4 --no-action +[NOTE] Repository repo4 has been added to the selections of switch repos only. + Run `opam repository add repo4 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### opam list --all --short +first +second +### opam update repo4 + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Could not update repository "repo4": rsync failed +# Return code 40 # +### : set-url with wrong url +### opam repository set-url default ./REPO4 +[ERROR] Could not update repository "default": rsync failed +### opam repository set-url default ./REPO4 --no-action +### opam list --all --short +second +### opam update default + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Could not update repository "default": rsync failed +# Return code 40 #