Skip to content

Commit

Permalink
reftest: add sandbox scripts test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Aug 28, 2024
1 parent 6cbdfbb commit 87b1cf3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1532,6 +1532,27 @@
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:resolve-variables.test} %{read-lines:testing-env}))))

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

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

(rule
(targets sandbox.out)
(deps root-N0REP0)
(enabled_if (and (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.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.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 "^\(\\+\|-) " | '- .*opamMain.exe' -> '- opam' | 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)

0 comments on commit 87b1cf3

Please sign in to comment.