Skip to content

Commit

Permalink
Update the tests now that homebrew renamed the GNU patch binary to gp…
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Nov 13, 2024
1 parent 3e6f1f6 commit 284b807
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion tests/lib/patcher.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ let generate_patch () =
Printf.eprintf "Before patch state of c:\n";
print_directory ".";
flush stdout;
if Sys.command "patch -p1 -i ../output.patch" <> 0 then (Printf.eprintf "patch application failed\n%!"; exit 2);
let gpatch =
if Sys.command "sh -c \"command -v gpatch > /dev/null 2> /dev/null\"" = 0 then
"gpatch"
else
"patch"
in
if Sys.command (gpatch^" -p1 -i ../output.patch") <> 0 then (Printf.eprintf "patch application failed\n%!"; exit 2);
Printf.eprintf "After patch state of c:\n";
print_directory ".";
OpamSystem.chdir Filename.parent_dir_name
Expand Down
8 changes: 4 additions & 4 deletions tests/reftests/repository.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ some content
### sh hash.sh REPO foo.1
### : Internal repository storage as archive or plain directory :
### opam switch create tarring --empty
### opam update -vv | grep '^\+' | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
### opam update -vv | grep '^\+' | sed-cmd diff | sed-cmd patch | sed-cmd gpatch | '\+ gpatch ' -> '+ patch ' | 'patch-[^"]+' -> 'patch'
+ diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo)
+ patch "--version"
+ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${BASEDIR}/OPAM/repo/default)
Expand All @@ -38,7 +38,7 @@ build: ["test" "-f" "baz"]
### <REPO/packages/foo/foo.2/files/baz>
some content
### sh hash.sh REPO foo.2
### opam update default -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
### opam update default -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | sed-cmd gpatch | '\+ gpatch ' -> '+ patch ' | 'patch-[^"]+' -> 'patch'
+ diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo)
+ patch "--version"
+ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${BASEDIR}/OPAM/repo/default)
Expand Down Expand Up @@ -78,7 +78,7 @@ build: ["test" "-f" "baz"]
### <REPO/packages/foo/foo.4/files/baz>
some content
### sh hash.sh REPO foo.4
### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | sed-cmd gpatch | '\+ gpatch ' -> '+ patch ' | 'patch-[^"]+' -> 'patch'
+ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}"
+ diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP})
+ patch "--version"
Expand All @@ -102,7 +102,7 @@ build: ["test" "-f" "quux"]
### <REPO/packages/foo/foo.5/files/quux>
some content
### sh hash.sh REPO foo.5
### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | sed-cmd gpatch | '\+ gpatch ' -> '+ patch ' | 'patch-[^"]+' -> 'patch'
+ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}"
+ diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP})
+ patch "--version"
Expand Down

0 comments on commit 284b807

Please sign in to comment.