1 //===-- sanitizer_nolibc_test.cc ------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of ThreadSanitizer/AddressSanitizer runtime.
11 // Tests for libc independence of sanitizer_common.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "sanitizer_common/sanitizer_platform.h"
16 
17 #include "gtest/gtest.h"
18 
19 #include <stdlib.h>
20 
21 extern const char *argv0;
22 
23 #if SANITIZER_LINUX && defined(__x86_64__)
TEST(SanitizerCommon,NolibcMain)24 TEST(SanitizerCommon, NolibcMain) {
25   std::string NolibcTestPath = argv0;
26   NolibcTestPath += "-Nolibc";
27   int status = system(NolibcTestPath.c_str());
28   EXPECT_EQ(true, WIFEXITED(status));
29   EXPECT_EQ(0, WEXITSTATUS(status));
30 }
31 #endif
32