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