summaryrefslogtreecommitdiff
path: root/test/suites/ivfsoverlay.bash
blob: ca8822170338330222871b6b376c68378bd5fcea (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
42
43
44
SUITE_ivfsoverlay_PROBE() {
    if ! $COMPILER_TYPE_CLANG; then
        echo "-ivfsoverlay not supported by compiler"
    else
        touch test.c
        cat <<EOF >test.yaml
{"case-sensitive":"false","roots":[],"version":0}
EOF
        $COMPILER -ivfsoverlay test.yaml test.c -S || echo "compiler does not support -ivfsoverlay"
    fi
}

SUITE_ivfsoverlay_SETUP() {
    unset CCACHE_NODIRECT

    cat <<EOF >test.yaml
{"case-sensitive":"false","roots":[],"version":0}
EOF
    cat <<EOF >test.c
// test.c
int test;
EOF
}

SUITE_ivfsoverlay() {
    # -------------------------------------------------------------------------
    TEST "without sloppy ivfsoverlay"

    $CCACHE_COMPILE -ivfsoverlay test.yaml -c test.c
    expect_stat 'cache hit (direct)' 0
    expect_stat 'cache miss' 0
    expect_stat 'unsupported compiler option' 1

    # -------------------------------------------------------------------------
    TEST "with sloppy ivfsoverlay"

    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS ivfsoverlay" $CCACHE_COMPILE -ivfsoverlay test.yaml -c test.c
    expect_stat 'cache hit (direct)' 0
    expect_stat 'cache miss' 1

    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS ivfsoverlay" $CCACHE_COMPILE -ivfsoverlay test.yaml -c test.c
    expect_stat 'cache hit (direct)' 1
    expect_stat 'cache miss' 1
}