1 //===-- scudo_unit_test_main.cpp --------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "tests/scudo_unit_test.h" 10 11 // Match Android's default configuration, which disables Scudo's mismatch 12 // allocation check, as it is being triggered by some third party code. 13 #if SCUDO_ANDROID 14 #define DEALLOC_TYPE_MISMATCH "false" 15 #else 16 #define DEALLOC_TYPE_MISMATCH "true" 17 #endif 18 19 // This allows us to turn on/off a Quarantine for specific tests. The Quarantine 20 // parameters are on the low end, to avoid having to loop excessively in some 21 // tests. 22 bool UseQuarantine = true; 23 extern "C" __attribute__((visibility("default"))) const char * __scudo_default_options()24__scudo_default_options() { 25 if (!UseQuarantine) 26 return "dealloc_type_mismatch=" DEALLOC_TYPE_MISMATCH; 27 return "quarantine_size_kb=256:thread_local_quarantine_size_kb=128:" 28 "quarantine_max_chunk_size=512:" 29 "dealloc_type_mismatch=" DEALLOC_TYPE_MISMATCH; 30 } 31 32 // The zxtest library provides a default main function that does the same thing 33 // for Fuchsia builds. 34 #if !SCUDO_FUCHSIA main(int argc,char ** argv)35int main(int argc, char **argv) { 36 testing::InitGoogleTest(&argc, argv); 37 return RUN_ALL_TESTS(); 38 } 39 #endif 40