Skip to content

Commit 0bdfa2e

Browse files
authored
Merge pull request #6675 from rjbou/reftest-sed-cmd
Reftest: update `sed-cmd`
2 parents e464f94 + d96ba24 commit 0bdfa2e

File tree

7 files changed

+783
-279
lines changed

7 files changed

+783
-279
lines changed

master_changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ users)
111111
## Internal
112112
* Replace every polymorphic uses of `List.mem` by a version that doesn't use `Repr.equal` [#6644 @kit-ty-kate]
113113
* Simplify the `src_ext/update-sources.sh` script [#6701 @kit-ty-kate]
114+
* Homogeneise verbose command output between sandboxed and non sandboxed one [#6675 @rjbou]
114115

115116
## Internal: Unix
116117

@@ -137,11 +138,14 @@ users)
137138
* Add a test showing the behaviour of version pins when one of the dependencies isn't up-to-date [#6691 @kit-ty-kate]
138139
* Add a test showing the behaviour of pre-defined variables in command hooks [#6659 @rjbou]
139140
* Add a test showing the behaviour of `opam var <pkg>:opamfile` [#6659 @kit-ty-kate]
141+
* Add a test to show homogeneity of outputs on verbose between sandboxed and non sandboxed commands (with `-vv`) [#6675 @rjbou]
142+
* Update `sed-cmd` reftest reftest [#6675 @rjbou]
140143

141144
### Engine
142145
* Fix gcc < 14.3 bug on mingw i686 [#6624 @kit-ty-kate]
143146
* Fix support for removing local link directories [#6450 @kit-ty-kate]
144147
* Bump `OPAM_REPO_SHA` in the github action workflows to allow patch 3.0.0 [#6663 @kit-ty-kate]
148+
* Allow `sed-cmd` to parse even if no space is after the command [#6675 @rjbou]
145149

146150
## Github Actions
147151
* bump `actions/checkout` from 4 to 5 [#6643 @kit-ty-kate]

src/core/opamProcess.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,15 @@ let dry_run_background c = {
580580
}
581581

582582
let verbose_print_cmd p =
583-
OpamConsole.msg "%s %s %s%s\n"
583+
let args =
584+
match p.p_args with
585+
| [] -> ""
586+
| args ->
587+
" " ^ OpamStd.List.concat_map " " (Printf.sprintf "%S") args
588+
in
589+
OpamConsole.msg "%s %s%s%s\n"
584590
(OpamConsole.colorise `yellow "+")
585-
p.p_name
586-
(OpamStd.List.concat_map " " (Printf.sprintf "%S") p.p_args)
591+
p.p_name args
587592
(if p.p_cwd = Sys.getcwd () then ""
588593
else Printf.sprintf " (CWD=%s)" p.p_cwd)
589594

tests/reftests/depexts.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ opam believes some required external dependencies are missing. opam can:
2525

2626
[1/2/3/4] 1
2727

28-
+ false
28+
+ false
2929
[ERROR] System package install failed with exit code 1 at command:
3030
false
3131
[ERROR] These packages are still missing: depext-1
@@ -210,7 +210,7 @@ opam believes some required external dependencies are missing. opam can:
210210

211211
[1/2/3/4] 1
212212

213-
+ false
213+
+ false
214214
[ERROR] System package install failed with exit code 1 at command:
215215
false
216216
[ERROR] These packages are still missing: depext-1 depext-avail depext-ok depext-unav
@@ -243,7 +243,7 @@ opam believes some required external dependencies are missing. opam can:
243243

244244
[1/2/3/4] 1
245245

246-
+ false
246+
+ false
247247
[ERROR] System package install failed with exit code 1 at command:
248248
false
249249
[ERROR] These packages are still missing: depext-1 depext-avail depext-unav
@@ -304,7 +304,7 @@ opam believes some required external dependencies are missing. opam can:
304304

305305
[1/2/3/4] 1
306306

307-
+ false
307+
+ false
308308
[ERROR] System package install failed with exit code 1 at command:
309309
false
310310
[ERROR] These packages are still missing: depext-1 depext-avail depext-ok depext-unav

tests/reftests/dune.inc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,27 @@
16161616
%{targets}
16171617
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:pin.test} %{read-lines:testing-env}))))
16181618

1619+
(rule
1620+
(alias reftest-process-output.unix)
1621+
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
1622+
(action
1623+
(diff process-output.unix.test process-output.unix.out)))
1624+
1625+
(alias
1626+
(name reftest)
1627+
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
1628+
(deps (alias reftest-process-output.unix)))
1629+
1630+
(rule
1631+
(targets process-output.unix.out)
1632+
(deps root-N0REP0)
1633+
(enabled_if (and (= %{os_type} "Unix") (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
1634+
(package opam)
1635+
(action
1636+
(with-stdout-to
1637+
%{targets}
1638+
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:process-output.unix.test} %{read-lines:testing-env}))))
1639+
16191640
(rule
16201641
(alias reftest-rebuild)
16211642
(enabled_if (and (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1))))
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
N0REP0
2+
### :: Check that process verbose display is the same with or without sandbox
3+
### :: (no trailing space or quotes)
4+
### : disable sandbox for install commands
5+
### opam option 'wrap-install-commands=[]'
6+
Set to '[]' the field wrap-install-commands in global configuration
7+
### <pkg:process.1>
8+
opam-version: "2.0"
9+
build: [
10+
[ "true" ]
11+
[ "true" "with" "option" ]
12+
]
13+
install: [
14+
[ "true" ]
15+
[ "true" "with" "option" ]
16+
]
17+
### opam switch create outputs --empty
18+
### opam install process -vv -y | sed-cmd true
19+
The following actions will be performed:
20+
=== install 1 package
21+
- install process 1
22+
23+
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
24+
Processing 2/3: [process: true]
25+
+ true (CWD=${BASEDIR}/OPAM/outputs/.opam-switch/build/process.1)
26+
Processing 2/3: [process: true with]
27+
+ true "with" "option" (CWD=${BASEDIR}/OPAM/outputs/.opam-switch/build/process.1)
28+
-> compiled process.1
29+
Processing 3/3: [process: true]
30+
+ true (CWD=${BASEDIR}/OPAM/outputs/.opam-switch/build/process.1)
31+
Processing 3/3: [process: true with]
32+
+ true "with" "option" (CWD=${BASEDIR}/OPAM/outputs/.opam-switch/build/process.1)
33+
-> installed process.1
34+
Done.

0 commit comments

Comments
 (0)