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

GHA: CI housekeeping #1042

Merged
merged 3 commits into from
Jun 3, 2024
Merged
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
337 changes: 6 additions & 331 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
fail-fast: false
matrix:
job:
- { os: macos-14 , ocaml-version: "5.1.1+options,ocaml-option-no-compression" }
- { os: macos-14 , ocaml-version: 5.2.0 }
- { os: macos-14 , ocaml-version: 4.14.2 , publish: true , fnsuffix: -macos-arm64 }
- { os: macos-12 , ocaml-version: 4.14.2 , publish: true , fnsuffix: -macos-x86_64 }
- { os: ubuntu-22.04 , ocaml-version: "5.1.1+options,ocaml-option-no-compression" }
- { os: ubuntu-22.04 , ocaml-version: 5.2.0 }
- { os: ubuntu-22.04 , ocaml-version: 4.14.2 }
- { os: ubuntu-20.04 , ocaml-version: 4.14.2 }
- { os: windows-2022 , ocaml-version: 4.14.0+mingw64c , publish: true , fnsuffix: -windows-x86_64 }
Expand Down Expand Up @@ -393,17 +393,16 @@ jobs:
# This list is intended to balance good enough coverage and
# limited resource usage.
job:
- { os: ubuntu-22.04 , ocaml-version: 5.1.x , ref: v2.53.4 }
- { os: ubuntu-22.04 , ocaml-version: 4.14.x , ref: v2.53.4 }
- { os: ubuntu-22.04 , ocaml-version: 5.2.x , ref: v2.53.5 }
- { os: ubuntu-22.04 , ocaml-version: 4.14.x , ref: v2.53.5 }
- { os: ubuntu-22.04 , ocaml-version: 4.14.x , ref: v2.52.1 , oldmake: true }
- { os: ubuntu-22.04 , ocaml-version: 4.14.x , ref: v2.51.5 , oldmake: true }
- { os: ubuntu-22.04 , ocaml-version: 4.08.x , ref: v2.51.5 , oldmake: true }
- { os: ubuntu-22.04 , ocaml-version: 4.08.x , ref: v2.51.2 , oldmake: true }
- { os: ubuntu-22.04 , ocaml-version: 4.08.x , ref: 2.48.4 , oldmake: true }
- { os: windows-2019 , ocaml-version: ocaml-variants.4.14.0+mingw64c , ref: v2.53.4 }
- { os: windows-2019 , ocaml-version: ocaml-variants.4.14.0+mingw64c , ref: v2.53.5 }
- { os: windows-2019 , ocaml-version: ocaml-variants.4.14.0+mingw64c , ref: v2.52.1 , oldmake: true }
- { os: windows-2019 , ocaml-version: ocaml-variants.4.08.1+mingw32c , ref: v2.51.5 , oldmake: true }
- { os: macos-12 , ocaml-version: 4.14.x , ref: v2.53.4 }
- { os: macos-12 , ocaml-version: 4.14.x , ref: v2.53.5 }
- { os: macos-12 , ocaml-version: 4.14.x , ref: v2.52.1 , oldmake: true }
- { os: macos-12 , ocaml-version: 4.08.x , ref: v2.51.2 , oldmake: true }

Expand Down Expand Up @@ -436,62 +435,6 @@ jobs:
with:
path: _new

- name: "2.48: Patch tests in _new"
if: contains(matrix.job.ref, '2.48')
shell: bash
run: |
# 'atomic' was introduced in 2.51.0
cd _new && git apply - <<"EOF"
diff --git a/src/test.ml b/src/test.ml
index 60ccd05..45395e5 100644
--- a/src/test.ml
+++ b/src/test.ml
@@ -351,43 +351,6 @@ let test() =
)
done;

- (* Test that .git is treated atomically. *)
- runtest "Atomicity of certain directories 1" ["atomic = Name .git";
- "force = newer"] (fun() ->
- let orig = (Dir ["foo", Dir [".git", Dir ["a", File "foo";
- "b", File "bar";
- "c", File "baz"]]]) in
- put R1 orig;
- Unix.sleep 2; (* in case time granularity is coarse on this FS *)
- put R2 orig; sync();
- let expected = (Dir ["foo", Dir [".git", Dir ["a", File "modified on R1";
- "b", File "bar";
- "c", File "modified on R1"]]]) in
- put R2 (Dir ["foo", Dir [".git",
- Dir ["a", File "foo";
- "b", File "modified on R2";
- "c", File "modified on R2"]]]);
- Unix.sleep 2;
- put R1 expected;
- sync ();
- check "1" R2 expected;
- check "2" R1 expected
- );
-
- runtest "Atomicity of certain directories 2" ["atomic = Name .git"] (fun() ->
- let a = (Dir ["foo", Dir [".git", Dir ["a", File "foo";
- "b", File "bar";
- "c", File "baz";
- "d", File "quux"]]]) in
- let b = (Dir ["foo", Dir [".git", Dir ["a", File "foo";
- "b", File "bar";
- "c", File "baz";
- "e", File "quux"]]]) in
- put R1 a; put R2 b; sync();
- check "1" R1 a;
- check "2" R2 b
- );
-
(* Check for the bug reported by Ralf Lehmann *)
if not bothRootsLocal then
runtest "backups 1 (remote)" ["backup = Name *"] (fun() ->
EOF

- run: cd _new && opam exec -- make tui
shell: bash

Expand All @@ -501,260 +444,6 @@ jobs:
ref: "${{ matrix.job.ref }}"
path: _prev

- name: "2.48: Patch tests in _prev"
if: contains(matrix.job.ref, '2.48')
shell: bash
run: |
cd _prev && git apply - <<"EOF"
diff --git a/src/test.ml b/src/test.ml
index 6e8f943c..6c0bbded 100644
--- a/src/test.ml
+++ b/src/test.ml
@@ -324,7 +324,7 @@ let test() =

(* Check for the bug reported by Ralf Lehmann *)
if not bothRootsLocal then
- runtest "backups 1 (remote)" ["backup = Name *"] (fun() ->
+ runtest "backups 1 (remote)" ["backup = Name *"; "fastcheck = false"] (fun() ->
put R1 (Dir []); put R2 (Dir []); sync();
debug (fun () -> Util.msg "First check\n");
checkmissing "1" BACKUP1;
@@ -370,7 +370,6 @@ let test() =
check "4" R2 (Dir ["x", File "foo"]);
);

- (raise (Util.Fatal "Skipping some tests -- remove me!\n") : unit);

if bothRootsLocal then
runtest "backups 1 (local)" ["backup = Name *"] (fun() ->
@@ -397,12 +397,12 @@ let test() =
check "1" R2 (Dir [(".bak.0.x", File "foo"); (".bak.0.d", Dir [("a", File "barr")])]);
);

- runtest "backups 2a" ["backup = Name *"; "backuplocation = local"] (fun() ->
+ runtest "backups 2a" ["backup = Name *"; "backuplocation = local"; "fastcheck = false"] (fun() ->
put R1 (Dir []); put R2 (Dir []); sync();
(* Create a file and a directory *)
put R1 (Dir ["foo", File "1"]); sync();
check "1" R1 (Dir [("foo", File "1")]);
- check "2" R1 (Dir [("foo", File "1")]);
+ check "2" R2 (Dir [("foo", File "1")]);
put R1 (Dir ["foo", File "2"]); sync();
check "3" R1 (Dir [("foo", File "2")]);
check "4" R2 (Dir [("foo", File "2"); (".bak.0.foo", File "1")]);
@@ -487,6 +486,77 @@ let test() =
);
end;

+ if not bothRootsLocal then
+ begin
+ let localR, remoteR, localRaw =
+ match r1 with
+ | Common.Local, _ -> R1, R2, r1
+ | _ -> R2, R1, r2
+ in
+
+ (* Test RPC function "fingerprintSubfile" *)
+ runtest "RPC: transfer append" [] (fun () ->
+ let prefixLen = 1024 * 1024 + 1 in
+ let len = prefixLen + 31 in
+ let contents = String.make len '.' in
+ let fileName = "bigfile" in
+ let prefixPath = Path.fromString fileName in
+ let (workingDir, _) = Fspath.findWorkingDir (snd localRaw) prefixPath in
+ let prefixName = Path.toString (Os.tempPath ~fresh:false workingDir prefixPath) in
+ put remoteR (Dir [(fileName, File contents)]);
+ put localR (Dir [(prefixName, File (String.sub contents 0 prefixLen))]);
+ sync ();
+ check "1" localR (Dir [(fileName, File contents)]);
+ );
+
+ (* Test RPC function "updateProps" *)
+ runtest "RPC: update props" ["times = true"] (fun () ->
+ let state = [("a", File "x")] in
+ put remoteR (Dir state);
+ put localR (Dir []);
+ sync ();
+ (* Having to sleep here is an unfortunate side-effect of the current
+ Windows limitations-inspired time comparison algorithm which is
+ designed to work on FAT filesystems (2-second granularity). *)
+ Unix.sleep 2;
+ put remoteR (Dir state);
+ sync ();
+ check "1" localR (Dir state);
+ );
+
+ (* Test RPC function "replaceArchive" *)
+ runtest "RPC: replaceArchive" [] (fun () ->
+ put localR (Dir [("n", File "to delete")]);
+ put remoteR (Dir []);
+ sync ();
+ put remoteR (Dir []);
+ sync ();
+ check "1" localR (Dir []);
+ );
+
+ (* Test RPC functions "mkdir" and "setDirProp" *)
+ runtest "RPC: mkdir, setDirProp" [] (fun () ->
+ let state = [("subd", Dir [])] in
+ put localR (Dir state);
+ put remoteR (Dir []);
+ sync ();
+ check "1" remoteR (Dir state);
+ );
+
+ (* Test RPC function "setupTargetPaths" *)
+ runtest "RPC: merge" ["merge = Name ma -> echo x> NEW"; "backupcurr = Name ma"; "fastcheck = false"] (fun () ->
+ let result = match Sys.os_type with
+ | "Win32" -> ("ma", File "x\r\n")
+ | _ -> ("ma", File "x\n")
+ in
+ put localR (Dir [("ma", File "a")]);
+ put remoteR (Dir [("ma", File "b")]);
+ sync ();
+ check "1" localR (Dir [result]);
+ check "2" remoteR (Dir [result]);
+ );
+ end;
+
if !failures = 0 then
Util.msg "Success :-)\n"
else
EOF

- name: "2.48: Patch bugs in _prev"
if: contains(matrix.job.ref, '2.48')
shell: bash
run: |
cd _prev && git apply - <<"EOF"
diff --git a/src/bytearray_stubs.c b/src/bytearray_stubs.c
index 1ec18aef..664e3d96 100644
--- a/src/bytearray_stubs.c
+++ b/src/bytearray_stubs.c
@@ -9,7 +9,7 @@
CAMLprim value ml_marshal_to_bigarray(value v, value flags)
{
char *buf;
- long len;
+ intnat len;
output_value_to_malloc(v, flags, &buf, &len);
return alloc_bigarray(BIGARRAY_UINT8 | BIGARRAY_C_LAYOUT | BIGARRAY_MANAGED,
1, buf, &len);
EOF

- name: "2.48: Patch _prev for mingw compilers"
if: contains(matrix.job.ref, '2.48')
shell: bash
run: |
cd _prev && git apply --ignore-whitespace - <<"EOF"
diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml
index 21610ce6..4d605bbd 100644
--- a/src/Makefile.OCaml
+++ b/src/Makefile.OCaml
@@ -104,8 +104,8 @@ CAMLFLAGS+=-I system/$(SYSTEM) -I lwt/$(SYSTEM)
ifeq ($(OSARCH),win32)
# Win32 system
EXEC_EXT=.exe
- OBJ_EXT=.obj
- OUTPUT_SEL=/Fo
+ OBJ_EXT=.o
+ OUTPUT_SEL=-o
CWD=.
# Fix suggested by Karl M, Jan 2009:
# "The new flexlink wrapper that OCaml 3.11 uses was gagging on the res
@@ -117,8 +117,6 @@ ifeq ($(OSARCH),win32)
COBJS+=system/system_win_stubs$(OBJ_EXT) lwt/lwt_unix_stubs$(OBJ_EXT)
WINOBJS=system/system_win.cmo
SYSTEM=win
- CLIBS+=-cclib "-link win32rc/unison.res" shell32.lib
- STATICLIBS+=-cclib "-link win32rc/unison.res" shell32.lib
buildexecutable::
@echo Building for Windows
else
diff --git a/src/lwt/lwt_unix_stubs.c b/src/lwt/lwt_unix_stubs.c
index aa85e5bb..3717ddc2 100644
--- a/src/lwt/lwt_unix_stubs.c
+++ b/src/lwt/lwt_unix_stubs.c
@@ -79,6 +79,7 @@ static value completionCallback;

static void invoke_completion_callback
(long id, long len, long errCode, long action) {
+ CAMLparam0();
CAMLlocal2 (err, name);
value args[4];
err = Val_long(0);
EOF

- name: "2.48: Patch _prev for newer compilers/OS"
if: contains(matrix.job.ref, '2.48') && matrix.job.ocaml-version >= '4.03'
shell: bash
run: |
cd _prev && git apply - <<"EOF"
diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml
index 21610ce6..75499079 100644
--- a/src/Makefile.OCaml
+++ b/src/Makefile.OCaml
@@ -95,7 +95,7 @@ buildexecutable::
### Default parameters

# Generate backtrace information for exceptions
-CAMLFLAGS+=-g
+CAMLFLAGS+=-g -unsafe-string

INCLFLAGS=-I lwt -I ubase -I system
CAMLFLAGS+=$(INCLFLAGS)
@@ -187,7 +187,7 @@ endif
endif
endif

-MINOSXVERSION=10.5
+MINOSXVERSION=10.7
# XCODEFLAGS=-sdk macosx$(MINOSXVERSION)
ifeq ($(OSARCH),osx)
CAMLFLAGS+=-ccopt -mmacosx-version-min=$(MINOSXVERSION)
diff --git a/src/files.ml b/src/files.ml
index ba42ad57..5babf21e 100644
--- a/src/files.ml
+++ b/src/files.ml
@@ -722,7 +722,7 @@ let get_files_in_directory dir =
with End_of_file ->
dirh.System.closedir ()
end;
- Sort.list (<) !files
+ List.sort String.compare !files

let ls dir pattern =
Util.convertUnixErrorsToTransient
diff --git a/src/recon.ml b/src/recon.ml
index 5ed358d7..0df2cfe4 100644
--- a/src/recon.ml
+++ b/src/recon.ml
@@ -651,8 +651,8 @@ let rec reconcile

(* Sorts the paths so that they will be displayed in order *)
let sortPaths pathUpdatesList =
- Sort.list
- (fun (p1, _) (p2, _) -> Path.compare p1 p2 <= 0)
+ List.sort
+ Path.compare
pathUpdatesList

let rec enterPath p1 p2 t =
diff --git a/src/system/system_generic.ml b/src/system/system_generic.ml
index 9230cdc1..140bd849 100755
--- a/src/system/system_generic.ml
+++ b/src/system/system_generic.ml
@@ -47,7 +47,7 @@ let open_out_gen = open_out_gen
let chmod = Unix.chmod
let chown = Unix.chown
let utimes = Unix.utimes
-let link = Unix.link
+let link x y = Unix.link x y
let openfile = Unix.openfile
let opendir f =
let h = Unix.opendir f in
EOF

- name: "2.51.0: Patch connection header in _prev"
if: contains(matrix.job.ref, '2.51.0')
shell: bash
Expand Down Expand Up @@ -1039,21 +728,7 @@ jobs:
sleep 1 # Wait for the server to be fully started
_new/src/unison -ui text -selftest testr_c socket://127.0.0.1:55443/testr_s -killserver

- name: "2.48: Run self-tests over RPC - prev client to new server"
if: contains(matrix.job.ref, '2.48')
env:
UNISON: test2
shell: bash
run: |
cp _new/src/unison _new/src/unison-2.48
# Separate backup dir must be set for server instance so that the central
# backup location of both instances doesn't overlap
UNISONBACKUPDIR=./_new/src/testbak_s _new/src/unison-2.48 -socket 55443 &
sleep 1 # Wait for the server to be fully started
_prev/src/unison -ui text -selftest testr_c socket://127.0.0.1:55443/testr_s -killserver

- name: Run self-tests over RPC - prev client to new server
if: ${{ !contains(matrix.job.ref, '2.48') }}
env:
UNISON: test2
shell: bash
Expand Down
Loading