···71717272Shims:
7373- On Unix, the bytecode toplevel contains the absolute location of `ocamlrun`,
7474- so must be explicitly invoked via `ocamlrun`
7474+ so must be explicitly invoked via `ocamlrun`, unless the compiler is
7575+ configured with `--enable-runtime-search`
7576- Both toplevels contain the absolute location of the Standard Library,
7677 requiring `OCAMLLIB` to be set, unless the compiler was configured with
7778 `--with-relative-libdir`
···8485- For a bytecode-only build, `ocamlc` contains the absolute location of
8586 `ocamlrun`, so must be explicitly invoked via `ocamlrun` (if the native
8687 compiler is available, then both `ocamlc` and `ocamlopt` will be native
8787- executables)
8888+ executables), unless the compiler is configured with `--enable-runtime-search`
8889- Both compilers contain the absolute location of the Standard Library,
8990 requiring `OCAMLLIB` to be set, unless the comnpiler was configured with
9091 `--with-relative-libdir`
9192- The executable created by `ocamlc` contains the absolute location of
9292- `ocamlrun`, so must be both explicitly invoked via `ocamlrun` and also have
9393- `CAML_LD_LIBRARY_PATH` or `OCAMLLIB` adjusted, as that `ocamlrun` will not be
9494- able to find `ld.conf`
9393+ `ocamlrun`, so must be explicitly invoked via `ocamlrun`, unless the
9494+ compiler is configured with `--enable-runtime-search-target`
95959696### Executing installed bytecode binaries with `-vnum`
9797···113113114114Shims:
115115- On builds with shared library support, all the executables will contain the
116116- absolute location of `ocamlrun` and will fail to execute
116116+ absolute location of `ocamlrun` and will fail to execute, unless the compiler
117117+ was configured with `--enable-runtime-search`
117118- On builds without shared library support, executables using libraries with
118119 C stubs (in particular, `ocamldebug` and `ocamldoc`) are compiled with
119120 `-custom` and do succeed
···151152152153Shims:
153154- As with the `Dynlink` test, on bytecode-only builds the compiler must be
154154- explicitly invoked via `ocamlrun`
155155+ explicitly invoked via `ocamlrun`, unless the compiler was configured with
156156+ `--enable-runtime-search`
155157- The executable produced by `ocamlc` by default contains the absolute location
156156- of `ocamlrun` and so has to be run explicitly via `ocamlrun`
158158+ of `ocamlrun` and so has to be run explicitly via `ocamlrun`, unless the
159159+ compiler was configured with `--enable-runtime-search-target`
+5-6
testsuite/tools/cmdline.ml
···104104 in
105105 let config =
106106 ref {has_ocamlnat = false; has_ocamlopt = false; has_relative_libdir = None;
107107- has_runtime_search = None; launcher_searches_for_ocamlrun = false;
107107+ has_runtime_search = Disable; launcher_searches_for_ocamlrun = false;
108108 target_launcher_searches_for_ocamlrun = false;
109109 bytecode_shebangs_by_default = false; filename_mangling = false;
110110 libraries = []}
···161161 let has_ocamlnat has_ocamlnat () = config := {!config with has_ocamlnat} in
162162 let has_ocamlopt has_ocamlopt () = config := {!config with has_ocamlopt} in
163163 let parse_search = function
164164- | "fallback" -> true
165165- | "enable" -> false
164164+ | Some "fallback" -> Config.Fallback
165165+ | Some "enable" -> Config.Enable
166166+ | None -> Config.Disable
166167 | _ ->
167168 raise (Arg.Bad
168169 "--with-runtime-search: argument should be either fallback or enable")
169170 in
170171 let has_runtime_search arg =
171171- let has_runtime_search = Option.map parse_search arg in
172172- if has_runtime_search <> None then
173173- error "--with-runtime-search is not implemented!";
172172+ let has_runtime_search = parse_search arg in
174173 config := {!config with has_runtime_search}
175174 in
176175 let args = Arg.align [
···6262 has_relative_libdir: string option;
6363 (** {v $(TARGET_LIBDIR_IS_RELATIVE) v} and {v $(TARGET_LIBDIR) v} -
6464 {v Makefile.build_config v} *)
6565- has_runtime_search: bool option;
6666- (** Not implemented; always None. *)
6565+ has_runtime_search: Config.search_method;
6666+ (** {v $(RUNTIME_SEARCH) v} - {v Makefile.build_config v} *)
6767 launcher_searches_for_ocamlrun: bool;
6868 (** Indicates whether bytecode executables in the compiler distribution
6969 use a launcher that is capable of searching PATH to find ocamlrun. At
+9-15
testsuite/tools/testBytecodeBinaries.ml
···8484 else
8585 failed, "compiled with -custom"
8686 | Tendered {runtime; id; header; search; _} ->
8787- let reported_runtime =
8787+ let reported_runtime, search =
8888 let id =
8989 Option.map
9090 (fun t -> "-" ^ Misc.RuntimeID.to_string t) id
···9292 in
9393 match search with
9494 | Disable dir ->
9595- dir ^ runtime ^ id
9595+ dir ^ runtime ^ id, Config.Disable
9696 | Fallback dir ->
9797- Printf.sprintf "[%s]%s%s" dir runtime id
9797+ Printf.sprintf "[%s]%s%s" dir runtime id,
9898+ Config.Fallback
9899 | Enable ->
9999- runtime ^ id
100100+ runtime ^ id, Config.Enable
100101 in
101102 let expected_id =
102103 if config.filename_mangling then
···104105 else
105106 None
106107 in
107107- let expected_search =
108108- if Sys.win32 then
109109- Byterntm.Enable
110110- else
111111- Byterntm.Disable
112112- (Filename.concat (Environment.bindir env) "")
113113- in
114108 let expected_launch_mode =
115109 if Config.shebangscripts then
116110 Header_shebang
···124118 Format.pp_print_string f (Misc.RuntimeID.to_string id)
125119 in
126120 let pp_search f = function
127127- | Byterntm.Disable _ ->
121121+ | Config.Disable ->
128122 Format.pp_print_string f "disable"
129129- | Byterntm.Fallback _ ->
123123+ | Config.Fallback ->
130124 Format.pp_print_string f "fallback"
131131- | Byterntm.Enable ->
125125+ | Config.Enable ->
132126 Format.pp_print_string f "enable"
133127 in
134128 let pp_launch f = function
···145139 in
146140 let failed =
147141 failed
148148- |> check expected_search search
142142+ |> check config.has_runtime_search search
149143 "search mechanism" pp_search
150144 |> check expected_id id
151145 "runtime ID" pp_runtime_id
+11-3
testsuite/tools/testLinkModes.ml
···501501 | _ ->
502502 [] in
503503 let target_launcher_searches_for_ocamlrun =
504504- (search_method <> Config.Disable)
504504+ if search_method = Config.search_method then
505505+ None
506506+ else
507507+ Some (search_method <> Config.Disable)
505508 in
506509 let param =
507510 match search_method with
···509512 | Fallback -> "fallback"
510513 | Enable -> "enable"
511514 in
512512- let args = "-runtime-search" :: param :: args in
513513- f ~target_launcher_searches_for_ocamlrun ~tendered:true args
515515+ let args =
516516+ if search_method = Config.search_method then
517517+ args
518518+ else
519519+ "-runtime-search" :: param :: args
520520+ in
521521+ f ?target_launcher_searches_for_ocamlrun ~tendered:true args
514522 | Default_ocamlopt ->
515523 f ~mode:Native []
516524 | Custom_runtime Static ->
+12-15
testsuite/tools/testRelocation.ml
···7777 (* If the launcher doesn't search for ocamlrun, then either the #! stub
7878 will include the absolute path or the RNTM section will *)
7979 match classification with
8080- | Tendered _ when not config.launcher_searches_for_ocamlrun -> true
8080+ | Tendered _ when config.has_runtime_search <> Config.Enable -> true
8181 | _ -> false
8282 in
8383 if code_embeds_stdlib_location || linker_embeds_stdlib_location then
···488488 |> scan Environment.libdir "$libdir" libdir_rules
489489 in
490490 flush stderr;
491491- (* Abort the harness if there are files which didn't match a ruleset *)
492492- let () =
493493- if results_are_reproducible && not consistent then
494494- Harness.fail_because
495495- "Internal error: bindir_rules and libdir_rules disagree with \
496496- reproducible_rules"
497497- else if results_are_reproducible <> reproducible then
498498- Harness.fail_because
499499- "The build is %sexpected to be reproducible"
500500- (if not reproducible then "not " else "")
501501- in
502491 (* Summarise the results, using wildcards to bring them to a readable
503492 length *)
504493 let sections =
···617606 let pp_results = Format.(pp_print_list ~pp_sep pp_print_string) in
618607 Format.printf "@[<hov 4> %a@]@." pp_results results
619608 in
609609+ (* Abort the harness if there are files which didn't match a ruleset *)
620610 if failed then
621621- Harness.fail_because "Installed files don't match expectation"
622622- else
623623- List.iter display sections
611611+ Harness.fail_because "Installed files don't match expectation";
612612+ List.iter display sections;
613613+ if results_are_reproducible && not consistent then
614614+ Harness.fail_because
615615+ "Internal error: bindir_rules and libdir_rules disagree with \
616616+ reproducible_rules"
617617+ else if results_are_reproducible <> reproducible then
618618+ Harness.fail_because
619619+ "The build is %sexpected to be reproducible"
620620+ (if not reproducible then "not " else "")
+6-4
testsuite/tools/test_in_prefix.ml
···126126 in
127127 let bytecode_shebangs_by_default =
128128 Config.launch_method <> Config.Executable in
129129- let launcher_searches_for_ocamlrun = Sys.win32 in
130130- let target_launcher_searches_for_ocamlrun = Sys.win32 in
129129+ let launcher_searches_for_ocamlrun =
130130+ (config.has_runtime_search <> Config.Disable) in
131131+ let target_launcher_searches_for_ocamlrun =
132132+ (Config.search_method <> Config.Disable) in
131133 let config =
132134 {config with libraries;
133135 launcher_searches_for_ocamlrun;
···150152 relocatable and also required support from the assembler and C compiler. *)
151153 let relocatable =
152154 config.has_relative_libdir <> None
153153- && config.launcher_searches_for_ocamlrun
155155+ && config.has_runtime_search <> Config.Disable
154156 in
155157 let reproducible =
156158 relocatable
···161163 && (not Toolchain.c_compiler_always_embeds_build_path
162164 || not Toolchain.c_compiler_debug_paths_can_be_absolute)
163165 in
164164- let target_relocatable = config.target_launcher_searches_for_ocamlrun in
166166+ let target_relocatable = (Config.search_method <> Config.Disable) in
165167 (* Use Harness.pp_path unless --verbose was specified *)
166168 let pp_path =
167169 if verbose then