Skip to content

Additions to ocamltest#12127

Open
richardlford wants to merge 1 commit intoocaml:trunkfrom
richardlford:ocamltest-additions
Open

Additions to ocamltest#12127
richardlford wants to merge 1 commit intoocaml:trunkfrom
richardlford:ocamltest-additions

Conversation

@richardlford
Copy link
Copy Markdown
Contributor

This is part 2 of a larger PR, #12085, which includes part 1 (compiler and debugger changes), this part, and a third part which is tests of part 1 that make use of (and hence motivate and test) these changes. Please see that PR for example uses of these changes.

  1. Add the ability to have scripts or files with ocamltest variables references expanded. Added a new "expand" action to camltest. It is mostly like the "copy" action, but the source file is read a line at a time and the lines are expanded. It does not support source directories, but the destination can be a directory.

  2. Enhanced ocamltest to have a facility for making built-in functions. These are like ocamltest variables but have a function attached to them, and when the variable is expanded, the arguments are first expanded and then the function is called and its result is returned. Currently they only take one parameter, but it should not be too hard to add the ability to have multiple arguments.

  3. Added a new "dumpenv_expanded" action which not only shows the value of each variable but also what they expand to. When variables are originally assigned, their RHS is not expanded, but only later when the variable itself is looked up.

  4. Two builtin functions were defined:

  • bppm_decode does BUILD_PATH_PREFIX_MAP decoding

  • bppm_encode does BUILD_PATH_PREFIX_MAP encoding

See https://reproducible-builds.org/specs/build-path-prefix-map/ and richardlford/build-path-prefix-map-spec#1.

  1. Prepare to be able to do Dune tests:

5a. Added an action helper for testing if a program is available in PATH.

5b. Use the helper to make an action, has_dune,
that detects whether dune is available.

@richardlford
Copy link
Copy Markdown
Contributor Author

@shindere, could you please review these changes?

@shindere
Copy link
Copy Markdown
Contributor

shindere commented Mar 21, 2023 via email

@richardlford
Copy link
Copy Markdown
Contributor Author

Please, be sure that (1) I'll do it as soon as I can and (2) it's not necessary to pingme.

OK. Thanks.

@richardlford
Copy link
Copy Markdown
Contributor Author

Since I first submitted the PR there have been minor corrections. This now is a squashed and rebased version.

This is part 2 of a larger PR, ocaml#12085, which includes a part 1
(compiler and debugger changes), this part, and a third part which is
tests of part 1 that make use of (and hence motivate and test) these
changes. Please see that PR for example uses of these changes.

1. Add the ability to have scripts or files with ocamltest variables
references expanded. Added a new "expand" action to ocamltest. It is
mostly like the "copy" action, but the source file is read a line at a
time and the lines are expanded. It does not support source
directories, but the destination can be a directory.

2. Enhanced ocamltest to have a facility for making builtin
functions. These are like ocamltest variables but have a function
attached to them, and when the variable is expanded, the arguments are
first expanded and then the function is called and its result is
returned. Currently they only take one parameter, but it should not be
too hard to add the ability to have multiply arguments.

3. Added a new "dumpenv_expanded" action which not
only shows the value of each variable, but also what
they expand to. When variables are originally
assigned, their RHS is not expanded, but only
later when the variable itself is looked up.

4. Two builtin functions were defined:

- bppm_decode does BUILD_PATH_PREFIX_MAP decoding

- bppm_encode does BUILD_PATH_PREFIX_MAP encoding

See https://reproducible-builds.org/specs/build-path-prefix-map/

5. Prepare to be able to do Dune tests:

5a. Added a action helper for testing if a program
is available in PATH.

5b. Use the helper to make an action, has_dune,
that detects whether dune is available.
@richardlford richardlford force-pushed the ocamltest-additions branch from 9ce6612 to 221015f Compare May 18, 2023 18:24
@richardlford
Copy link
Copy Markdown
Contributor Author

@shindere, I see that since I created this PR you created a new test syntax and converted the test base to use it. I like the new syntax and think it is easier to understand. I've converted the tests in this PR to the new syntax (using your handy -translate option) and rebased. In addition, for your reference, #12126 makes use of some of the new features that are not covered by these tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants