1 //===-- sanitizer_nolibc_test.cpp -----------------------------------------===// 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 // This file is a part of ThreadSanitizer/AddressSanitizer runtime. 10 // Tests for libc independence of sanitizer_common. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "sanitizer_common/sanitizer_platform.h" 15 16 #include "gtest/gtest.h" 17 18 #include <stdlib.h> 19 20 extern const char *argv0; 21 22 #if SANITIZER_LINUX && defined(__x86_64__) TEST(SanitizerCommon,NolibcMain)23TEST(SanitizerCommon, NolibcMain) { 24 std::string NolibcTestPath = argv0; 25 NolibcTestPath += "-Nolibc"; 26 int status = system(NolibcTestPath.c_str()); 27 EXPECT_EQ(true, WIFEXITED(status)); 28 EXPECT_EQ(0, WEXITSTATUS(status)); 29 } 30 #endif 31