Skip to content

Commit

Permalink
fix test suite on 32 bit architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
gares committed Nov 23, 2024
1 parent 54be47d commit 20af6bb
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 39 deletions.
10 changes: 8 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# v2.0.2 (November 2024)

Requires Menhir 20211230 and OCaml 4.13 or above.

- Really fix tests on 32 bits systems

# v2.0.1 (November 2024)

Requires Menhir 20211230 and OCaml 4.08 or above.
Requires Menhir 20211230 and OCaml 4.13 or above.

- Fix tests on 32 bits systems

# v2.0.0 (November 2024)

Requires Menhir 20211230 and OCaml 4.08 or above.
Requires Menhir 20211230 and OCaml 4.13 or above.

- Compiler:
- Change the pipeline completely to make unit relocation unnecessary. Current
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ LN_NB=-1
STOP_ON_FST_ERROR=false
PWD=$(shell pwd)
RUNNERS=\
dune \
$(wildcard $(PWD)/_build/git/*/$(BUILD)/tests/sources/*.exe.git.*.exe) \
$(wildcard $(PWD)/$(BUILD)/tests/sources/*.exe) \
$(PWD)/$(INSTALL)/bin/elpi \
$(PWD)/$(INSTALL)/bin/elpi-trace-elaborator \
$(addprefix $(PWD)/,$(wildcard _build/git/*/$(INSTALL)/bin/elpi.git.*)) \
Expand Down Expand Up @@ -105,8 +106,8 @@ git/%:
cd "_build/git/elpi-$*" && \
if [ -f dune ]; then \
make build DUNE_OPTS="$(DUNE_OPTS) --root .";\
cd _build/install/default/bin/; \
ln -sf elpi elpi.git.$*; \
(cd _build/install/default/bin/; ln -sf elpi elpi.git.$*); \
(cd _build/default/tests/sources; for x in *.exe; do ln -sf $$x $$x.git.$*.exe; done) \
else \
make; \
mkdir -p _build/install/default/bin/; \
Expand Down
7 changes: 6 additions & 1 deletion src/runtime/bl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ module Array = struct
(* New code, all bugs are mine ;-) *)
let extend len t a =
let data = reroot t; match ! t with Array x -> x | Diff _ -> assert false in
let newdata = Array.make (2*(max 1 len)) a in
let newlength = 2*(max 1 len) in
if newlength > Sys.max_array_length then begin
Printf.eprintf "bl: too many items: %d > %d (max array length)" newlength Sys.max_array_length;
exit 1
end;
let newdata = Array.make newlength a in
if len > 0 then
Array.blit data 0 newdata 0 len;
ref @@ Array newdata
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/test_bl.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
open Elpi_runtime.Bl
let size = min Sys.max_array_length 9999999

let size = min (Sys.max_array_length / 2 - 1) 9999999
let test_build () =
Gc.minor (); Gc.major ();

Expand Down
18 changes: 9 additions & 9 deletions tests/suite/elpi_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,56 @@ open Suite
let declare = Test.declare ~category:(Filename.(chop_extension (basename __FILE__)))

let () = declare "sepcomp1"
~source_dune:"sepcomp1.ml"
~source_dune:"sepcomp1.exe"
~description:"simple separate compilation"
~expectation:Test.(SuccessOutput (Str.regexp "ok"))
()

let () = declare "sepcomp2"
~source_dune:"sepcomp2.ml"
~source_dune:"sepcomp2.exe"
~description:"simple separate compilation"
~expectation:Test.(SuccessOutput (Str.regexp "ok"))
()

let () = declare "sepcomp3"
~source_dune:"sepcomp3.ml"
~source_dune:"sepcomp3.exe"
~description:"separate compilation double naming"
~expectation:Test.(FailureOutput (Str.regexp "duplicate clause name xxx"))
()

let () = declare "sepcomp4"
~source_dune:"sepcomp4.ml"
~source_dune:"sepcomp4.exe"
~description:"separate compilation double naming"
~expectation:Test.(FailureOutput (Str.regexp "uplicate mode declaration for p"))
()

let () = declare "sepcomp5"
~source_dune:"sepcomp5.ml"
~source_dune:"sepcomp5.exe"
~description:"separate compilation different processes (step 1)"
~expectation:Test.Success
()

let () = declare "sepcomp6"
~source_dune:"sepcomp6.ml"
~source_dune:"sepcomp6.exe"
~after:"sepcomp5"
~description:"separate compilation different processes (step 2)"
~expectation:Test.(SuccessOutput (Str.regexp "ok"))
()

let () = declare "sepcomp7"
~source_dune:"sepcomp7.ml"
~source_dune:"sepcomp7.exe"
~description:"separate compilation different processes, with remove (step 1)"
~expectation:Test.Success
()

let () = declare "sepcomp8"
~source_dune:"sepcomp8.ml"
~source_dune:"sepcomp8.exe"
~description:"separate compilation different processes, with remove (step 2)"
~expectation:Test.Success
()

let () = declare "sepcomp9"
~source_dune:"sepcomp9.ml"
~source_dune:"sepcomp9.exe"
~description:"separate compilation different processes, with remove (step 3)"
~expectation:Test.Success
()
Expand Down
10 changes: 5 additions & 5 deletions tests/suite/elpi_api_performance.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ open Suite
let declare = Test.declare ~category:(Filename.(chop_extension (basename __FILE__)))

let () = declare "sepcomp_perf1"
~source_dune:"sepcomp_perf1.ml"
~source_dune:"sepcomp_perf1.exe"
~after:"sepcomp_perf1"
~description:"separate compilation perf"
~expectation:Test.Success
()

let () = declare "sepcomp_perf2"
~source_dune:"sepcomp_perf2.ml"
~source_dune:"sepcomp_perf2.exe"
~after:"sepcomp_perf2"
~description:"separate compilation linker perf"
~expectation:Test.Success
()

let () = declare "sepcomp_perf3"
~source_dune:"sepcomp_perf3.ml"
~source_dune:"sepcomp_perf3.exe"
~after:"sepcomp_perf3"
~description:"separate compilation linker perf"
~expectation:Test.Success
()

let () = declare "sepcomp_perf4"
~source_dune:"sepcomp_perf4.ml"
~source_dune:"sepcomp_perf4.exe"
~after:"sepcomp_perf4"
~description:"separate compilation linker perf"
~expectation:Test.Success
()

let () = declare "sepcomp_perf5"
~source_dune:"sepcomp_perf5.ml"
~source_dune:"sepcomp_perf5.exe"
~after:"sepcomp_perf5"
~description:"separate compilation linker perf and time distribution"
~expectation:Test.Success
Expand Down
23 changes: 7 additions & 16 deletions tests/suite/suite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -570,30 +570,21 @@ end

module Dune = struct

let is_dune =
let rex = Str.regexp "dune" in
fun s -> Str.string_match rex (Filename.basename s) 0

let is_dune_src = function
| None -> false
| Some s -> Filename.check_suffix s ".ml"
let same_binary exe pat =
match pat with None -> false
| Some pat -> Str.string_match (Str.regexp (".*"^pat)) exe 0

let () = Runner.declare
~applicable:begin fun ~executable { source_dune; _ } ->
if is_dune executable && is_dune_src source_dune then Runner.Can_run_it else Runner.Not_for_me
if same_binary executable source_dune then Runner.Can_run_it else Runner.Not_for_me
end
~run:begin fun ~executable ~timetool ~timeout ~env ~sources ~promote test ->
let source =
match test.Test.source_dune with Some x -> x | _ -> assert false in
if not (Sys.file_exists executable) then Runner.Skipped
else if not (Sys.file_exists (sources^source)) then Runner.Skipped
else
let log = Util.open_log ~executable test in
Util.write log (Printf.sprintf "executable: %s\n" executable);
let log = Util.open_log ~executable:(Filename.basename executable) test in
let { Test.expectation; input; outside_llam = _; _ } = test in
let sources = Str.global_replace (Str.regexp "^.*tests/sources/") "tests/sources/" sources in
let source = Filename.remove_extension source ^ ".exe" in
let args = ["exec"; sources ^ "/" ^ source; "--"; "-I"; "src/"] in
Util.write log (Printf.sprintf "executable: %s\n" executable);
let args = ["-I"; "src/"] in
Util.write log (Printf.sprintf "args: %s\n" (String.concat " " args));
let rc =
let outcome = Util.exec ~timeout ~timetool ?input ~executable ~env ~log ~args () in
Expand Down
2 changes: 1 addition & 1 deletion tests/test.real.ml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ let print_csv plot results =
end
| None -> ());
close_out oc;
if Sys.command "which lua5.1" = 0 && Sys.command "which gnuplot" = 0 then begin
if Sys.command "which lua5.1 &>/dev/null" = 0 && Sys.command "which gnuplot &> /dev/null" = 0 then begin
ignore(Sys.command (plot ^ " data.csv"));
ignore(Sys.command "gnuplot data.csv.plot")
end
Expand Down

0 comments on commit 20af6bb

Please sign in to comment.