diff options
Diffstat (limited to 'scripts/contrib/patchtest.sh')
| -rwxr-xr-x | scripts/contrib/patchtest.sh | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/scripts/contrib/patchtest.sh b/scripts/contrib/patchtest.sh deleted file mode 100755 index b1e1ea334b..0000000000 --- a/scripts/contrib/patchtest.sh +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # patchtest: Run patchtest on commits starting at master | ||
| 4 | # | ||
| 5 | # Copyright (c) 2017, Intel Corporation. | ||
| 6 | # | ||
| 7 | # SPDX-License-Identifier: GPL-2.0-or-later | ||
| 8 | # | ||
| 9 | |||
| 10 | set -o errexit | ||
| 11 | |||
| 12 | # Default values | ||
| 13 | pokydir='' | ||
| 14 | |||
| 15 | usage() { | ||
| 16 | CMD=$(basename $0) | ||
| 17 | cat <<EOM | ||
| 18 | Usage: $CMD [-h] [-p pokydir] | ||
| 19 | -p pokydir Defaults to current directory | ||
| 20 | EOM | ||
| 21 | >&2 | ||
| 22 | exit 1 | ||
| 23 | } | ||
| 24 | |||
| 25 | function clone() { | ||
| 26 | local REPOREMOTE=$1 | ||
| 27 | local REPODIR=$2 | ||
| 28 | if [ ! -d $REPODIR ]; then | ||
| 29 | git clone $REPOREMOTE $REPODIR --quiet | ||
| 30 | else | ||
| 31 | ( cd $REPODIR; git pull --quiet ) | ||
| 32 | fi | ||
| 33 | } | ||
| 34 | |||
| 35 | while getopts ":p:h" opt; do | ||
| 36 | case $opt in | ||
| 37 | p) | ||
| 38 | pokydir=$OPTARG | ||
| 39 | ;; | ||
| 40 | h) | ||
| 41 | usage | ||
| 42 | ;; | ||
| 43 | \?) | ||
| 44 | echo "Invalid option: -$OPTARG" >&2 | ||
| 45 | usage | ||
| 46 | ;; | ||
| 47 | :) | ||
| 48 | echo "Option -$OPTARG requires an argument." >&2 | ||
| 49 | usage | ||
| 50 | ;; | ||
| 51 | esac | ||
| 52 | done | ||
| 53 | shift $((OPTIND-1)) | ||
| 54 | |||
| 55 | CDIR="$PWD" | ||
| 56 | |||
| 57 | # default pokydir to current directory if user did not specify one | ||
| 58 | if [ -z "$pokydir" ]; then | ||
| 59 | pokydir="$CDIR" | ||
| 60 | fi | ||
| 61 | |||
| 62 | PTENV="$PWD/patchtest" | ||
| 63 | PT="$PTENV/patchtest" | ||
| 64 | PTOE="$PTENV/patchtest-oe" | ||
| 65 | |||
| 66 | if ! which virtualenv > /dev/null; then | ||
| 67 | echo "Install virtualenv before proceeding" | ||
| 68 | exit 1; | ||
| 69 | fi | ||
| 70 | |||
| 71 | # activate the virtual env | ||
| 72 | virtualenv $PTENV --quiet | ||
| 73 | source $PTENV/bin/activate | ||
| 74 | |||
| 75 | cd $PTENV | ||
| 76 | |||
| 77 | # clone or pull | ||
| 78 | clone git://git.yoctoproject.org/patchtest $PT | ||
| 79 | clone git://git.yoctoproject.org/patchtest-oe $PTOE | ||
| 80 | |||
| 81 | # install requirements | ||
| 82 | pip install -r $PT/requirements.txt --quiet | ||
| 83 | pip install -r $PTOE/requirements.txt --quiet | ||
| 84 | |||
| 85 | PATH="$PT:$PT/scripts:$PATH" | ||
| 86 | |||
| 87 | # loop through parent to HEAD and execute patchtest on each commit | ||
| 88 | for commit in $(git rev-list master..HEAD --reverse) | ||
| 89 | do | ||
| 90 | shortlog="$(git log "$commit^1..$commit" --pretty='%h: %aN: %cd: %s')" | ||
| 91 | log="$(git format-patch "$commit^1..$commit" --stdout | patchtest - -r $pokydir -s $PTOE/tests --base-commit $commit^1 --json 2>/dev/null | create-summary --fail --only-results)" | ||
| 92 | if [ -z "$log" ]; then | ||
| 93 | shortlog="$shortlog: OK" | ||
| 94 | else | ||
| 95 | shortlog="$shortlog: FAIL" | ||
| 96 | fi | ||
| 97 | echo "$shortlog" | ||
| 98 | echo "$log" | sed -n -e '/Issue/p' -e '/Suggested fix/p' | ||
| 99 | echo "" | ||
| 100 | done | ||
| 101 | |||
| 102 | deactivate | ||
| 103 | |||
| 104 | cd $CDIR | ||
