From: Simon Wilkinson Date: Sun, 13 Mar 2011 14:45:04 +0000 (+0000) Subject: pt_util: Initialise empty database correctly X-Git-Tag: debian/1.6.0.pre3-1~5^2^2~8 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=fbd4a43ddf5131cb597d46cff0419e7685e3210d;p=packages%2Fo%2Fopenafs.git pt_util: Initialise empty database correctly Commit dc8f18d6f5003712bc9ef989363137a84953df07 broke pt_util's initialisation of empty databases. This is because Initdb was changed to call Initdb_check through the ubik_CheckCache wrapper. However, that wrapper was defined as a no-op in pt_util's ubik-shim. Modify pt_util's ubik_CheckCache so that it always calls into the wrapper routine - this mimics the old behaviour. Add a trival test for pt_util - check that we can build the database, using the example from the manpage, and then that the built database matches what we expect. (cherry picked from commit 4953ce8070497bc494e624d72271bcbc5dc1dbe7) Reviewed-on: http://gerrit.openafs.org/4211 Tested-by: BuildBot Reviewed-by: Derrick Brashear Change-Id: If4cfbda25f8d1c5e1da4c1e42982c74becf386e3 Reviewed-on: http://gerrit.openafs.org/4217 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/ptserver/ubik.c b/src/ptserver/ubik.c index b8c772c09..53c8bcfc0 100644 --- a/src/ptserver/ubik.c +++ b/src/ptserver/ubik.c @@ -101,7 +101,7 @@ ubik_WaitVersion(struct ubik_dbase *adatabase, int ubik_CheckCache(struct ubik_trans *atrans, ubik_updatecache_func cbf, void *rock) { - return (0); + return (*cbf)(atrans, rock); } void diff --git a/tests/TESTS b/tests/TESTS index 03b038e93..df59887ab 100644 --- a/tests/TESTS +++ b/tests/TESTS @@ -1,2 +1,3 @@ util/ktime util/exec-alt +ptserver/pt_util diff --git a/tests/ptserver/pt_util-t b/tests/ptserver/pt_util-t new file mode 100755 index 000000000..8d3cdcb87 --- /dev/null +++ b/tests/ptserver/pt_util-t @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use File::Basename; +use Test::More tests=>2; + +my $builddir = $ENV{BUILD}; +if (!$builddir) { + $builddir = dirname($0)."/.."; +} + +$builddir.="/.."; + +my $prdbfile = "/tmp/prdbtest.$$"; + +my $instructions = <