xref: /netbsd-src/external/ibm-public/postfix/dist/src/util/lmdb_cache_test_1.sh (revision 16d67a18c4cbb2d3cb426b01120f4938ca6dbbf9)
1#!/bin/sh
2
3# Torture test: run update and purge operations in parallel processes.
4# This will result in some purge operations not finding all entries,
5# but the final sequential purge should eliminate all.
6
7set -e
8
9rm -f foo.lmdb
10./dict_cache <<EOF
11lmdb_map_size 20000
12cache lmdb:foo
13EOF
14
15(./dict_cache <<EOF
16cache lmdb:foo
17update x ${1-10000}
18run 
19update y ${1-10000}
20purge x
21run 
22purge y
23run 
24EOF
25) &
26
27(./dict_cache <<EOF
28cache lmdb:foo
29update a ${1-10000}
30run 
31update b ${1-10000}
32purge a
33run 
34purge b
35run 
36EOF
37) &
38
39wait
40
41./dict_cache <<EOF
42cache lmdb:foo
43purge a
44run
45purge b
46run
47purge x
48run
49purge y
50run
51EOF
52
53../../bin/postmap -s lmdb:foo | diff /dev/null -
54
55rm -f foo.lmdb
56