Skip to content

Commit 9f44e57

Browse files
shinderedra27
authored andcommitted
Fix native-compiler detection in ocamltest (#10074)
this is a follow-up to commit 42efb99 Before that commit, it was possible to determine whether the native-compiler was disabled by comparing the ARCH build variable with the "none" string. This trick was used by ocamltest to figure out whether the native compilers were available or not, because at the time when ocamltest had to be made aware of that, this was the only way to do (there was no build variable to keep track explictly of whether the native compilers were enabled or not at that time, the explicit build variable was introduced later). So, the commit mentionned above actually broke ocamltest, causing it to try (and fail) to run the native compilers when they were disabled at configure time. The present commit fixes this by making ocamltest rely on the appropriate build variable since it has become available meanwhile. (cherry picked from commit 128d12c)
1 parent 86fe55f commit 9f44e57

5 files changed

Lines changed: 12 additions & 7 deletions

File tree

ocamltest/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ ocamltest_config.ml: ocamltest_config.ml.in Makefile ../Makefile.config
274274
$(call SUBST,WITH_OCAMLDEBUG) \
275275
$(call SUBST,O) \
276276
$(call SUBST,S) \
277+
$(call SUBST,NATIVE_COMPILER) \
277278
$(call SUBST,NATDYNLINK) \
278279
$(call SUBST_STRING,SHAREDLIB_CFLAGS) \
279280
$(call SUBST,SO) \

ocamltest/ocaml_actions.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ open Actions
2020

2121
(* Extracting information from environment *)
2222

23-
let native_support = Ocamltest_config.arch <> "none"
24-
2523
let no_native_compilers _log env =
2624
(Result.skip_with_reason "native compilers disabled", env)
2725

2826
let native_action a =
29-
if native_support then a else (Actions.update a no_native_compilers)
27+
if Ocamltest_config.native_compiler then a
28+
else (Actions.update a no_native_compilers)
3029

3130
let get_backend_value_from_env env bytecode_var native_var =
3231
Ocaml_backends.make_backend_function
@@ -1138,7 +1137,7 @@ let no_shared_libraries = Actions.make
11381137

11391138
let native_compiler = Actions.make
11401139
"native-compiler"
1141-
(Actions_helpers.pass_or_skip (Ocamltest_config.arch <> "none")
1140+
(Actions_helpers.pass_or_skip Ocamltest_config.native_compiler
11421141
"native compiler available"
11431142
"native compiler not available")
11441143

ocamltest/ocaml_tests.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ let native =
5656
test_name = "native";
5757
test_run_by_default = true;
5858
test_actions =
59-
(if Ocamltest_config.arch<>"none" then opt_actions else [skip])
59+
(if Ocamltest_config.native_compiler then opt_actions else [skip])
6060
}
6161

6262
let toplevel = {
@@ -114,7 +114,7 @@ let asmgen_skip_on_msvc64 =
114114
Actions_helpers.skip_with_reason "not ported to MSVC64 yet"
115115

116116
let asmgen_actions =
117-
if Ocamltest_config.arch="none" then [asmgen_skip_on_bytecode_only]
117+
if not Ocamltest_config.native_compiler then [asmgen_skip_on_bytecode_only]
118118
else if msvc64 then [asmgen_skip_on_msvc64]
119119
else [
120120
setup_simple_build_env;

ocamltest/ocamltest_config.ml.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ let ocamldoc = %%WITH_OCAMLDOC%%
5858

5959
let ocamldebug = %%WITH_OCAMLDEBUG%%
6060

61+
let native_compiler = %%NATIVE_COMPILER%%
62+
6163
let native_dynlink = %%NATDYNLINK%%
6264

6365
let shared_library_cflags = "%%SHAREDLIB_CFLAGS%%"

ocamltest/ocamltest_config.mli

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
(* Interface for ocamltest's configuration module *)
1717

1818
val arch : string
19-
(** Architecture for the native compiler, "none" if it is disabled *)
19+
(** Architecture for the native compiler *)
2020

2121
val afl_instrument : bool
2222
(** Whether AFL support has been enabled in the compiler *)
@@ -82,6 +82,9 @@ val ocamldoc : bool
8282
val ocamldebug : bool
8383
(** Whether ocamldebug has been enabled at configure time *)
8484

85+
val native_compiler : bool
86+
(** Whether the native compiler has been enabled at configure time *)
87+
8588
val native_dynlink : bool
8689
(** Whether support for native dynlink is available or not *)
8790

0 commit comments

Comments
 (0)