diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-01-01 14:03:53 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-01-01 14:03:53 +0000 |
commit | 1571d26b79989aadf62d2559a69c3e1f31120d5f (patch) | |
tree | 820dfe96b485bc9881fb042a03932683e860f3f3 /test-locking | |
parent | 5a121bfa8bc008fef71aa5b2cbbfe15240a01729 (diff) | |
download | obnam-1571d26b79989aadf62d2559a69c3e1f31120d5f.tar.gz |
add script for testing locking
This currently fails, because locking isn't properly implemented in obnam.
Diffstat (limited to 'test-locking')
-rwxr-xr-x | test-locking | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test-locking b/test-locking new file mode 100755 index 00000000..86f043e1 --- /dev/null +++ b/test-locking @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Obnam test: test locking with multiple clients accessing the same repo. +# +# Copyright 2012 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +die() +{ + echo "$@" 1>&2 + exit 1 +} + +[ "$#" = 2 ] || die "Bad usage, read source!" + +NCLIENTS="$1" +repo="$2" +pids="$(mktemp)" + +for i in $(seq "$NCLIENTS") +do + ./test-many-generations 1 "$repo" "client-$i" & + echo "$!" >> "$pids" +done + +errors=0 +for pid in $(cat "$pids") +do + if ! wait "$pid" + then + echo "at least one client failed" 1>&2 + errors=1 + fi +done + +rm -f "$pids" +exit $errors + |