chiark / gitweb /
Avoid use of "my $_", which is not portable
[dgit.git] / tests / tests / debpolicy-dbretry
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 t-tstunt-parsechangelog
6
7 t-debpolicy
8 t-prep-newpackage example 1.0
9
10 cd $p
11 revision=1
12 git tag start
13
14 echo DUMMY >some-file
15 git add some-file
16 git commit -m some-file
17 taint=`git rev-parse HEAD`
18 t-policy-admin taint --global $taint dummy
19 git reset --hard HEAD~
20
21 t-commit 'Make something to autotaint'
22 t-dgit build
23 t-dgit push --new
24
25 autotaint=`t-git-get-ref "refs/tags/debian/$v"`
26
27 git reset --hard start
28 t-commit 'Thing which will autotaint'
29 t-dgit build
30
31 fifo=$tmp/sqlite-cmds
32 mkfifo $fifo
33 exec 3<>$fifo
34 sqlite3 -interactive $tmp/git/policy.sqlite3 0<$fifo 3>&- &
35 sqlite3_pid=$!
36
37 taintsout=$tmp/sqlite3.taints-out
38 echo >&3 'begin;';
39 echo >&3 ".output $taintsout"
40 echo >&3 'select * from taints;';
41 echo >&3 'create table dummy (x text);'
42
43 while ! grep $taint $taintsout; do sleep 0.1; done
44
45 t-dgit build
46
47 DGIT_DRS_RPD_TEST_DBLOOP_HOOK='
48         print STDERR "DBLOOP HOOK $sleepy\n";
49         $poldbh->sqlite_busy_timeout(500);
50         if ($sleepy > 2) {
51                 system '\''
52                         set -ex
53                         echo >'"$fifo"' "rollback;"
54                         touch '"$tmp/sqlite3.rolled-back"'
55                 '\'' and die "$? $!";
56         }
57 ' \
58 t-dgit push --deliberately-not-fast-forward
59
60 exec 3>&-
61 wait $sqlite3_pid
62
63 ls $tmp/sqlite3.rolled-back
64
65 t-policy-admin list-taints | tee $tmp/taints-list | grep $autotaint
66
67 echo ok.