aboutsummaryrefslogtreecommitdiff
path: root/lib/tsan/unit_tests/tsan_flags_test.cc
blob: d344cb55b1ba019378d20d654fce5dff2fb6feca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===-- tsan_flags_test.cc ------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of ThreadSanitizer (TSan), a race detector.
//
//===----------------------------------------------------------------------===//
#include "tsan_flags.h"
#include "tsan_rtl.h"
#include "gtest/gtest.h"

namespace __tsan {

TEST(Flags, Basic) {
  ScopedInRtl in_rtl;
  // At least should not crash.
  Flags f = {};
  InitializeFlags(&f, 0);
  InitializeFlags(&f, "");
}

TEST(Flags, DefaultValues) {
  ScopedInRtl in_rtl;
  Flags f = {};

  f.enable_annotations = false;
  f.exitcode = -11;
  InitializeFlags(&f, "");
  EXPECT_EQ(66, f.exitcode);
  EXPECT_EQ(true, f.enable_annotations);
}

}  // namespace __tsan