##// END OF EJS Templates
scripts/validate-commits: use direct /bin/bash interpreter...
Thomas De Schampheleire -
r7789:37ac2ac0 default
parent child Browse files
Show More
@@ -1,64 +1,64 b''
1 #!/usr/bin/env bash
1 #!/bin/bash
2 # Validate the specified commits against test suite and other checks.
2 # Validate the specified commits against test suite and other checks.
3
3
4 if [ -n "$VIRTUAL_ENV" ]; then
4 if [ -n "$VIRTUAL_ENV" ]; then
5 echo "Please run this script from outside a virtualenv."
5 echo "Please run this script from outside a virtualenv."
6 exit 1
6 exit 1
7 fi
7 fi
8
8
9 if ! hg update --check -q .; then
9 if ! hg update --check -q .; then
10 echo "Working dir is not clean, please commit/revert changes first."
10 echo "Working dir is not clean, please commit/revert changes first."
11 exit 1
11 exit 1
12 fi
12 fi
13
13
14 venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX)
14 venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX)
15 resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX)
15 resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX)
16 echo > "$resultfile"
16 echo > "$resultfile"
17
17
18 cleanup()
18 cleanup()
19 {
19 {
20 rm -rf /tmp/kallithea-test*
20 rm -rf /tmp/kallithea-test*
21 rm -rf "$venv"
21 rm -rf "$venv"
22 }
22 }
23 finish()
23 finish()
24 {
24 {
25 cleanup
25 cleanup
26 # print (possibly intermediate) results
26 # print (possibly intermediate) results
27 cat "$resultfile"
27 cat "$resultfile"
28 rm "$resultfile"
28 rm "$resultfile"
29 }
29 }
30 trap finish EXIT
30 trap finish EXIT
31
31
32 for rev in $(hg log -r "$1" -T '{node}\n'); do
32 for rev in $(hg log -r "$1" -T '{node}\n'); do
33 hg log -r "$rev"
33 hg log -r "$rev"
34 hg update "$rev"
34 hg update "$rev"
35
35
36 cleanup
36 cleanup
37 virtualenv -p "$(command -v python2)" "$venv"
37 virtualenv -p "$(command -v python2)" "$venv"
38 source "$venv/bin/activate"
38 source "$venv/bin/activate"
39 pip install --upgrade pip setuptools
39 pip install --upgrade pip setuptools
40 pip install -e . -r dev_requirements.txt python-ldap python-pam
40 pip install -e . -r dev_requirements.txt python-ldap python-pam
41
41
42 # run-all-cleanup
42 # run-all-cleanup
43 scripts/run-all-cleanup
43 scripts/run-all-cleanup
44 if ! hg update --check -q .; then
44 if ! hg update --check -q .; then
45 echo "run-all-cleanup did not give clean results!"
45 echo "run-all-cleanup did not give clean results!"
46 result="NOK"
46 result="NOK"
47 hg diff
47 hg diff
48 hg revert -a
48 hg revert -a
49 else
49 else
50 result=" OK"
50 result=" OK"
51 fi
51 fi
52 echo "$result: $rev (run-all-cleanup)" >> "$resultfile"
52 echo "$result: $rev (run-all-cleanup)" >> "$resultfile"
53
53
54 # pytest
54 # pytest
55 if py.test; then
55 if py.test; then
56 result=" OK"
56 result=" OK"
57 else
57 else
58 result="NOK"
58 result="NOK"
59 fi
59 fi
60 echo "$result: $rev (pytest)" >> "$resultfile"
60 echo "$result: $rev (pytest)" >> "$resultfile"
61
61
62 deactivate
62 deactivate
63 echo
63 echo
64 done
64 done
General Comments 0
You need to be logged in to leave comments. Login now