Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / site / docs / dev / testing / xsan.md
1
2 ---
3 title: "MSAN, ASAN, & TSAN"
4 linkTitle: "MSAN, ASAN, & TSAN"
5
6 ---
7
8
9 *Testing Skia with memory, address, and thread santizers.*
10
11 Compiling Skia with ASAN, UBSAN, or TSAN can be done with the latest version of Clang.
12
13 - UBSAN works on Linux, Mac, Android, and Windows, though some checks are platform-specific.
14 - ASAN works on Linux, Mac, Android, and Windows.
15 - TSAN works on Linux and Mac.
16 - MSAN works on Linux[1].
17
18 We find that testing sanitizer builds with libc++ uncovers more issues than
19 with the system-provided C++ standard library, which is usually libstdc++.
20 libc++ proactively hooks into sanitizers to help their analyses.
21 We ship a copy of libc++ with our Linux toolchain in /lib.
22
23 [1]To compile and run with MSAN, an MSAN-instrumented version of libc++ is needed.
24 It's generally easiest to run one of the following 2 steps to build/download a recent version
25 of Clang and the instrumented libc++, located in /msan.
26
27 Downloading Clang binaries (Googlers Only)
28 ------------------------------------------
29 This requires gsutil, part of the [gcloud sdk](https://cloud.google.com/sdk/downloads).
30
31 <!--?prettify lang=sh?-->
32
33     CLANGDIR="${HOME}/clang"
34     ./bin/sk asset download clang_linux $CLANGDIR
35
36 Building Clang binaries from scratch (Other users)
37 ---------------------------
38
39 <!--?prettify lang=sh?-->
40
41     CLANGDIR="${HOME}/clang"
42
43     python3 tools/git-sync-deps
44     CC= CXX= infra/bots/assets/clang_linux/create.py -t "$CLANGDIR"
45
46 Configure and Compile Skia with MSAN
47 ------------------------------------
48
49 <!--?prettify lang=sh?-->
50
51     CLANGDIR="${HOME}/clang"
52     mkdir -p out/msan
53     cat > out/msan/args.gn <<- EOF
54         cc = "${CLANGDIR}/bin/clang"
55         cxx = "${CLANGDIR}/bin/clang++"
56         extra_cflags = [ "-B${CLANGDIR}/bin" ]
57         extra_ldflags = [
58             "-B${CLANGDIR}/bin",
59             "-fuse-ld=lld",
60             "-L${CLANGDIR}/msan",
61             "-Wl,-rpath,${CLANGDIR}/msan" ]
62         sanitize = "MSAN"
63         skia_use_fontconfig = false
64     EOF
65     python3 tools/git-sync-deps
66     bin/gn gen out/msan
67     ninja -C out/msan
68
69 Configure and Compile Skia with ASAN
70 ------------------------------------
71
72 <!--?prettify lang=sh?-->
73
74     CLANGDIR="${HOME}/clang"
75     mkdir -p out/asan
76     cat > out/asan/args.gn <<- EOF
77         cc = "${CLANGDIR}/bin/clang"
78         cxx = "${CLANGDIR}/bin/clang++"
79         sanitize = "ASAN"
80         extra_ldflags = [ "-fuse-ld=lld", "-Wl,-rpath,${CLANGDIR}/lib" ]
81     EOF
82     python3 tools/git-sync-deps
83     bin/gn gen out/asan
84     ninja -C out/asan
85
86 Configure and Compile Skia with TSAN
87 ------------------------------------
88
89 <!--?prettify lang=sh?-->
90
91     CLANGDIR="${HOME}/clang"
92     mkdir -p out/tsan
93     cat > out/tsan/args.gn <<- EOF
94         cc = "${CLANGDIR}/bin/clang"
95         cxx = "${CLANGDIR}/bin/clang++"
96         sanitize = "TSAN"
97         is_debug = false
98         extra_ldflags = [ "-Wl,-rpath,${CLANGDIR}/lib" ]
99     EOF
100     python3 tools/git-sync-deps
101     bin/gn gen out/tsan
102     ninja -C out/tsan
103
104