From 1c3dd7755ec9cfc9c406198cac96b4d223a62f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hinderer?= Date: Mon, 5 Feb 2018 14:05:47 +0100 Subject: [PATCH] ocamltest: add the afl-support test --- ocamltest/Makefile | 1 + ocamltest/ocaml_actions.ml | 7 +++++++ ocamltest/ocaml_actions.mli | 2 ++ ocamltest/ocamltest_config.ml.in | 2 ++ ocamltest/ocamltest_config.mli | 3 +++ 5 files changed, 15 insertions(+) diff --git a/ocamltest/Makefile b/ocamltest/Makefile index 1a274a444..553cef851 100644 --- a/ocamltest/Makefile +++ b/ocamltest/Makefile @@ -175,6 +175,7 @@ ocamltest.opt$(EXE): $(native_modules) ocamltest_config.ml: ocamltest_config.ml.in sed \ + -e 's|@@AFL_SUPPORT@@|$(AFL_INSTRUMENT)|' \ -e 's|@@ARCH@@|$(ARCH)|' \ -e 's|@@SHARED_LIBRARIES@@|$(SUPPORTS_SHARED_LIBRARIES)|' \ -e 's|@@UNIX@@|$(unix)|' \ diff --git a/ocamltest/ocaml_actions.ml b/ocamltest/ocaml_actions.ml index 6cb611b51..c1723e527 100644 --- a/ocamltest/ocaml_actions.ml +++ b/ocamltest/ocaml_actions.ml @@ -625,6 +625,12 @@ let native_compiler = Actions.make "native compiler available" "native compiler not available") +let afl_support = Actions.make + "afl-support" + (Actions_helpers.pass_or_skip Ocamltest_config.afl_support + "support for AFL instrumentation enabled" + "support for AFL instrumentation disabled") + let _ = Environments.register_initializer "find_source_modules" find_source_modules; Environments.register_initializer "config_variables" config_variables; @@ -655,4 +661,5 @@ let _ = no_flat_float_array; shared_libraries; native_compiler; + afl_support; ] diff --git a/ocamltest/ocaml_actions.mli b/ocamltest/ocaml_actions.mli index 4dd4198e8..5b70c33d9 100644 --- a/ocamltest/ocaml_actions.mli +++ b/ocamltest/ocaml_actions.mli @@ -43,3 +43,5 @@ val no_flat_float_array : Actions.t val shared_libraries : Actions.t val native_compiler : Actions.t + +val afl_support : Actions.t diff --git a/ocamltest/ocamltest_config.ml.in b/ocamltest/ocamltest_config.ml.in index 3e7886af9..8bdc98351 100644 --- a/ocamltest/ocamltest_config.ml.in +++ b/ocamltest/ocamltest_config.ml.in @@ -17,6 +17,8 @@ let arch = "@@ARCH@@" +let afl_support = @@AFL_SUPPORT@@ + let shared_libraries = @@SHARED_LIBRARIES@@ let libunix = @@UNIX@@ diff --git a/ocamltest/ocamltest_config.mli b/ocamltest/ocamltest_config.mli index ac8660d4c..6808c76db 100644 --- a/ocamltest/ocamltest_config.mli +++ b/ocamltest/ocamltest_config.mli @@ -18,6 +18,9 @@ val arch : string (** Architecture for the native compiler, "none" if it is disabled *) +val afl_support : bool +(** Whether AFL support has been enabled in the compiler *) + val shared_libraries : bool (** [true] if shared libraries are supported, [false] otherwise *)