Browse Source

Moved devtools/nofuzz to library/cpp/testing/nofuzz

prettyboy 1 year ago
parent
commit
5ab38ec7a8

+ 1 - 1
build/ymake.core.conf

@@ -1273,7 +1273,7 @@ module FUZZ: _BASE_PROGRAM {
     }
 
     when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
-        PEERDIR+=devtools/nofuzz
+        PEERDIR+=library/cpp/testing/nofuzz
     }
 
     ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)

+ 37 - 0
library/cpp/testing/nofuzz/mock_san.cpp

@@ -0,0 +1,37 @@
+#include <stddef.h>
+#include <stdio.h>
+
+#ifndef Y_UNUSED
+#define Y_UNUSED(var) (void)(var)
+#endif
+
+static class Informer {
+public:
+    Informer() {
+        fprintf(stderr, "WARNING: Binary built without instrumentation module"
+            " - see https://docs.yandex-team.ru/ya-make/manual/tests/fuzzing for proper build command\n");
+        fflush(stderr);
+    }
+} informer;
+
+extern "C" {
+
+void __sanitizer_set_death_callback(void (*callback)(void)) {
+    Y_UNUSED(callback);
+}
+
+void __sanitizer_reset_coverage(void) {
+}
+
+void __sanitizer_update_counter_bitset_and_clear_counters(size_t) {
+}
+
+size_t __sanitizer_get_number_of_counters(void) {
+    return 0;
+}
+
+size_t __sanitizer_get_total_unique_coverage(void) {
+    return 0;
+}
+
+} // extern "C"

+ 5 - 0
library/cpp/testing/nofuzz/ya.make

@@ -0,0 +1,5 @@
+LIBRARY()
+
+SRCS(GLOBAL mock_san.cpp)
+
+END()