Skip to content

Commit

Permalink
Merge pull request #5004 from AltGr/tests-autoupd
Browse files Browse the repository at this point in the history
Some new tests, and auto-update after package def
  • Loading branch information
kit-ty-kate authored Jan 21, 2022
2 parents 41f3684 + 761da37 commit be3b0a3
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 150 deletions.
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ users)
* Add & update env tests [#4861 #4841 @rjbou @dra27]
* Port opam-rt tests: orphans, dep-cycles, reinstall, and big-upgrade [#4979 @AltGr]
* Add & update env tests [#4861 #4841 #4974 @rjbou @dra27 @AltGr]
* Add remove test [#5004 @AltGr]
### Engine
* Add `opam-cat` to normalise opam file printing [#4763 @rjbou @dra27] [2.1.0~rc2 #4715]
* Fix meld reftest: open only with failing ones [#4913 @rjbou]
Expand All @@ -205,6 +206,7 @@ users)
* Clean outputs from opam error reporting block [#4966 @rjbou]
* Avoid diff when the repo is too old [#4979 @AltGr]
* Escape regexps characters in string replacements primitives [#5009 @kit-ty-kate]
* Automatically update default repo when adding a package file [#5004 @AltGr]


## Github Actions
Expand Down
40 changes: 0 additions & 40 deletions tests/reftests/avoid-version.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ N0REP0
### <pkg:a.2>
opam-version: "2.0"
flags: avoid-version
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create default --empty
### OPAMFAKE=1
### OPAMYES=1
Expand All @@ -15,11 +10,6 @@ The following actions would be faked:
- install a 2
### <pkg:a.1>
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 install a
The following actions will be faked:
- install a 1
Expand All @@ -36,11 +26,6 @@ However, you may "opam upgrade" these packages explicitly, which will ask permis
Nothing to do.
### <pkg:a.1.1>
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 upgrade a
The following actions will be faked:
- upgrade a 1 to 1.1
Expand All @@ -50,11 +35,6 @@ Faking installation of a.1.1
Done.
### <pkg:a.3>
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 upgrade a
The following actions will be faked:
- upgrade a 1.1 to 3
Expand All @@ -79,19 +59,9 @@ Done.
### <pkg:b.1>
opam-version: "2.0"
depends: "a"
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### <pkg:b.2>
opam-version: "2.0"
depends: "a" {= "2"}
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam install b
The following actions will be faked:
- install b 1
Expand Down Expand Up @@ -129,19 +99,9 @@ Done.
### <pkg:a.4>
opam-version: "2.0"
flags: avoid-version
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### <pkg:b.3>
opam-version: "2.0"
flags: avoid-version
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam upgrade
Everything as up-to-date as possible (run with --verbose to show unavailable upgrades).

Expand Down
10 changes: 0 additions & 10 deletions tests/reftests/cli-versioning.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ flags: compiler
### <pkg:baz.2>
opam-version: "2.0"
flags: compiler
### opam update default

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam option depext=false
Set to 'false' the field depext in global configuration
### opam switch install cli-versioning --empty
Expand Down Expand Up @@ -101,11 +96,6 @@ build-env: [OPAMCLI = "2.1"]
build: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.1'"]
install: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.1'"]
remove: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.1'"]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch set-invariant --formula "[]"
The switch invariant was set to []
### opam install env-2-0
Expand Down
5 changes: 0 additions & 5 deletions tests/reftests/dot-install.test
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ bonjour
saluton
### OPAMYES=1
### opam switch create inst --empty
### opam update default

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### OPAMPRECISETRACKING=1 OPAMDEBUGSECTIONS="TRACK ACTION" OPAMDEBUG=-1
### opam install nodot
The following actions will be performed:
Expand Down
17 changes: 17 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,23 @@
%{targets}
(run ./run.exe %{bin:opam} %{dep:pin.test} %{read-lines:testing-env}))))

(rule
(alias reftest-remove)
(action
(diff remove.test remove.out)))

(alias
(name reftest)
(deps (alias reftest-remove)))

(rule
(targets remove.out)
(deps root-N0REP0)
(action
(with-stdout-to
%{targets}
(run ./run.exe %{bin:opam} %{dep:remove.test} %{read-lines:testing-env}))))

(rule
(alias reftest-show)
(action
Expand Down
10 changes: 0 additions & 10 deletions tests/reftests/env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ N0REP0
opam-version: "2.0"
setenv: [ NV_VARS += "%{_:doc}%:%{_:share}%" ]
flags: compiler
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create setenv nv

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Expand All @@ -34,11 +29,6 @@ flags: compiler
### <pkg:nv.1:nv.config>
opam-version: "2.0"
variables { nv_config: "hej!!" }
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create conffile nv

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Expand Down
5 changes: 0 additions & 5 deletions tests/reftests/opamrt-dep-cycle.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ install: [ "mkdir" _:lib ]
depends: "a" {= version}
build: [ "test" "-d" a:lib ]
remove: [ "test" "-d" a:lib ]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create system --empty
### opam install a.1
The following actions will be performed:
Expand Down
20 changes: 0 additions & 20 deletions tests/reftests/opamrt-reinstall.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ opam-version: "2.0"
depends: "c"
build: [ "test" "-d" c:lib ]
remove: [ "test" "-d" c:lib ]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create system --empty
### : 1/ Install d
### opam install d
Expand Down Expand Up @@ -157,11 +152,6 @@ depends: "a"
build: [ "test" "-d" a:lib ]
remove: [ "test" "-d" a:lib ]
install: [ "mkdir" _:lib ]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam install d
The following actions will be performed:
- install b 1 [required by c]
Expand Down Expand Up @@ -224,11 +214,6 @@ depends: "b"
build: [ "test" "-d" b:lib ]
remove: [ "test" "-d" b:lib ]
install: [ "mkdir" _:lib ]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam upgrade c
The following actions will be performed:
- upgrade c 1 to 2
Expand Down Expand Up @@ -304,11 +289,6 @@ Nothing to do.
### <pkg:a.2>
opam-version: "2.0"
install: [ "mkdir" _:lib ]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam upgrade --show
The following actions would be performed:
- upgrade a 1 to 2
Expand Down
20 changes: 0 additions & 20 deletions tests/reftests/orphans.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ depends: "foo" {= "1"}
### <pkg:baz.1>
opam-version: "2.0"
### OPAMYES=1
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create sw --empty
### opam install bar
The following actions will be performed:
Expand All @@ -27,11 +22,6 @@ Done.
### <pkg:foo.1>
opam-version: "2.0"
available: false
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam reinstall foo
[ERROR] foo: unmet availability conditions: 'false'
# Return code 5 #
Expand Down Expand Up @@ -69,11 +59,6 @@ Cleaning up switch sw
### : replay the same sequence but with another version of `foo` present
### <pkg:foo.2>
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 upgrade --show
The following actions would be performed:
- remove bar 1 [conflicts with foo]
Expand All @@ -82,11 +67,6 @@ The following actions would be performed:
### <pkg:bar.2>
opam-version: "2.0"
depends: "foo" {>= "1"}
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam upgrade --show
The following actions would be performed:
- upgrade foo 1 to 2
Expand Down
5 changes: 0 additions & 5 deletions tests/reftests/pat-sub.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ build: [
["grep" "ploplop" "bar"]
["grep" "ploplop" "baz"]
]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create sw --empty
### OPAMDEBUGSECTIONS="ACTION" opam install pat-sub -y --debug --debug-level=-1
The following actions will be performed:
Expand Down
5 changes: 0 additions & 5 deletions tests/reftests/pin.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ N0REP0
### <pkg:foo.1>
opam-version:"2.0"
build: [ "echo" "foo" ]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam pin --current foo
[ERROR] foo is not installed, invalid flag `--current'
# Return code 2 #
Expand Down
48 changes: 48 additions & 0 deletions tests/reftests/remove.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
N0REP0
### :::::: removal of partial dependencies (#4727)
### <pkg:a.1>
opam-version: "2.0"
### <pkg:b.1>
opam-version: "2.0"
### <pkg:c.1>
opam-version: "2.0"
depends: "a" | "b"
### opam switch create default --empty
### opam install a b c
The following actions will be performed:
- install b 1
- install a 1
- install c 1
===== 3 to install =====

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed a.1
-> installed b.1
-> installed c.1
Done.
### opam remove a --show
The following actions would be performed:
- remove a 1
- recompile c 1 [uses a]
===== 1 to recompile | 1 to remove =====
### opam remove --auto --show
Nothing to do.
### opam remove a --auto --show
The following actions would be performed:
- remove c 1 [uses a]
- remove a 1
===== 2 to remove =====
### :::::: message on removal of an unavailable package (#4890)
### <pkg:z.1>
opam-version: "2.0"
available: false
### <pkg:w.1>
opam-version: "2.0"
depends: "z"
### opam remove z
[ERROR] z: unmet availability conditions: 'false'
# Return code 5 #
### opam remove w
[NOTE] w is not installed.

Nothing to do.
Loading

0 comments on commit be3b0a3

Please sign in to comment.