Skip to content
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

reftest: add sandbox test #6165

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,27 @@ users)

## Reftests
### Tests
* cli versioning: untie output from current major version [#6045 @rjbou]
* Set `opam-version` to 2.2 for some conflict message tests based on opam repository to stabilise their output [#6045 @rjbou]
* [BUG]: head -c is not posix compliant. Use cut -b instead. [#5989 @madroach]
* Add bad cudf package name encoding (dose3 lib) [#6055 @rjbou]
* Add test for filter operators in opam file [#5642 @rjbou]
* Update init test to make it no repo [#5327 @rjbou]
* Add a test in admin cache for hash cache [#6103 @rjbou]
* Add admin cache test [#6068 @rjbou]
* env: Add a test for `build-env` overwrites build env opam environment variables [#5377 @rjbou]
* clean: Add to check cleaning of sources directories [#5474 @rjbou]
* Add reftest for `--verbose-on` option [#5682 @rjbou]
* Add a test for --deps-only setting direct dependencies as root packages [#6125 @rjbou]
* Add a test file for `opam install --check` [#6121 @kit-ty-kate]
* Add reinstall test for delayed removal of packages [#6139 @rjbou]
* Add a test showing the behaviour of `opam list --latests-only` [#5375 @kit-ty-kate]
* Add a test filtering mechanism [#6105 @Keryan-dev]
* Add a package fetching test [#6146 @rjbou]
* Add a test showing the behaviour of `opam switch list-available` [#6098 @kit-ty-kate]
* Add a test for git packages with submodules [#6132 @kit-ty-kate]
* Add basic test for `install --check` [#6122 @rjbou]
* Add a sandbox usage test [#6165 @rjbou]

### Engine

Expand Down
21 changes: 21 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,27 @@
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:resolve-variables.test} %{read-lines:testing-env}))))

(rule
(alias reftest-sandbox.unix)
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
(action
(diff sandbox.unix.test sandbox.unix.out)))

(alias
(name reftest)
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
(deps (alias reftest-sandbox.unix)))

(rule
(targets sandbox.unix.out)
(deps root-N0REP0)
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
(package opam)
(action
(with-stdout-to
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:sandbox.unix.test} %{read-lines:testing-env}))))

(rule
(alias reftest-shared-fetch)
(enabled_if (and (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
Expand Down
35 changes: 35 additions & 0 deletions tests/reftests/sandbox.unix.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
N0REP0
### <pkg:echo.1>
opam-version: "2.0"
build: [ "echo" "SUCCESS" "|" "tee" "check-write" ]
### <pkg:option.1>
opam-version: "2.0"
build: [ "opam" "option" "jobs=4" "--cli=2.1"]
### <pkg:var.1>
opam-version: "2.0"
build: [ "opam" "config" "var" "prefix" ]
### <pkg:tmp.1>
opam-version: "2.0"
build: [ "sh" "-c" "echo > /tmp/ech" ]
### <pkg:tmpdir.1>
opam-version: "2.0"
build: [ "sh" "-c" "echo > $TMPDIR/ech" ]
### opam switch create sdbx --empty
### OPAMVERBOSE=2
### opam install echo | grep "^\(\\+\|-) " | sed-cmd echo
+ echo "SUCCESS" "|" "tee" "check-write" (CWD=${BASEDIR}/OPAM/sdbx/.opam-switch/build/echo.1)
- SUCCESS | tee check-write
### opam install option | grep "^\(\\+\|-) " | sed-cmd opam
+ opam "option" "jobs=4" "--cli=2.1" (CWD=${BASEDIR}/OPAM/sdbx/.opam-switch/build/option.1)
- 'opam option jobs=4 --cli=2.1' failed.
- Fatal error:
- ${OPAM}: "open" failed on ${BASEDIR}/OPAM/config.lock: Read-only file system
- No changes have been performed
# Return code 31 #
### opam install var | grep "^\(\\+\|-) " | sed-cmd opam
+ opam "config" "var" "prefix" (CWD=${BASEDIR}/OPAM/sdbx/.opam-switch/build/var.1)
- ${BASEDIR}/OPAM/sdbx
### opam install tmp | grep "^\(\\+\|-) " | sed-cmd sh
+ sh "-c" "echo > /tmp/ech" (CWD=${BASEDIR}/OPAM/sdbx/.opam-switch/build/tmp.1)
### opam install tmpdir | grep "^\(\\+\|-) " | sed-cmd sh
+ sh "-c" "echo > $TMPDIR/ech" (CWD=${BASEDIR}/OPAM/sdbx/.opam-switch/build/tmpdir.1)
Loading