summaryrefslogtreecommitdiffstats
path: root/tests/deckard/ci/compare-rplint.sh
blob: 0146dc91f82345db84f98cb8cb1a587eb59bb7b9 (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
#!/bin/bash
set -o nounset -o xtrace -o errexit
source "$(dirname "$(readlink -f "$0")")/common.sh"


function find_new_tests {
	: detect tests affected by current merge request
	: store list of modified tests in ${NEW_TESTS_FILE}
  git diff --name-only --diff-filter=AM ${MERGEBASE} ${HEAD} | fgrep .rpl > "${NEW_TESTS_FILE}" || : no new tests detected
}

NEW_TESTS_FILE="/tmp/new_tests"
find_new_tests

truncate -s0 /tmp/rplint_fails

: run rplint of all new tests
FAIL=0
cat /tmp/new_tests
for test in $(cat ${NEW_TESTS_FILE})
do
  ${PYTHON} -m rplint $test >> /tmp/rplint_fails || FAIL=1
done

: if even one of the test does not pass rplint, fail
if [ "$FAIL" -eq 1 ]
then
  cat /tmp/rplint_fails
  exit 1
fi
exit 0