Skip to content

Commit

Permalink
Merge pull request #4913 from rjbou/rftst
Browse files Browse the repository at this point in the history
updates on reftests
  • Loading branch information
rjbou authored Nov 23, 2021
2 parents 0a247e1 + 772cd93 commit 87fb868
Show file tree
Hide file tree
Showing 9 changed files with 326 additions and 286 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ reftest-%: $(DUNE_DEP) src/client/no-git-version
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest-$* --force

reftests-meld:
meld `for t in tests/reftests/*.test; do echo --diff $$t _build/default/$${t%.test}.out; done`
meld `for t in tests/reftests/*.test; do \
out=_build/default/$${t%.test}.out; \
if test -f $$out && ! diff -q $$t $$out 2> /dev/null > /dev/null; then \
echo --diff $$t $$out; \
fi; done`

.PHONY: doc
doc: all
Expand Down
12 changes: 11 additions & 1 deletion master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,18 @@ users)
* Add switch-invariant test [#4866 @rjbou]
* opam root version: add local switch cases [#4763 @rjbou] [2.1.0~rc2 #4715]
* opam root version: add reinit test casess [#4763 @rjbou] [2.1.0~rc2 #4750]
* Add `opam-cat` to normalise opam file printing [#4763 @rjbou @dra27] [2.1.0~rc2 #4715]
* Add & update env tests [#4861 #4841 @rjbou @dra27]
* Add `opam-cat` to normalise opam file printing [#4763 @rjbou @dra27] [2.1.0~rc2 #4715]
* Fix meld reftest: open only with failing ones [#4913 @rjbou]
* Add `BASEDIR` to environement [#4913 @rjbou]
* Replace opam bin path [#4913 @rjbou]
* Add `grep -v` command [#4913 @rjbou]
* Apply grep & seds on file order [#4913 @rjbou]
* Precise `OPAMTMP` regexp, `hexa` instead of `'alphanum` to avoid confusion with `BASEDIR` [#4913 @rjbou]
* Hackish way to have several replacement in a single line [#4913 @rjbou]
* Substitution in regexp pattern (for environment variables) [#4913 @rjbou]
* Substitution for opam-cat content [#4913 @rjbou]


## Github Actions
* Add solver backends compile test [#4723 @rjbou] [2.1.0~rc2 #4720]
Expand Down
2 changes: 1 addition & 1 deletion src/state/opamStateConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ let load_if_possible_raw ?lock_kind root version (read,read_wo_err) f =
opam (%s > %s), aborting."
(OpamFilename.Dir.to_string root)
(OpamStd.Option.to_string OpamVersion.to_string version)
OpamVersion.(to_string current_nopatch)
OpamVersion.(to_string OpamFile.Config.root_version)
| Some true -> read_wo_err f
| Some false -> read f

Expand Down
43 changes: 15 additions & 28 deletions tests/reftests/cli-versioning.test
Original file line number Diff line number Diff line change
Expand Up @@ -90,64 +90,51 @@ opam: lock was added in version 2.1 of the opam CLI, but version 2.0 has been re
### # Check for build test env
### # Note: you must have an installed opam with cli version enabled to pass these tests
### OPAMSHOW=0
### <opams/env-2-0.opam>
### <pkg:env-2-0.1>
opam-version: "2.0"
build: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.0'"]
install: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.0'"]
remove: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.0'"]
### <opams/env-2-1.opam>
### <pkg:env-2-1.1>
opam-version: "2.0"
build-env: [OPAMCLI = "2.1"]
build: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.1'"]
install: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.1'"]
remove: ["sh" "-c" "env | grep -qFx 'OPAMCLI=2.1'"]
### opam pin opams -yn
This will pin the following packages: env-2-0, env-2-1. Continue? [Y/n] y
Package env-2-0 does not exist, create as a NEW package? [Y/n] y
env-2-0 is now pinned to file://${BASEDIR}/opams (version ~dev)
Package env-2-1 does not exist, create as a NEW package? [Y/n] y
env-2-1 is now pinned to file://${BASEDIR}/opams (version ~dev)
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch set-invariant --formula "[]"
The switch invariant was set to []
### opam install env-2-0

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[env-2-0.~dev] synchronised (no changes)

The following actions will be performed:
- install env-2-0 ~dev*
- install env-2-0 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved env-2-0.~dev (file://${BASEDIR}/opams)
-> installed env-2-0.~dev
-> installed env-2-0.1
Done.
### opam install env-2-1

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[env-2-1.~dev] synchronised (no changes)

The following actions will be performed:
- install env-2-1 ~dev*
- install env-2-1 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved env-2-1.~dev (file://${BASEDIR}/opams)
-> installed env-2-1.~dev
-> installed env-2-1.1
Done.
### opam remove env-2-0
The following actions will be performed:
- remove env-2-0 ~dev*
- remove env-2-0 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved env-2-0.~dev (no changes)
-> removed env-2-0.~dev
-> removed env-2-0.1
Done.
### opam remove env-2-1
The following actions will be performed:
- remove env-2-1 ~dev*
- remove env-2-1 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved env-2-1.~dev (no changes)
-> removed env-2-1.~dev
-> removed env-2-1.1
Done.
### # Environement variables cli versioning
### OPAMBUILDDOC=1 opam var share
Expand Down
10 changes: 5 additions & 5 deletions tests/reftests/env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Switch invariant: ["nv"]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed nv.1
Done.
### opam env | grep "NV_VARS" | '[:;]' -> '-' | '[:;]' -> '-' | '[:;]' -> '-'
NV_VARS='${BASEDIR}/OPAM/setenv/doc/nv-${OPAMTMP}/OPAM/setenv/share/nv'- export NV_VARS-
### opam exec -- opam env --revert | grep "NV_VARS" | '[:;]' -> '-' | '[:;]' -> '-' | '[:;]' -> '-'
### opam env | grep "NV_VARS" | '[:;]' -> '-'
NV_VARS='${BASEDIR}/OPAM/setenv/doc/nv-${BASEDIR}/OPAM/setenv/share/nv'- export NV_VARS-
### opam exec -- opam env --revert | grep "NV_VARS" | '[:;]' -> '-'
NV_VARS=''- export NV_VARS-
### NV_VARS=/another/path
### opam env | grep "NV_VARS" | '[:;]' -> '-' | '[:;]' -> '-' | '[:;]' -> '-'
NV_VARS='${BASEDIR}/OPAM/setenv/doc/nv-${OPAMTMP}/OPAM/setenv/share/nv-/another/path'- export NV_VARS-
### opam env | grep "NV_VARS" | '[:;]' -> '-'
NV_VARS='${BASEDIR}/OPAM/setenv/doc/nv-${BASEDIR}/OPAM/setenv/share/nv-/another/path'- export NV_VARS-
### opam exec -- opam env --revert | grep "NV_VARS" | '[:;]' -> '-'
NV_VARS='/another/path'- export NV_VARS-
### : package variable available at install stage :
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/legacy-git.test
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ Switch invariant: ["ocaml" {= "system"}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed ocaml.system
Done.
### opam exec -- ocamlc -config | 'ext_lib: .' -> '#' | '^[^#].*' -> '\c' | '^#' -> '' >$ LIB_EXT
### opam exec -- ocamlc -config | '^#' -> '' | '^[^#].*' -> '\c' | 'ext_lib: .' -> '#' >$ LIB_EXT
### opam var ext_lib=$LIB_EXT --switch system | '.*' -> '\c'
### : INSTALL-REMOVE :
### opam list -is --columns=package
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/legacy-local.test
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ Switch invariant: ["ocaml" {= "system"}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed ocaml.system
Done.
### opam exec -- ocamlc -config | 'ext_lib: .' -> '#' | '^[^#].*' -> '\c' | '^#' -> '' >$ LIB_EXT
### opam exec -- ocamlc -config | '^#' -> '' | '^[^#].*' -> '\c' | 'ext_lib: .' -> '#' >$ LIB_EXT
### opam var ext_lib=$LIB_EXT --switch system | .* -> '\c'
### : INSTALL-REMOVE :
### opam list -is --columns=package
Expand Down
Loading

0 comments on commit 87fb868

Please sign in to comment.