Skip to content

Commit 052a684

Browse files
tests: Enable dev-tool flag when running dev-tools (#12489)
This is factored out of #12394 and makes sure that the dev tool flag is set when attempting to use dev-tool functionality. Signed-off-by: Marek Kubica <[email protected]>
1 parent a67adb8 commit 052a684

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-install.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Test `dune tools which ocamlformat`:
77
$ make_project_with_dev_tool_lockdir
88

99
Install ocamlformat as a dev tool:
10-
$ dune tools install ocamlformat
10+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools install ocamlformat
1111
Solution for dev-tools.locks/ocamlformat:
1212
- ocamlformat.0.26.2
1313

1414
Verify that ocamlformat is installed:
15-
$ dune tools which ocamlformat
15+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools which ocamlformat
1616
_build/_private/default/.dev-tool/ocamlformat/ocamlformat/target/bin/ocamlformat

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-which.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ Update ".ocamlformat" file with unknown version of OCamlFormat.
1212
> EOF
1313

1414
The command will fail because the dev tool is not installed:
15-
$ dune tools which ocamlformat
15+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools which ocamlformat
1616
Error: ocamlformat is not installed as a dev tool
1717
[1]
1818

1919
$ dune tools which ocamlformat --allow-not-installed
2020
_build/_private/default/.dev-tool/ocamlformat/ocamlformat/target/bin/ocamlformat
2121

2222
Install the dev tool:
23-
$ dune tools exec ocamlformat
23+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamlformat
2424
Solution for dev-tools.locks/ocamlformat:
2525
- ocamlformat.0.26.2
2626
Running 'ocamlformat'
2727
formatted with version 0.26.2
2828

2929
Now the command will succeed because the tool has been installed:
30-
$ dune tools which ocamlformat
30+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools which ocamlformat
3131
_build/_private/default/.dev-tool/ocamlformat/ocamlformat/target/bin/ocamlformat
3232

3333
Make sure the file is actually there:

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-wrapper.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Exercise running the ocamlformat wrapper command.
77
$ make_ocamlformat_opam_pkg "0.26.2"
88
$ make_project_with_dev_tool_lockdir
99

10-
$ dune tools exec ocamlformat
10+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamlformat
1111
Solution for dev-tools.locks/ocamlformat:
1212
- ocamlformat.0.26.2
1313
Running 'ocamlformat'

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-basic.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ a lockdir containing an "ocaml" lockfile.
2424
> (version 5.2.0)
2525
> EOF
2626

27-
$ dune tools exec ocamllsp
27+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp
2828
Solution for dev-tools.locks/ocaml-lsp-server:
2929
- ocaml.5.2.0
3030
- ocaml-lsp-server.0.0.1

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-env-path-var.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Make a fake ocamllsp package that prints out the PATH variable:
2323
> EOF
2424

2525
Confirm that each dev tool's bin directory is now in PATH:
26-
$ dune tools exec ocamllsp | tr : '\n' | grep '_build/_private/default/.dev-tool'
26+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp | tr : '\n' | grep '_build/_private/default/.dev-tool'
2727
Solution for dev-tools.locks/ocaml-lsp-server:
2828
- ocaml.5.2.0
2929
- ocaml-lsp-server.0.0.1

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-no-ocaml-lockfile.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ doesn't contain a lockfile for the "ocaml" package.
1313

1414
$ make_lockdir
1515

16-
$ dune tools exec ocamllsp
16+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp
1717
Error: The lockdir doesn't contain a lockfile for the package "ocaml".
1818
Hint: Add a dependency on "ocaml" to one of the packages in dune-project and
1919
then run 'dune pkg lock'

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-ocamlformat.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Make a fake ocamlformat
4343
> (version 5.2.0)
4444
> EOF
4545

46-
$ dune tools install ocamlformat
46+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools install ocamlformat
4747
Solution for dev-tools.locks/ocamlformat:
4848
- ocamlformat.0.0.1
4949

50-
$ dune tools exec ocamllsp
50+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp
5151
Solution for dev-tools.locks/ocaml-lsp-server:
5252
- ocaml.5.2.0
5353
- ocaml-lsp-server.0.0.1

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-relock-on-ocaml-version-change.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ same version of the ocaml compiler as the code that it's analyzing.
2828
> EOF
2929

3030
Initially ocamllsp will be depend on ocaml.5.2.0 to match the project.
31-
$ dune tools exec ocamllsp
31+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp
3232
Solution for dev-tools.locks/ocaml-lsp-server:
3333
- ocaml.5.2.0
3434
- ocaml-lsp-server.0.0.1
@@ -38,7 +38,7 @@ Initially ocamllsp will be depend on ocaml.5.2.0 to match the project.
3838
(version 5.2.0)
3939

4040
We can re-run "dune tools exec ocamllsp" without relocking or rebuilding.
41-
$ dune tools exec ocamllsp
41+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp
4242
Running 'ocamllsp'
4343
hello from fake ocamllsp
4444

@@ -49,7 +49,7 @@ Change the version of ocaml that the project depends on.
4949

5050
Running "dune tools exec ocamllsp" causes ocamllsp to be relocked and rebuilt
5151
before running. Ocamllsp now depends on ocaml.5.1.0.
52-
$ dune tools exec ocamllsp
52+
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune tools exec ocamllsp
5353
The version of the compiler package ("ocaml") in this project's lockdir has
5454
changed to 5.1.0 (formerly the compiler version was 5.2.0). The dev-tool
5555
"ocaml-lsp-server" will be re-locked and rebuilt with this version of the

0 commit comments

Comments
 (0)