Home | History | Annotate | Download | only in unit
      1 //===-- tsan_flags_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 (TSan), a race detector.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 #include "tsan_flags.h"
     14 #include "tsan_rtl.h"
     15 #include "gtest/gtest.h"
     16 
     17 namespace __tsan {
     18 
     19 TEST(Flags, Basic) {
     20   ScopedInRtl in_rtl;
     21   // At least should not crash.
     22   Flags f;
     23   InitializeFlags(&f, 0);
     24   InitializeFlags(&f, "");
     25 }
     26 
     27 TEST(Flags, DefaultValues) {
     28   ScopedInRtl in_rtl;
     29   Flags f;
     30 
     31   f.enable_annotations = false;
     32   f.exitcode = -11;
     33   InitializeFlags(&f, "");
     34   EXPECT_EQ(66, f.exitcode);
     35   EXPECT_EQ(true, f.enable_annotations);
     36 }
     37 
     38 }  // namespace __tsan
     39