aboutsummaryrefslogtreecommitdiff
path: root/.run_formal_checks.sh
blob: 1caa2297347a02319b0d6fcb64f1b3d89a0154cc (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
#!/usr/bin/env bash
set -e

if [ $# -ne 1 ]; then
    echo "There must be exactly one argument!"
    exit -1
fi

DUT=$1

# Run formal check only for PRs
if [ $TRAVIS_PULL_REQUEST = "false" ]; then
    echo "Not a pull request, no formal check"
    exit 0
else
    # $TRAVIS_BRANCH is branch targeted by PR
    # Travis does a shallow clone, checkout PR target so that we have it
    # THen return to previous branch so HEAD points to the commit we're testing
    git remote set-branches origin $TRAVIS_BRANCH && git fetch
    git checkout $TRAVIS_BRANCH
    git checkout -
    # Skip if '[skip formal checks]' shows up in any of the commit messages in the PR
    if git log --format=%B --no-merges $TRAVIS_BRANCH..HEAD | grep '\[skip formal checks\]'; then
        echo "Commit message says to skip formal checks"
        exit 0
    else
        cp regress/$DUT.fir $DUT.fir
        ./scripts/formal_equiv.sh HEAD $TRAVIS_BRANCH $DUT
    fi
fi