Skip to content

Commit

Permalink
Promote expected hash changes
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Kubica <marek@tarides.com>
  • Loading branch information
Leonidas-from-XIV committed Oct 17, 2024
1 parent e447775 commit 6848f33
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
8 changes: 4 additions & 4 deletions test/blackbox-tests/test-cases/pkg/check-dependency-hash.t
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Add a non-local dependency to the package:
$ cat dune.lock/lock.dune
(lang package 0.1)

(dependency_hash 69dfdf4e6a7c8489262f9d8b9958c9b3)
(dependency_hash 0fb32ed01eee84701d3d9914ed94ccde)

(repositories
(complete false)
Expand All @@ -72,9 +72,9 @@ Add a second dependency to the project:
Error: Dependency hash in lockdir does not match the hash of non-local
dependencies of this project. The lockdir expects the the non-local
dependencies to hash to:
69dfdf4e6a7c8489262f9d8b9958c9b3
0fb32ed01eee84701d3d9914ed94ccde
...but the non-local dependencies of this project hash to:
0cd7f9253f917ae8182c904fac99c3d9
0957b29d20339bd1b51e20e42066782c
Hint: Regenerate the lockdir by running 'dune pkg lock'
Error: Some lockdirs do not contain solutions for local packages:
- dune.lock
Expand All @@ -90,7 +90,7 @@ Remove all dependencies from the project:
Lockdir dune.lock does not contain a solution for local packages:
File "dune.lock/lock.dune", line 3, characters 17-49:
Error: This project has no non-local dependencies yet the lockfile contains a
dependency hash: 69dfdf4e6a7c8489262f9d8b9958c9b3
dependency hash: 0fb32ed01eee84701d3d9914ed94ccde
Hint: Regenerate the lockdir by running 'dune pkg lock'
Error: Some lockdirs do not contain solutions for local packages:
- dune.lock
Expand Down
28 changes: 19 additions & 9 deletions test/blackbox-tests/test-cases/pkg/dependency-hash.t
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A single package with a single non-local dependency:
> foo))
> EOF
$ dune describe pkg dependency-hash | tee hash1.txt
9f76a6d656fe14d54ba74f864e736dc3
7ca1f99e145b303327501bfbbc37d9c3

Adding another dependency causes the hash to change:
$ cat >dune-project <<EOF
Expand All @@ -52,12 +52,12 @@ Adding another dependency causes the hash to change:
> bar))
> EOF
$ dune describe pkg dependency-hash | tee hash2.txt
142f33129a06ccbebd65a0bad3d94857
2a25c11343df3a8259d7c024aaa0ee61
$ diff hash1.txt hash2.txt
1c1
< 9f76a6d656fe14d54ba74f864e736dc3
< 7ca1f99e145b303327501bfbbc37d9c3
---
> 142f33129a06ccbebd65a0bad3d94857
> 2a25c11343df3a8259d7c024aaa0ee61
[1]

Adding a new local package which depends on one of the existing dependencies
Expand All @@ -75,8 +75,13 @@ doesn't change the hash:
> foo))
> EOF
$ dune describe pkg dependency-hash | tee hash3.txt
142f33129a06ccbebd65a0bad3d94857
578d4513e42a927739d440803aca51db
$ diff hash2.txt hash3.txt
1c1
< 2a25c11343df3a8259d7c024aaa0ee61
---
> 578d4513e42a927739d440803aca51db
[1]

Adding a constraint to one of the dependencies causes the hash to change:
$ cat >dune-project <<EOF
Expand All @@ -92,12 +97,12 @@ Adding a constraint to one of the dependencies causes the hash to change:
> (foo (and :with-test (> 0.1)))))
> EOF
$ dune describe pkg dependency-hash | tee hash4.txt
ecad1d0d60084711169be48b130c9c52
22079ffcd21b09d251335cf9af50952e
$ diff hash3.txt hash4.txt
1c1
< 142f33129a06ccbebd65a0bad3d94857
< 578d4513e42a927739d440803aca51db
---
> ecad1d0d60084711169be48b130c9c52
> 22079ffcd21b09d251335cf9af50952e
[1]

Adding another local package with the same dependency and constraint doesn't
Expand All @@ -119,8 +124,13 @@ change the hash:
> (foo (and :with-test (> 0.1)))))
> EOF
$ dune describe pkg dependency-hash | tee hash5.txt
ecad1d0d60084711169be48b130c9c52
bd8e515e2ebc57716e85d885fd92ac72
$ diff hash4.txt hash5.txt
1c1
< 22079ffcd21b09d251335cf9af50952e
---
> bd8e515e2ebc57716e85d885fd92ac72
[1]

Make sure that the hash changes when the formula changes from a conjunction to
a disjunction, thus changing the solution:
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/pkg/hash-algos.t
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ first checksum to the lockfile for this package.
$ cat dune.lock/*
(lang package 0.1)

(dependency_hash 4435ebc0724374e2f76349d7a2e7ab6e)
(dependency_hash 17b97ab57074ddc2b0855c079bdcd199)

(repositories
(complete false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Print the contents of each file in the lockdir:

(lang package 0.1)

(dependency_hash ca83e32ab35d71d20fa075b395046c29)
(dependency_hash 44e17c47888cba0a8f0420212abbe5c9)

(repositories
(complete false)
Expand Down Expand Up @@ -123,7 +123,7 @@ Run the solver again preferring oldest versions of dependencies:

(lang package 0.1)

(dependency_hash ca83e32ab35d71d20fa075b395046c29)
(dependency_hash 44e17c47888cba0a8f0420212abbe5c9)

(repositories
(complete false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Solve the packages again, this time with the variables set.
- static-deps.1.0
(lang package 0.1)

(dependency_hash aea7daa72b636fa3a44973ec5e29d225)
(dependency_hash 3dec76be2da8f63e03c969ddc9d1fdee)

(repositories
(complete false)
Expand All @@ -85,7 +85,7 @@ Solve the packages again, this time with the variables set.
- no-deps-b.1.0
(lang package 0.1)

(dependency_hash 6957fba0128609ffc98fac2561c329cb)
(dependency_hash 140e60481cf0455b2ae4e3f564948f1f)

(repositories
(complete false)
Expand All @@ -101,7 +101,7 @@ Solve the packages again, this time with the variables set.
- no-deps-b.1.0
(lang package 0.1)

(dependency_hash 9675a3014e7e2db0f946b3ad2a95c037)
(dependency_hash 42918e144969848bbab6db3694774040)

(repositories
(complete false)
Expand Down Expand Up @@ -149,7 +149,7 @@ stored in the lockdir metadata:
$ cat dune.lock/lock.dune
(lang package 0.1)

(dependency_hash 72ab96748951e41c88d4ad9673fea081)
(dependency_hash 6f642e3d7efff362e19e2c2c702b16a9)

(repositories
(complete false)
Expand Down

0 comments on commit 6848f33

Please sign in to comment.