aboutsummaryrefslogtreecommitdiff
path: root/ci/script.sh
blob: 25914fd197e4400166ef84c4aa2b2408fa667687 (plain)
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
39
40
41
#!/usr/bin/env bash

set -eux
cd $(dirname $0)/..

export CARGO_TARGET_DIR=$(pwd)/target

pushd ./example
cargo rustc \
      --release \
      -- \
      -Cpasses='sancov' \
      -Cllvm-args=-sanitizer-coverage-level=3 \
      -Cllvm-args=-sanitizer-coverage-trace-compares \
      -Cllvm-args=-sanitizer-coverage-inline-8bit-counters \
      -Cllvm-args=-sanitizer-coverage-stack-depth \
      -Cllvm-args=-sanitizer-coverage-trace-geps \
      -Cllvm-args=-sanitizer-coverage-prune-blocks=0 \
      -Zsanitizer=address
(! $CARGO_TARGET_DIR/release/example -runs=100000)
popd

pushd ./example_arbitrary
cargo rustc \
      --release \
      -- \
      -Cpasses='sancov' \
      -Cllvm-args=-sanitizer-coverage-level=3 \
      -Cllvm-args=-sanitizer-coverage-trace-compares \
      -Cllvm-args=-sanitizer-coverage-inline-8bit-counters \
      -Cllvm-args=-sanitizer-coverage-stack-depth \
      -Cllvm-args=-sanitizer-coverage-trace-geps \
      -Cllvm-args=-sanitizer-coverage-prune-blocks=0 \
      -Zsanitizer=address
(! $CARGO_TARGET_DIR/release/example_arbitrary -runs=10000000)
RUST_LIBFUZZER_DEBUG_PATH=$(pwd)/debug_output \
    $CARGO_TARGET_DIR/release/example_arbitrary \
    $(ls ./crash-* | head -n 1)
cat $(pwd)/debug_output
grep -q Rgb $(pwd)/debug_output
popd