-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic tests of lockfile generation
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
- Loading branch information
Showing
7 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...sts/test-cases/pkg/lockfile-generation.t/mock-opam-repository/packages/bar/bar.0.0.1/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
opam-version: "2.0" |
1 change: 1 addition & 0 deletions
1
...sts/test-cases/pkg/lockfile-generation.t/mock-opam-repository/packages/bar/bar.0.4.0/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
opam-version: "2.0" |
1 change: 1 addition & 0 deletions
1
...sts/test-cases/pkg/lockfile-generation.t/mock-opam-repository/packages/bar/bar.0.5.0/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
opam-version: "2.0" |
1 change: 1 addition & 0 deletions
1
...sts/test-cases/pkg/lockfile-generation.t/mock-opam-repository/packages/baz/baz.0.0.1/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
opam-version: "2.0" |
1 change: 1 addition & 0 deletions
1
...sts/test-cases/pkg/lockfile-generation.t/mock-opam-repository/packages/baz/baz.0.1.0/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
opam-version: "2.0" |
5 changes: 5 additions & 0 deletions
5
...sts/test-cases/pkg/lockfile-generation.t/mock-opam-repository/packages/foo/foo.0.0.1/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
opam-version: "2.0" | ||
depends: [ | ||
"baz" {>= "0.1"} | ||
"bar" {>= "0.2"} | ||
] |
85 changes: 85 additions & 0 deletions
85
test/blackbox-tests/test-cases/pkg/lockfile-generation.t/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Simple example of generating a lockfile with dune | ||
|
||
Generate a dune-project file. | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.8) | ||
> (package | ||
> (name lockfile_generation_test) | ||
> (depends | ||
> foo | ||
> (bar (>= "0.3")) | ||
> )) | ||
> EOF | ||
Run the solver and generate a lock directory. | ||
$ dune pkg lock --opam-env=pure --opam-repository=mock-opam-repository | ||
Selected the following packages: | ||
bar.0.4.0 | ||
baz.0.1.0 | ||
foo.0.0.1 | ||
lockfile_generation_test.LOCAL | ||
Print the name and contents of each file in the lock directory separated by | ||
"---", sorting by filename for consistency. | ||
$ find dune.lock -type f | sort | xargs -I{} sh -c "printf '{}:\n\n'; cat {}; printf '\n\n---\n\n'" | ||
dune.lock/bar: | ||
(version 0.4.0) | ||
(dev false) | ||
--- | ||
dune.lock/baz: | ||
(version 0.1.0) | ||
(dev false) | ||
--- | ||
dune.lock/foo: | ||
(version 0.0.1) | ||
(deps baz bar) | ||
(dev false) | ||
--- | ||
dune.lock/lock.dune: | ||
(lang package 0.1) | ||
--- | ||
dune.lock/lockfile_generation_test: | ||
(version LOCAL) | ||
(deps foo bar) | ||
(dev true) | ||
--- | ||
Regenerate the dune-project file introducing an unsatisfiable constraint. | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.8) | ||
> (package | ||
> (name lockfile_generation_test) | ||
> (depends | ||
> foo | ||
> (bar (>= "0.6")) | ||
> )) | ||
> EOF | ||
Run the solver again. This time it will fail. | ||
$ dune pkg lock --opam-env=pure --opam-repository=mock-opam-repository | ||
Error: Can't find all required versions. | ||
Selected: baz.0.1.0 foo.0.0.1 lockfile_generation_test.LOCAL | ||
- bar -> (problem) | ||
foo 0.0.1 requires >= 0.2 | ||
lockfile_generation_test LOCAL requires >= 0.6 | ||
Rejected candidates: | ||
bar.0.5.0: Incompatible with restriction: >= 0.6 | ||
bar.0.4.0: Incompatible with restriction: >= 0.6 | ||
bar.0.0.1: Incompatible with restriction: >= 0.2 | ||
[1] | ||