chiark / gitweb /
syntax: Support &: literal (for make `grouped' multiple targets)
[subdirmk.git] / tests / advance-tested
1 #!/bin/bash
2 # subdirmk - test suite runner helper script
3 # Copyright various contributors - see top level README.
4 # SPDX-License-Identifier: LGPL-2.0-or-later
5 # There is NO WARRANTY.
6
7 set -e
8
9 branch=$(git symbolic-ref -q HEAD || test $? = 1)
10 base=$(git merge-base tested HEAD)
11
12 git branch -D test-failed 2>&1 ||:
13
14 case "$branch" in
15 refs/heads/tested|refs/heads/test-failed)
16         echo >&2 "unexpectedly on branch $branch"; exit 1 ;;
17 refs/heads/*)
18         branch=${branch#refs/heads/} ;;
19 *)
20         branch='';
21 esac
22
23 restore-branch () {
24         if [ "$branch" ]; then git checkout $branch; fi
25 }
26
27 git checkout --detach
28 git clean -xdff
29
30 if ! git rebase --exec 'tests/check && git branch -f tested' $base; then
31         git branch -f test-failed
32         git rebase --abort
33         echo >&2 '^ ignore previous message from git-rebase!'
34         echo >&2 'Test failed, made local branch ref test-failed'
35         restore-branch
36         exit 1
37 fi
38
39 restore-branch