The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update the installation test for runtime-searching

+67 -54
+3
.depend
··· 10522 10522 testsuite/lib/testing.cmi : 10523 10523 testsuite/tools/cmdline.cmo : \ 10524 10524 testsuite/tools/harness.cmi \ 10525 + utils/config.cmi \ 10525 10526 testsuite/tools/cmdline.cmi 10526 10527 testsuite/tools/cmdline.cmx : \ 10527 10528 testsuite/tools/harness.cmx \ 10529 + utils/config.cmx \ 10528 10530 testsuite/tools/cmdline.cmi 10529 10531 testsuite/tools/cmdline.cmi : \ 10530 10532 testsuite/tools/harness.cmi ··· 10627 10629 testsuite/tools/harness.cmi 10628 10630 testsuite/tools/harness.cmi : \ 10629 10631 utils/misc.cmi \ 10632 + utils/config.cmi \ 10630 10633 bytecomp/byterntm.cmi 10631 10634 testsuite/tools/lexcmm.cmo : \ 10632 10635 testsuite/tools/parsecmm.cmi \
+7
testsuite/in_prefix/Makefile.test
··· 26 26 $(VERBOSE_FLAG) --bindir "$(BINDIR)" --libdir '$(TARGET_LIBDIR)' \ 27 27 $(call bool_to_with, ocamlnat, $(INSTALL_OCAMLNAT)) \ 28 28 $(call bool_to_with, ocamlopt, $(NATIVE_COMPILER)) \ 29 + $(RUNTIME_SEARCH_FLAG) \ 29 30 $(OTHERLIBRARIES) --pwd "$(SRCDIR_ABS)/testsuite/in_prefix" 30 31 31 32 default: $(DRIVER) ··· 37 38 else 38 39 VERBOSE_FLAG = 39 40 endif 41 + 42 + # Generates --without-$(1) if $(2) is empty or --with-$(1)=$(2) otherwise 43 + RUNTIME_SEARCH_FLAG = \ 44 + $(if $(RUNTIME_SEARCH),$\ 45 + --with-runtime-search=$(RUNTIME_SEARCH),$\ 46 + --without-runtime-search) 40 47 41 48 export PATH := $(SRCDIR_ABS)/testsuite/in_prefix/poisoned-runtime:$(PATH) 42 49
+11 -8
testsuite/in_prefix/README.md
··· 71 71 72 72 Shims: 73 73 - On Unix, the bytecode toplevel contains the absolute location of `ocamlrun`, 74 - so must be explicitly invoked via `ocamlrun` 74 + so must be explicitly invoked via `ocamlrun`, unless the compiler is 75 + configured with `--enable-runtime-search` 75 76 - Both toplevels contain the absolute location of the Standard Library, 76 77 requiring `OCAMLLIB` to be set, unless the compiler was configured with 77 78 `--with-relative-libdir` ··· 84 85 - For a bytecode-only build, `ocamlc` contains the absolute location of 85 86 `ocamlrun`, so must be explicitly invoked via `ocamlrun` (if the native 86 87 compiler is available, then both `ocamlc` and `ocamlopt` will be native 87 - executables) 88 + executables), unless the compiler is configured with `--enable-runtime-search` 88 89 - Both compilers contain the absolute location of the Standard Library, 89 90 requiring `OCAMLLIB` to be set, unless the comnpiler was configured with 90 91 `--with-relative-libdir` 91 92 - The executable created by `ocamlc` contains the absolute location of 92 - `ocamlrun`, so must be both explicitly invoked via `ocamlrun` and also have 93 - `CAML_LD_LIBRARY_PATH` or `OCAMLLIB` adjusted, as that `ocamlrun` will not be 94 - able to find `ld.conf` 93 + `ocamlrun`, so must be explicitly invoked via `ocamlrun`, unless the 94 + compiler is configured with `--enable-runtime-search-target` 95 95 96 96 ### Executing installed bytecode binaries with `-vnum` 97 97 ··· 113 113 114 114 Shims: 115 115 - On builds with shared library support, all the executables will contain the 116 - absolute location of `ocamlrun` and will fail to execute 116 + absolute location of `ocamlrun` and will fail to execute, unless the compiler 117 + was configured with `--enable-runtime-search` 117 118 - On builds without shared library support, executables using libraries with 118 119 C stubs (in particular, `ocamldebug` and `ocamldoc`) are compiled with 119 120 `-custom` and do succeed ··· 151 152 152 153 Shims: 153 154 - As with the `Dynlink` test, on bytecode-only builds the compiler must be 154 - explicitly invoked via `ocamlrun` 155 + explicitly invoked via `ocamlrun`, unless the compiler was configured with 156 + `--enable-runtime-search` 155 157 - The executable produced by `ocamlc` by default contains the absolute location 156 - of `ocamlrun` and so has to be run explicitly via `ocamlrun` 158 + of `ocamlrun` and so has to be run explicitly via `ocamlrun`, unless the 159 + compiler was configured with `--enable-runtime-search-target`
+5 -6
testsuite/tools/cmdline.ml
··· 104 104 in 105 105 let config = 106 106 ref {has_ocamlnat = false; has_ocamlopt = false; has_relative_libdir = None; 107 - has_runtime_search = None; launcher_searches_for_ocamlrun = false; 107 + has_runtime_search = Disable; launcher_searches_for_ocamlrun = false; 108 108 target_launcher_searches_for_ocamlrun = false; 109 109 bytecode_shebangs_by_default = false; filename_mangling = false; 110 110 libraries = []} ··· 161 161 let has_ocamlnat has_ocamlnat () = config := {!config with has_ocamlnat} in 162 162 let has_ocamlopt has_ocamlopt () = config := {!config with has_ocamlopt} in 163 163 let parse_search = function 164 - | "fallback" -> true 165 - | "enable" -> false 164 + | Some "fallback" -> Config.Fallback 165 + | Some "enable" -> Config.Enable 166 + | None -> Config.Disable 166 167 | _ -> 167 168 raise (Arg.Bad 168 169 "--with-runtime-search: argument should be either fallback or enable") 169 170 in 170 171 let has_runtime_search arg = 171 - let has_runtime_search = Option.map parse_search arg in 172 - if has_runtime_search <> None then 173 - error "--with-runtime-search is not implemented!"; 172 + let has_runtime_search = parse_search arg in 174 173 config := {!config with has_runtime_search} 175 174 in 176 175 let args = Arg.align [
+1 -1
testsuite/tools/harness.ml
··· 32 32 has_ocamlnat: bool; 33 33 has_ocamlopt: bool; 34 34 has_relative_libdir: string option; 35 - has_runtime_search: bool option; 35 + has_runtime_search: Config.search_method; 36 36 launcher_searches_for_ocamlrun: bool; 37 37 target_launcher_searches_for_ocamlrun: bool; 38 38 bytecode_shebangs_by_default: bool;
+2 -2
testsuite/tools/harness.mli
··· 62 62 has_relative_libdir: string option; 63 63 (** {v $(TARGET_LIBDIR_IS_RELATIVE) v} and {v $(TARGET_LIBDIR) v} - 64 64 {v Makefile.build_config v} *) 65 - has_runtime_search: bool option; 66 - (** Not implemented; always None. *) 65 + has_runtime_search: Config.search_method; 66 + (** {v $(RUNTIME_SEARCH) v} - {v Makefile.build_config v} *) 67 67 launcher_searches_for_ocamlrun: bool; 68 68 (** Indicates whether bytecode executables in the compiler distribution 69 69 use a launcher that is capable of searching PATH to find ocamlrun. At
+9 -15
testsuite/tools/testBytecodeBinaries.ml
··· 84 84 else 85 85 failed, "compiled with -custom" 86 86 | Tendered {runtime; id; header; search; _} -> 87 - let reported_runtime = 87 + let reported_runtime, search = 88 88 let id = 89 89 Option.map 90 90 (fun t -> "-" ^ Misc.RuntimeID.to_string t) id ··· 92 92 in 93 93 match search with 94 94 | Disable dir -> 95 - dir ^ runtime ^ id 95 + dir ^ runtime ^ id, Config.Disable 96 96 | Fallback dir -> 97 - Printf.sprintf "[%s]%s%s" dir runtime id 97 + Printf.sprintf "[%s]%s%s" dir runtime id, 98 + Config.Fallback 98 99 | Enable -> 99 - runtime ^ id 100 + runtime ^ id, Config.Enable 100 101 in 101 102 let expected_id = 102 103 if config.filename_mangling then ··· 104 105 else 105 106 None 106 107 in 107 - let expected_search = 108 - if Sys.win32 then 109 - Byterntm.Enable 110 - else 111 - Byterntm.Disable 112 - (Filename.concat (Environment.bindir env) "") 113 - in 114 108 let expected_launch_mode = 115 109 if Config.shebangscripts then 116 110 Header_shebang ··· 124 118 Format.pp_print_string f (Misc.RuntimeID.to_string id) 125 119 in 126 120 let pp_search f = function 127 - | Byterntm.Disable _ -> 121 + | Config.Disable -> 128 122 Format.pp_print_string f "disable" 129 - | Byterntm.Fallback _ -> 123 + | Config.Fallback -> 130 124 Format.pp_print_string f "fallback" 131 - | Byterntm.Enable -> 125 + | Config.Enable -> 132 126 Format.pp_print_string f "enable" 133 127 in 134 128 let pp_launch f = function ··· 145 139 in 146 140 let failed = 147 141 failed 148 - |> check expected_search search 142 + |> check config.has_runtime_search search 149 143 "search mechanism" pp_search 150 144 |> check expected_id id 151 145 "runtime ID" pp_runtime_id
+11 -3
testsuite/tools/testLinkModes.ml
··· 501 501 | _ -> 502 502 [] in 503 503 let target_launcher_searches_for_ocamlrun = 504 - (search_method <> Config.Disable) 504 + if search_method = Config.search_method then 505 + None 506 + else 507 + Some (search_method <> Config.Disable) 505 508 in 506 509 let param = 507 510 match search_method with ··· 509 512 | Fallback -> "fallback" 510 513 | Enable -> "enable" 511 514 in 512 - let args = "-runtime-search" :: param :: args in 513 - f ~target_launcher_searches_for_ocamlrun ~tendered:true args 515 + let args = 516 + if search_method = Config.search_method then 517 + args 518 + else 519 + "-runtime-search" :: param :: args 520 + in 521 + f ?target_launcher_searches_for_ocamlrun ~tendered:true args 514 522 | Default_ocamlopt -> 515 523 f ~mode:Native [] 516 524 | Custom_runtime Static ->
+12 -15
testsuite/tools/testRelocation.ml
··· 77 77 (* If the launcher doesn't search for ocamlrun, then either the #! stub 78 78 will include the absolute path or the RNTM section will *) 79 79 match classification with 80 - | Tendered _ when not config.launcher_searches_for_ocamlrun -> true 80 + | Tendered _ when config.has_runtime_search <> Config.Enable -> true 81 81 | _ -> false 82 82 in 83 83 if code_embeds_stdlib_location || linker_embeds_stdlib_location then ··· 488 488 |> scan Environment.libdir "$libdir" libdir_rules 489 489 in 490 490 flush stderr; 491 - (* Abort the harness if there are files which didn't match a ruleset *) 492 - let () = 493 - if results_are_reproducible && not consistent then 494 - Harness.fail_because 495 - "Internal error: bindir_rules and libdir_rules disagree with \ 496 - reproducible_rules" 497 - else if results_are_reproducible <> reproducible then 498 - Harness.fail_because 499 - "The build is %sexpected to be reproducible" 500 - (if not reproducible then "not " else "") 501 - in 502 491 (* Summarise the results, using wildcards to bring them to a readable 503 492 length *) 504 493 let sections = ··· 617 606 let pp_results = Format.(pp_print_list ~pp_sep pp_print_string) in 618 607 Format.printf "@[<hov 4> %a@]@." pp_results results 619 608 in 609 + (* Abort the harness if there are files which didn't match a ruleset *) 620 610 if failed then 621 - Harness.fail_because "Installed files don't match expectation" 622 - else 623 - List.iter display sections 611 + Harness.fail_because "Installed files don't match expectation"; 612 + List.iter display sections; 613 + if results_are_reproducible && not consistent then 614 + Harness.fail_because 615 + "Internal error: bindir_rules and libdir_rules disagree with \ 616 + reproducible_rules" 617 + else if results_are_reproducible <> reproducible then 618 + Harness.fail_because 619 + "The build is %sexpected to be reproducible" 620 + (if not reproducible then "not " else "")
+6 -4
testsuite/tools/test_in_prefix.ml
··· 126 126 in 127 127 let bytecode_shebangs_by_default = 128 128 Config.launch_method <> Config.Executable in 129 - let launcher_searches_for_ocamlrun = Sys.win32 in 130 - let target_launcher_searches_for_ocamlrun = Sys.win32 in 129 + let launcher_searches_for_ocamlrun = 130 + (config.has_runtime_search <> Config.Disable) in 131 + let target_launcher_searches_for_ocamlrun = 132 + (Config.search_method <> Config.Disable) in 131 133 let config = 132 134 {config with libraries; 133 135 launcher_searches_for_ocamlrun; ··· 150 152 relocatable and also required support from the assembler and C compiler. *) 151 153 let relocatable = 152 154 config.has_relative_libdir <> None 153 - && config.launcher_searches_for_ocamlrun 155 + && config.has_runtime_search <> Config.Disable 154 156 in 155 157 let reproducible = 156 158 relocatable ··· 161 163 && (not Toolchain.c_compiler_always_embeds_build_path 162 164 || not Toolchain.c_compiler_debug_paths_can_be_absolute) 163 165 in 164 - let target_relocatable = config.target_launcher_searches_for_ocamlrun in 166 + let target_relocatable = (Config.search_method <> Config.Disable) in 165 167 (* Use Harness.pp_path unless --verbose was specified *) 166 168 let pp_path = 167 169 if verbose then