Skip to content

Commit

Permalink
reftests: add check install test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Aug 19, 2024
1 parent c2e7718 commit e7e25a3
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,27 @@
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:install-pgocaml.test} %{read-lines:testing-env}))))

(rule
(alias reftest-install)
(enabled_if (and (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
(action
(diff install.test install.out)))

(alias
(name reftest)
(enabled_if (and (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
(deps (alias reftest-install)))

(rule
(targets install.out)
(deps root-N0REP0)
(enabled_if (and (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
(package opam)
(action
(with-stdout-to
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:install.test} %{read-lines:testing-env}))))

(rule
(alias reftest-json.unix)
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
Expand Down
73 changes: 73 additions & 0 deletions tests/reftests/install.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
N0REP0
### <pkg:foo.1>
opam-version: "2.0"
### <pkg:bar.1>
opam-version: "2.0"
### <pkg:baz.1>
opam-version: "2.0"
### <pkg:top.1>
opam-version: "2.0"
depends: [
"foo"
("bar" | "baz")
]
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] no changes from file://${BASEDIR}/REPO
### opam switch create inst --empty
### : test check installed :
### opam install --check top
Missing dependencies:
bar baz foo
# Return code 1 #
### opam install foo
The following actions will be performed:
=== install 1 package
- install foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed foo.1
Done.
### opam install --check top
Missing dependencies:
bar baz
# Return code 1 #
### opam install bar
The following actions will be performed:
=== install 1 package
- install bar 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed bar.1
Done.
### opam install --check top
All dependencies installed
### opam remove bar
The following actions will be performed:
=== remove 1 package
- remove bar 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed bar.1
Done.
### opam install baz
The following actions will be performed:
=== install 1 package
- install baz 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed baz.1
Done.
### opam install --check top
All dependencies installed
### opam install bar
The following actions will be performed:
=== install 1 package
- install bar 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed bar.1
Done.
### opam install --check top
All dependencies installed

0 comments on commit e7e25a3

Please sign in to comment.