From bf40de4cddbf3a6c824d74e551222fd5749524d2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 5 Jul 2018 01:27:09 +0100 Subject: [PATCH] TEST --- tests/tests/sourceonlypolicy | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 tests/tests/sourceonlypolicy diff --git a/tests/tests/sourceonlypolicy b/tests/tests/sourceonlypolicy new file mode 100755 index 00000000..9a818fab --- /dev/null +++ b/tests/tests/sourceonlypolicy @@ -0,0 +1,77 @@ +#!/bin/bash +set -e +. tests/lib + +t-tstunt-parsechangelog + +t-prep-newpackage example 1.0 + +cd $p +revision=1 + +dgit-with-policy () { + local policy=$1 + t-dgit -cdgit-distro.test-dummy.source-only-uploads=$policy "$@" +} + +t-expect-fail '' \ +t-dgit-with-policy not-wholly-new push + +t-dgit -c dgit-distr push --new + +git tag start + +echo DUMMY >some-file +git add some-file +git commit -m some-file +taint=`git rev-parse HEAD` +t-policy-admin taint --global $taint dummy +git reset --hard HEAD~ + +t-commit 'Make something to autotaint' +t-dgit build +t-dgit push --new + +autotaint=`t-git-get-ref "refs/tags/$tagpfx/$v"` + +git reset --hard start +t-commit 'Thing which will autotaint' +t-dgit build + +fifo=$tmp/sqlite-cmds +mkfifo $fifo +exec 3<>$fifo +sqlite3 -interactive $tmp/git/policy.sqlite3 0<$fifo 3>&- & +sqlite3_pid=$! + +taintsout=$tmp/sqlite3.taints-out +echo >&3 'begin;'; +echo >&3 ".output $taintsout" +echo >&3 'select * from taints;'; +echo >&3 'create table dummy (x text);' + +t-dgit build + +while ! grep $taint $taintsout; do sleep 0.1; done + +DGIT_RPD_TEST_DBLOOP_HOOK=' + print STDERR "DBLOOP HOOK $sleepy\n"; + $poldbh->sqlite_busy_timeout(2500); + if ($sleepy > 2) { + system '\'' + set -ex + echo >'"$fifo"' "rollback;" + touch '"$tmp/sqlite3.rolled-back"' + '\'' and die "$? $!"; + } +' \ +t-dgit push --deliberately-not-fast-forward + +exec 3>&- +wait $sqlite3_pid + +ls $tmp/sqlite3.rolled-back + +t-policy-admin list-taints | tee $tmp/taints-list | grep $autotaint + +t-ok -- 2.30.2