-
Notifications
You must be signed in to change notification settings - Fork 371
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 reftests and add some readme files #6184
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Opam test suite | ||
|
||
There is 3 different kind of tests | ||
* CRAM test in `reftests`. It is used to check opam behaviour. See | ||
`reftests/readme.md` for more details. | ||
* Bench tests in `bench`, using | ||
[current-bench](https://github.com/ocurrent/current-bench). It is used to | ||
benchmark some specific operations. | ||
* OCaml tests in `lib`. For the moment it is used to check some type | ||
manipulation and patch code. | ||
|
||
There is also other tests: | ||
* [`opam-rt`](https://github.com/ocaml-opam/opam-rt): historical test suite. it | ||
is a mix of opam cli calls and library usage. It is meant to be removed once | ||
all test has been ported to `reftests` and `lib` | ||
* [`opam-crowbar`](https://github.com/ocaml/opam/blob/master/src/crowbar/opam-crowbar.opam): | ||
some fuzz testing of some opam library main types. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Simple CRAM-like test framework for opam tests. | ||
|
||
## Features and format | ||
|
||
### General view | ||
|
||
A reftest looks like | ||
``` | ||
REPO_HASH | ||
### opam command | ||
output line 1 | ||
output... | ||
### <filename> | ||
contents... | ||
### opam command | ||
output... | ||
### ENV_VAR=x opam command | ||
output... | ||
``` | ||
|
||
- its first line is | ||
* the git hash of the opam repository to use, an opamroot is already | ||
initialised with that repo as "default" | ||
* or N0REP0 if there are no dependencies on opam repository. In this case, an opamroot is | ||
already initialised with an empty `default` repository in `./REPO` | ||
directory, that you need to populate | ||
- 'opam' is automatically redirected to the correct binary | ||
- the command prefix is `### ` | ||
- comments have the following syntax: `### : comment` | ||
|
||
### File creation | ||
|
||
- use `### <FILENAME>` followed by the content of the file, to create a file verbatim | ||
- use `### <pkg:NAME.VERSION>` followed by the content of an opam file, to | ||
add this package to `default` repository in `./REPO`. This will also implicitly run `opam update default` | ||
- use `### <pkg:NAME.VERSION:FILENAME>` followed by the content of the file, to add this | ||
file as a extra-file of the given package in the `default` repository, and | ||
implicitely run `opam update default` | ||
- use `### <pin:path>` followed by the content of an opam file, to have some | ||
fields automatically filled to be able to pin it without lint errors | ||
|
||
### Commands to run | ||
|
||
- `### FOO=x BAR=y` to export variables for subsequent commands | ||
- shell-like command handling: | ||
* **NO pattern expansion, shell pipes, sequences or redirections** | ||
rjbou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* **Each `$VARIABLE` expansion is one argument unlike POSIX shell. So `rm $VARIABLE` will always remove one file, not several** | ||
* `FOO=x BAR=y command` | ||
* Arguments can be quoted: eg `"foo\"bar"`, `'foo\bar'`, but not combined | ||
(`foo'bar'` is not translated to `foobar`) | ||
* Variable expansion in arguments (`$FOO` or `${FOO}`). Undefined variables | ||
are left as-is | ||
* There is some rewrite functions available: | ||
* `| 'REGEXP' -> 'STR'` (can be repeated; set `STR` to `\c` to | ||
clear the line) | ||
* `| grep REGEXP` | ||
* `| grep -v REGEXP` | ||
* `| unordered` compares lines without considering their ordering | ||
* `| sort` sorts output | ||
* `| sed-cmd command` replaces full path resolved command by `command` | ||
* variables from command outputs: `cmd args >$ VAR` | ||
- additional commands | ||
* `opam-cat file`: prints a normalised opam file | ||
* `json-cat file`: print a human readable opam output json file, with | ||
replacement of some duration and temporary files names. meant to be used | ||
on opam generated json files. | ||
|
||
- if you need more shell power, create a script using <FILENAME> then run it. | ||
Or just use `sh -c`... but beware for compatibility. | ||
|
||
The opam roots are generated using dynamically generated dune rules (see | ||
gen.ml and dune.inc), then the tests are run using this script. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readme.md or README.md