Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(pkg): file-depends #9035

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions test/blackbox-tests/test-cases/pkg/file-depends.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Here we test the file-depends field in pkg1.config. When a package has been
installed, the .config file can also be included. This can have a file-depends
field which is a list of external files, together with their checksums, that
the package depends on. We make sure that such a package really does depend on
the files found in files-depend.

$ . ./helpers.sh
$ make_lockdir

$ foo=$PWD/foo
> cat > dune.lock/file-depends.pkg <<EOF
> (build
> (system "\| echo Building file-depends
> "\| cat > file-depends.config <<EOF
> "\| opam-version: "2.0"
> "\| file-depends: [ "$foo" "md5=00000000000000000000000000000000" ]
> "\| EOF
> ))
> EOF

Word of warning: the opam libraries will quietly discard the file-depends field if the
checksum is not parsable.

Now we make a package depending on file-depends.

$ cat > dune.lock/dep.pkg <<EOF
> (deps file-depends)
> (build
> (system "echo Building dep"))
> EOF

$ cat > foo <<EOF
> Hello
> EOF

Building dep should show both of them as being built.

$ build_pkg dep
Building file-depends
Building dep

Building again causes no rebuild as expected.

$ build_pkg dep

Changing foo should cause foo to be rebuilt.

$ cat > foo <<EOF
> World
> EOF

CR-someday alizter: This is broken, no rebuild is done.
$ build_pkg dep

Removing foo should cause an error due to the missing file.

$ rm foo

CR-someday alizter: This is broken, no rebuild is done.
$ build_pkg dep
Loading