diff --git a/master_changes.md b/master_changes.md index 65e46b140c3..4dbf1226680 100644 --- a/master_changes.md +++ b/master_changes.md @@ -106,6 +106,7 @@ users) * Move local-cache into archive-field-checks test [#5560 @rjbou] ### Engine + * Reimplement `sed-cmd` command regexp, to handle prefixed commands with path not only in subprocess, but anywere in output [#5657 @rjbou] ## Github Actions * Add coreutils install for cheksum validation tests [#5560 @rjbou] diff --git a/tests/reftests/assume-built.test b/tests/reftests/assume-built.test index 81f4fb9f0b9..91cfc4379a7 100644 --- a/tests/reftests/assume-built.test +++ b/tests/reftests/assume-built.test @@ -33,14 +33,14 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 2/3: [ongoing: test ongoing.txt] -test "-f" "ongoing.txt" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) ++ test "-f" "ongoing.txt" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) Processing 2/3: [ongoing: sh cat ongoing.txt > out] -sh "-c" "cat ongoing.txt > out" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) ++ sh "-c" "cat ongoing.txt > out" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) -> compiled ongoing.dev Processing 3/3: [ongoing: test out] -test "-f" "out" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) ++ test "-f" "out" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) Processing 3/3: [ongoing: touch installed] -touch "installed" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) ++ touch "installed" (CWD=${BASEDIR}/OPAM/assume-built/.opam-switch/build/ongoing.dev) -> installed ongoing.dev Done. ### opam remove ongoing @@ -67,7 +67,7 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 3/3: [ongoing: test out] -test "-f" "out" (CWD=${BASEDIR}/ongoing) ++ test "-f" "out" (CWD=${BASEDIR}/ongoing) [ERROR] The installation of ongoing failed at "test -f out". @@ -97,9 +97,9 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 3/3: [ongoing: test out] -test "-f" "out" (CWD=${BASEDIR}/ongoing) ++ test "-f" "out" (CWD=${BASEDIR}/ongoing) Processing 3/3: [ongoing: touch installed] -touch "installed" (CWD=${BASEDIR}/ongoing) ++ touch "installed" (CWD=${BASEDIR}/ongoing) -> installed ongoing.dev Done. ### test -f ./ongoing/installed @@ -160,9 +160,9 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> Processing 2/2: [ongoing: test out2] -test "-f" "out2" (CWD=${BASEDIR}/ongoing) ++ test "-f" "out2" (CWD=${BASEDIR}/ongoing) Processing 2/2: [ongoing: touch installed] -touch "installed" (CWD=${BASEDIR}/ongoing) ++ touch "installed" (CWD=${BASEDIR}/ongoing) -> installed ongoing.dev Done. ### test -f ./ongoing/installed diff --git a/tests/reftests/autopin.test b/tests/reftests/autopin.test index 2f3c650f63e..7f6e3aba571 100644 --- a/tests/reftests/autopin.test +++ b/tests/reftests/autopin.test @@ -65,7 +65,7 @@ opam believes some required external dependencies are missing. opam can: [1/2/3/4] 1 -echo "some-depext" ++ echo "some-depext" - some-depext <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> @@ -112,7 +112,7 @@ opam believes some required external dependencies are missing. opam can: [1/2/3/4] 1 -echo "some-depext" ++ echo "some-depext" - some-depext <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> @@ -156,7 +156,7 @@ opam believes some required external dependencies are missing. opam can: [1/2/3/4] 1 -echo "some-depext" ++ echo "some-depext" - some-depext <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> @@ -208,7 +208,7 @@ opam believes some required external dependencies are missing. opam can: [1/2/3/4] 1 -echo "some-depext" ++ echo "some-depext" - some-depext <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> @@ -241,7 +241,7 @@ The following system packages will first need to be installed: <><> Handling external dependencies <><><><><><><><><><><><><><><><><><><><><><> -echo "some-depext" ++ echo "some-depext" - some-depext ### opam remove foo-format | grep -v import [WARNING] Opam package foo-format.2.0 depends on the following system package that can no longer be found: some-depext @@ -317,6 +317,6 @@ opam believes some required external dependencies are missing. opam can: [1/2/3/4] 1 -echo "some-depext" ++ echo "some-depext" - some-depext Nothing to do. diff --git a/tests/reftests/depexts.test b/tests/reftests/depexts.test index 22d47fbb9cc..71e3edd9b27 100644 --- a/tests/reftests/depexts.test +++ b/tests/reftests/depexts.test @@ -25,7 +25,7 @@ opam believes some required external dependencies are missing. opam can: [1/2/3/4] 1 -false ++ false [ERROR] System package install failed with exit code 1 at command: false [ERROR] These packages are still missing: depext-1 diff --git a/tests/reftests/inplace.test b/tests/reftests/inplace.test index 600535c0c26..3f1877202e7 100644 --- a/tests/reftests/inplace.test +++ b/tests/reftests/inplace.test @@ -32,13 +32,13 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 2/3: [ongoing: test ongoing.txt] -test "-f" "ongoing.txt" (CWD=${BASEDIR}/OPAM/inplace/.opam-switch/build/ongoing.dev) ++ test "-f" "ongoing.txt" (CWD=${BASEDIR}/OPAM/inplace/.opam-switch/build/ongoing.dev) Processing 2/3: [ongoing: cat ongoing.txt] -cat "ongoing.txt" (CWD=${BASEDIR}/OPAM/inplace/.opam-switch/build/ongoing.dev) ++ cat "ongoing.txt" (CWD=${BASEDIR}/OPAM/inplace/.opam-switch/build/ongoing.dev) - versionned -> compiled ongoing.dev Processing 3/3: [ongoing: touch installed] -touch "installed" (CWD=${BASEDIR}/OPAM/inplace/.opam-switch/build/ongoing.dev) ++ touch "installed" (CWD=${BASEDIR}/OPAM/inplace/.opam-switch/build/ongoing.dev) -> installed ongoing.dev Done. ### test -f ./ongoing/installed @@ -65,13 +65,13 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 2/3: [ongoing: test ongoing.txt] -test "-f" "ongoing.txt" (CWD=${BASEDIR}/ongoing) ++ test "-f" "ongoing.txt" (CWD=${BASEDIR}/ongoing) Processing 2/3: [ongoing: cat ongoing.txt] -cat "ongoing.txt" (CWD=${BASEDIR}/ongoing) ++ cat "ongoing.txt" (CWD=${BASEDIR}/ongoing) - versionned -> compiled ongoing.dev Processing 3/3: [ongoing: touch installed] -touch "installed" (CWD=${BASEDIR}/ongoing) ++ touch "installed" (CWD=${BASEDIR}/ongoing) -> installed ongoing.dev Done. ### test -f ./ongoing/installed @@ -102,13 +102,13 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> Processing 1/2: [ongoing: test newfile.txt] -test "-f" "newfile.txt" (CWD=${BASEDIR}/ongoing) ++ test "-f" "newfile.txt" (CWD=${BASEDIR}/ongoing) Processing 1/2: [ongoing: cat newfile.txt] -cat "newfile.txt" (CWD=${BASEDIR}/ongoing) ++ cat "newfile.txt" (CWD=${BASEDIR}/ongoing) - new! -> compiled ongoing.dev Processing 2/2: [ongoing: touch installed] -touch "installed" (CWD=${BASEDIR}/ongoing) ++ touch "installed" (CWD=${BASEDIR}/ongoing) -> installed ongoing.dev Done. ### test -f ./ongoing/installed diff --git a/tests/reftests/parallel.test b/tests/reftests/parallel.test index e036f961b2b..19aea09517c 100644 --- a/tests/reftests/parallel.test +++ b/tests/reftests/parallel.test @@ -42,23 +42,23 @@ The following actions will be performed: - install qux 1 <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -sh "sleep.sh" "bar" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/bar.1) -- woke up bar -> compiled bar.1 -> installed bar.1 -sh "sleep.sh" "baz" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/baz.1) -- woke up baz ++ sh "sleep.sh" "bar" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/bar.1) +- woke up bar -> compiled baz.1 -> installed baz.1 -sh "sleep.sh" "foo" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/foo.1) ++ sh "sleep.sh" "baz" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/baz.1) +- woke up baz -> compiled foo.1 -> installed foo.1 -sh "sleep.sh" "qux" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/qux.1) ++ sh "sleep.sh" "foo" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/foo.1) -> compiled qux.1 -> installed qux.1 -sh "shout.sh" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/top.1) ++ sh "sleep.sh" "qux" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/qux.1) -> compiled top.1 -sh "shout.sh" "top" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/top.1) ++ sh "shout.sh" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/top.1) ++ sh "shout.sh" "top" (CWD=${BASEDIR}/OPAM/parallel/.opam-switch/build/top.1) - finally installed top -> installed top.1 Done. diff --git a/tests/reftests/reinstall.test b/tests/reftests/reinstall.test index 6bb760e4d1f..b346792407d 100644 --- a/tests/reftests/reinstall.test +++ b/tests/reftests/reinstall.test @@ -46,14 +46,14 @@ Nothing to do. opam-version: "2.0" build: ["opam" "var" "switch"] depends: ["b" {= version}] -### opam upgrade -y --verbose | '^\+ .+ "build"' -> '+' | '^\+ .+opam(\.exe)? ' -> '+ "opam" ' +### opam upgrade -y --verbose | sed-cmd opam The following actions will be performed: === recompile 1 package - recompile a 1 [upstream or system changes] <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> Processing 2/4: [a: opam var] -+ "opam" "var" "switch" (CWD=${BASEDIR}/OPAM/default/.opam-switch/build/a.1) ++ opam "var" "switch" (CWD=${BASEDIR}/OPAM/default/.opam-switch/build/a.1) - default -> compiled a.1 -> removed a.1 diff --git a/tests/reftests/repository.test b/tests/reftests/repository.test index cb248b62092..3e087df0333 100644 --- a/tests/reftests/repository.test +++ b/tests/reftests/repository.test @@ -6,15 +6,15 @@ build: ["test" "-f" "bar"] some content ### : Internal repository storage as archive or plain directory : ### opam switch create tarring --empty -### opam update -vv | grep '^\+' | sed-cmd diff | '.*(/|\\)patch(\.exe)?"?.*"' -> 'patch' -diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo) -patch (CWD=${BASEDIR}/OPAM/repo/default) +### opam update -vv | grep '^\+' | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch' ++ diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo) ++ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${BASEDIR}/OPAM/repo/default) ### ls $OPAMROOT/repo | grep -v "cache" default lock repos-config ### opam install foo.1 -vv | grep '^\+' | sed-cmd test -test "-f" "bar" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.1) ++ test "-f" "bar" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.1) ### opam repository add plain ./REPO --this-switch [plain] Initialised ### OPAMREPOSITORYTARRING=1 @@ -24,18 +24,18 @@ opam-version: "2.0" build: ["test" "-f" "baz"] ### some content -### opam update default -vv | grep '^\+' | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)default\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/default.tar.gz -C TMPDIR' | '.*tar(\.exe)?"? "cfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)default\.tar\.gz\.tmp" "-C" ".*" "default"' -> 'tar cfz OPAM/repo/default.tar.gz.tmp -C TMPDIR default' | sed-cmd diff | '.*(/|\\)patch(\.exe)?"?.*"' -> 'patch' -diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo) -patch (CWD=${BASEDIR}/OPAM/repo/default) -tar cfz OPAM/repo/default.tar.gz.tmp -C TMPDIR default +### opam update default -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch' ++ diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo) ++ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${BASEDIR}/OPAM/repo/default) ++ tar "cfz" "${BASEDIR}/OPAM/repo/default.tar.gz.tmp" "-C" "${BASEDIR}/OPAM/repo" "default" ### ls $OPAMROOT/repo | grep -v "cache" default.tar.gz lock plain repos-config -### opam install foo.2 -vv | grep '^\+' | sed-cmd test | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)default\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/default.tar.gz -C TMPDIR' -tar xfz OPAM/repo/default.tar.gz -C TMPDIR -test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.2) +### opam install foo.2 -vv | grep '^\+' | sed-cmd test | sed-cmd tar ++ tar "xfz" "${BASEDIR}/OPAM/repo/default.tar.gz" "-C" "${OPAMTMP}" ++ test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.2) ### opam repository remove default --all ### : Add tarred repo (tarred) ### @@ -51,9 +51,9 @@ lock plain repos-config tarred.tar.gz -### opam install foo.3 -vv | grep '^\+' | sed-cmd test | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)tarred\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR' -tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR -test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.3) +### opam install foo.3 -vv | grep '^\+' | sed-cmd test | sed-cmd tar ++ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}" ++ test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.3) ### opam repository remove plain --all ### : Update tarred repo (tarred) ### @@ -61,14 +61,14 @@ opam-version: "2.0" build: ["test" "-f" "baz"] ### some content -### opam update -vv | grep '^\+' | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)tarred\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR' | '.*tar(\.exe)?"? "cfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)tarred\.tar\.gz\.tmp" "-C" ".*" "tarred"' -> 'tar cfz OPAM/repo/tarred.tar.gz.tmp -C TMPDIR tarred' | sed-cmd diff | '.*(/|\\)patch(\.exe)?"?.*"' -> 'patch' -tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR -diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP}) -patch (CWD=${OPAMTMP}/tarred) -tar cfz OPAM/repo/tarred.tar.gz.tmp -C TMPDIR tarred -### opam install foo.4 -vv | grep '^\+' | sed-cmd test | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)tarred\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR' -tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR -test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.4) +### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch' ++ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}" ++ diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP}) ++ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${OPAMTMP}/tarred) ++ tar "cfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz.tmp" "-C" "${OPAMTMP}" "tarred" +### opam install foo.4 -vv | grep '^\+' | sed-cmd test | sed-cmd tar ++ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}" ++ test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.4) ### mkdir tarred-ext ### tar xf OPAM/repo/tarred.tar.gz ### diff -ru ./tarred REPO @@ -83,12 +83,12 @@ opam-version: "2.0" build: ["test" "-f" "quux"] ### some content -### opam update -vv | grep '^\+' | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)tarred\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR' | sed-cmd diff | '.*(/|\\)patch(\.exe)?"?.*"' -> 'patch' -tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR -diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP}) -patch (CWD=${OPAMTMP}/tarred) -### opam install foo.5 -vv | grep '^\+' | sed-cmd test | '.*tar(\.exe)?"? "xfz" ".*(/|\\)OPAM(/|\\)repo(/|\\)tarred\.tar\.gz" "-C" ".*"' -> 'tar xfz OPAM/repo/tarred.tar.gz -C TMPDIR' -test "-f" "quux" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.5) +### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch' ++ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}" ++ diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP}) ++ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${OPAMTMP}/tarred) +### opam install foo.5 -vv | grep '^\+' | sed-cmd test ++ test "-f" "quux" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.5) ### ls $OPAMROOT/repo | grep -v "cache" lock repos-config @@ -294,7 +294,7 @@ opam-version: "2.0" # Name # Installed # Synopsis first -- ### ::: rsync - git ::: -### opam repository set-url oper git+file://$BASEDIR/OPER4 | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER # Return code 40 # @@ -302,7 +302,7 @@ first -- # Packages matching: from-repository(oper) & available # Name # Installed # Synopsis first -- -### opam repository set-url oper git+file://./OPER3#unknownbranch | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to file://${BASEDIR}/OPER # Return code 40 # @@ -333,7 +333,7 @@ first -- # Name # Installed # Synopsis first -- ### ::: git - git ::: -### opam repository set-url oper git+file://$BASEDIR/OPER4 | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER # Return code 40 # @@ -341,7 +341,7 @@ first -- # Packages matching: from-repository(oper) & available # Name # Installed # Synopsis first -- -### opam repository set-url oper git+file://./OPER3#unknownbranch | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to git+file://${BASEDIR}/OPER # Return code 40 # @@ -460,7 +460,7 @@ opam-version: "2.0" # Name # Installed # Synopsis first -- ### :::: rsync - git :::: -### opam repository set-url oper git+file://$BASEDIR/OPER4 | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER # Return code 40 # @@ -468,7 +468,7 @@ first -- # Packages matching: from-repository(oper) & available # Name # Installed # Synopsis first -- -### opam repository set-url oper git+file://./OPER3#unknownbranch | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to file://${BASEDIR}/OPER # Return code 40 # @@ -499,7 +499,7 @@ first -- # Name # Installed # Synopsis first -- ### :::: git - git :::: -### opam repository set-url oper git+file://$BASEDIR/OPER4 | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER # Return code 40 # @@ -507,7 +507,7 @@ first -- # Packages matching: from-repository(oper) & available # Name # Installed # Synopsis first -- -### opam repository set-url oper git+file://./OPER3#unknownbranch | ': ".*git(.exe)?' -> ': "git' +### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git [ERROR] Could not update repository "oper": "git fetch -q" exited with code 128 [ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to git+file://${BASEDIR}/OPER # Return code 40 # diff --git a/tests/reftests/run.ml b/tests/reftests/run.ml index 30376afb6c7..03e2d2c4f09 100644 --- a/tests/reftests/run.ml +++ b/tests/reftests/run.ml @@ -421,18 +421,59 @@ module Parse = struct | "|" :: "unordered" :: r -> get_rewr (true, acc) r | "|" :: "sed-cmd" :: cmd :: r -> - let re = + let sandbox = + (* Sandbox prefix + >[...] /tmp/build_592d92_dune/opam-reftest-2b89f9/OPAM/opam-init/hooks/sandbox.sh "build" "cmd" < + >[...] ${BASEDIR}/opam-init/hooks/sandbox.sh "build" "cmd" < + --> + >[...] cmd < + *) seq [ - Re.str "+ "; - rep any; - alt [ set "/\\\"" ]; + alt [ char '/'; Re.str "${" ]; + non_greedy @@ rep1 any; Re.str "sandbox.sh"; + space; + char '"'; + alt @@ List.map Re.str [ "build"; "install"; "remove" ]; + char '"'; + space; + char '"'; Re.str cmd; char '"'; + space; + ] + in + let with_quote_set s = set ("\"'"^s) in + let opt_quoted r = [ + seq @@ [ char '"'] @ r @ [ char '"'; rep1 space ]; + seq @@ r @ [ rep1 space ]; + ] in + let unix_prefix = + (* Unix & Mac command prefix + >[...] /usr/bin/cmd < + >[...] /usr/bin/cmd < + --> + >[...] cmd < + *) + opt_quoted @@ [ + rep1 @@ seq [ char '/'; rep1 @@ diff any (with_quote_set "/ ") ]; + char '/'; Re.str cmd; - opt @@ Re.str ".exe"; - opt @@ char '"'; - Re.str " " ] -(* Printf.sprintf "+ .*(/|\\\\|\")%s(\\.exe)?\"? " cmd *) - in + in + let win_prefix = + (* Windows command prefix + >[...] C:\Windows\system32\cmd.exe < + >[...] C:\Windows\system32\cmd < + >[...] C:\Windows\system 32\cmd < + --> + >[...] cmd < + *) + opt_quoted @@ [ + alpha; char ':'; + rep1 @@ seq [ char '\\'; rep1 @@ diff any (with_quote_set "\\") ]; + char '\\'; + Re.str cmd; + opt @@ Re.str ".exe"; + ] in + let re = alt @@ sandbox :: unix_prefix @ win_prefix in let str = Printf.sprintf "%s " cmd in get_rewr (unordered, (re, Sed str) :: acc) r | ">$" :: output :: [] -> diff --git a/tests/reftests/working-dir.test b/tests/reftests/working-dir.test index 570dacbbde8..f432c25193f 100644 --- a/tests/reftests/working-dir.test +++ b/tests/reftests/working-dir.test @@ -51,9 +51,9 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 2/3: [ongoing: test ongoing.txt] -test "-f" "ongoing.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ test "-f" "ongoing.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) Processing 2/3: [ongoing: cat ongoing.txt] -cat "ongoing.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ cat "ongoing.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) - versionned -> compiled ongoing.dev -> installed ongoing.dev @@ -71,9 +71,9 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> Processing 1/3: [ongoing: test newfile.txt] -test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) Processing 1/3: [ongoing: cat newfile.txt] -cat "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ cat "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) - new! -> compiled ongoing.dev -> removed ongoing.dev @@ -105,7 +105,7 @@ The following actions will be performed: Processing 1/3: [ongoing.dev: git] -> retrieved ongoing.dev (no changes) Processing 2/3: [ongoing: test newfile.txt] -test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) [ERROR] The compilation of ongoing.dev failed at "test -f newfile.txt". @@ -130,9 +130,9 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> Processing 1/2: [ongoing: test newfile.txt] -test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) Processing 1/2: [ongoing: cat newfile.txt] -cat "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ cat "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) - new! -> compiled ongoing.dev -> installed ongoing.dev @@ -215,13 +215,13 @@ The following actions will be performed: - install qux 4 <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++ test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ cat "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) ++ test "-f" "present" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/qux.4) -> retrieved qux.4 (file://${BASEDIR}/qux) -test "-f" "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) -cat "newfile.txt" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/ongoing.dev) - new! -> compiled ongoing.dev -> installed ongoing.dev -test "-f" "present" (CWD=${BASEDIR}/OPAM/working-dir/.opam-switch/build/qux.4) -> compiled qux.4 -> installed qux.4 Done.