Skip to content

Commit

Permalink
test(pkg): cleanup tests (#8832)
Browse files Browse the repository at this point in the history
We replace solve_project in most places with solve, cleanup whitespace
and directory creation (not that our helpers do this).

Signed-off-by: Ali Caglayan <[email protected]>
  • Loading branch information
Alizter authored Oct 3, 2023
1 parent 7fe74db commit 6cd21ef
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 235 deletions.
39 changes: 5 additions & 34 deletions test/blackbox-tests/test-cases/pkg/convert-opam-commands.t
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,7 @@ Package which has boolean where string was expected. This should be caught while
> ]
> EOF
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends
> standard-dune
> with-interpolation
> with-percent-sign
> variable-types))
> EOF
$ solve standard-dune with-interpolation with-percent-sign variable-types
Solution for dune.lock:
standard-dune.0.0.1
variable-types.0.0.1
Expand Down Expand Up @@ -140,12 +131,7 @@ Package which has boolean where string was expected. This should be caught while
(run echo %{pkg:foo:package_var})
(run echo %{os_family})))
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends with-malformed-interpolation))
> EOF
$ solve with-malformed-interpolation
Error: Encountered malformed variable interpolation while processing commands
for package with-malformed-interpolation.0.0.1.
The variable interpolation:
Expand All @@ -154,12 +140,7 @@ Package which has boolean where string was expected. This should be caught while
"./configure" "--prefix=%{prefix"
[1]
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends exercise-filters))
> EOF
$ solve exercise-filters
Solution for dune.lock:
exercise-filters.0.0.1
Expand Down Expand Up @@ -220,12 +201,7 @@ Package which has boolean where string was expected. This should be caught while
(and %{pkg:foo:installed} %{pkg:bar:installed} %{pkg:baz:installed})
(run echo m))))
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends filter-error-invalid-conjunction))
> EOF
$ solve filter-error-invalid-conjunction
Error: Expected string or identifier but found conjunction of identifiers:
foo+bar+baz:version
...while processing commands for package:
Expand All @@ -235,12 +211,7 @@ Package which has boolean where string was expected. This should be caught while
name2 and name3, i.e it is equivalent to name1:var & name2:var & name3:var.
[1]
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends filter-error-bool-where-string-expected))
> EOF
$ solve filter-error-bool-where-string-expected
Error: At
$TESTCASE_ROOT/mock-opam-repository/packages/filter-error-bool-where-string-expected/filter-error-bool-where-string-expected.0.0.1/opam:3:33-3:34::
Parse error
Expand Down
14 changes: 2 additions & 12 deletions test/blackbox-tests/test-cases/pkg/env-conditional-dependencies.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ dependency:

Depending on foo should add the macos and linux dependency but not the
test-only dependency because we don't add transitive test dependencies:
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends foo))
> EOF
$ solve foo
Solution for dune.lock:
foo.0.0.1
foo-linux.0.0.1
Expand Down Expand Up @@ -56,12 +51,7 @@ incompatible:
> EOF

There's no solution to these dependencies:
$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends bar))
> EOF
$ solve bar
Error: Unable to solve dependencies in build context: default
Can't find all required versions.
Selected: bar.0.0.1 bar-linux.0.0.1 x.dev
Expand Down
8 changes: 1 addition & 7 deletions test/blackbox-tests/test-cases/pkg/opam-package-copy-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ Make a package with a patch
> bar
> EOF

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-patch))
> EOF
$ solve with-patch
Solution for dune.lock:
with-patch.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ The error message should have a location for the opam repository.

This does not currently seem to be the case.

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-patch))
> EOF
$ solve with-patch
Error: Unable to read file in opam repository:
opendir($TESTCASE_ROOT/mock-opam-repository/packages/with-patch/with-patch.0.0.1/files/dir): Permission denied
[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ Make a package with only an install step

$ mkdir -p $mock_packages/install-no-build/install-no-build.0.0.1/

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends install-no-build))
> EOF
$ solve install-no-build
Solution for dune.lock:
install-no-build.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ Make a package with a substs and patches field field

$ opam_repo=$mock_packages/with-substs-and-patches/with-substs-and-patches.0.0.1

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-substs-and-patches))
> EOF
$ solve with-substs-and-patches
Solution for dune.lock:
with-substs-and-patches.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ Make a package with a build-env field and no build or install step
> build-env: [ [ MY_ENV_VAR = "Hello from env var!" ] ]
> EOF

$ mkdir -p $mock_packages/with-build-env/with-build-env.0.0.1/

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-build-env))
> EOF
$ solve with-build-env
Solution for dune.lock:
with-build-env.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ Make a package with a build-env field
> install: ["sh" "-c" "echo $MY_ENV_VAR"]
> EOF

$ mkdir -p $mock_packages/with-build-env/with-build-env.0.0.1/

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-build-env))
> EOF
$ solve with-build-env
Solution for dune.lock:
with-build-env.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ In this test we demonstrate that we don't currently do anything special with tho
> build-test: [ "echo" "Building test" ]
> EOF

$ mkdir -p $mock_packages/with-build-test-doc/with-build-test-doc.0.0.1

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-build-test-doc))
> EOF
$ solve with-build-test-doc
Solution for dune.lock:
with-build-test-doc.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,7 @@ Make a package with an extra-source field and multiple checksums
> }
> EOF

$ opam_repo=$mock_packages
$ mkdir -p $opam_repo/with-extra-source/with-extra-source.0.0.1
$ mkdir -p $opam_repo/with-extra-source-md5/with-extra-source-md5.0.0.1
$ mkdir -p $opam_repo/with-extra-source-multiple-checksums/with-extra-source-multiple-checksums.0.0.1

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends
> with-extra-source
> with-extra-source-md5
> with-extra-source-multiple-checksums))
> EOF
$ solve with-extra-source with-extra-source-md5 with-extra-source-multiple-checksums
Solution for dune.lock:
with-extra-source.0.0.1
with-extra-source-md5.0.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ Demonstrate the translation of filtered dependencies
> ]
> EOF

$ solve_project 2>/dev/null <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends bar))
> EOF
$ solve bar 2>/dev/null

$ cat dune.lock/bar.pkg
(version 0.0.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ Make a package with a patch behind a filter
> +This is wrong; this patch should have been filtered out.
> EOF

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-patch-filter))
> EOF
$ solve with-patch-filter
Solution for dune.lock:
with-patch-filter.0.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ file and the second patches two, one of the files is in a subdirectory.:w
> +This is right
> EOF

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-patch))
> EOF
$ solve with-patch
Solution for dune.lock:
with-patch.0.0.1

Expand Down
8 changes: 1 addition & 7 deletions test/blackbox-tests/test-cases/pkg/opam-package-with-patch.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ Make a package with a patch
> +This is right
> EOF

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-patch))
> EOF
$ solve with-patch
Solution for dune.lock:
with-patch.0.0.1

Expand Down
10 changes: 1 addition & 9 deletions test/blackbox-tests/test-cases/pkg/opam-package-with-subst.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ Make a package with a substs field
> build: [ "sh" "-c" "[ -e foo.ml ] && cat foo.ml" ]
> EOF

$ opam_repo=$opam_repo/with-substs/with-substs.0.0.1

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (allow_empty)
> (depends with-substs))
> EOF
$ solve with-substs
Solution for dune.lock:
with-substs.0.0.1

Expand Down
11 changes: 2 additions & 9 deletions test/blackbox-tests/test-cases/pkg/solver-flags-per-context.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
$ . ./helpers.sh
$ mkrepo

!! Do not delete this one for the one in helpers.sh as it passes --all-contexts !!
Helper shell function to generate a dune-project file and generate lockdir:

$ solve_project() {
Expand Down Expand Up @@ -63,15 +64,7 @@ Create a workspace file with some contexts with different combinations of with-t
$ mkpkg doc-package <<EOF
> EOF

$ solve_project <<EOF
> (lang dune 3.8)
> (package
> (name x)
> (depends
> regular-package
> (test-package :with-test)
> (doc-package :with-doc)))
> EOF
$ solve regular-package "(test-package :with-test)" "(doc-package :with-doc)"
Solution for with-standard-flags.lock:
doc-package.0.0.1
regular-package.0.0.1
Expand Down
Loading

0 comments on commit 6cd21ef

Please sign in to comment.