summaryrefslogtreecommitdiffstats
path: root/src/test/encoding/import-generated.sh
blob: c328e6fd854de8bc960c0db65f4e8d3a537c8bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh -e

archive=$1

[ -d "$archive" ] || echo "usage: $0 <archive>"

ver=`bin/ceph-dencoder version`
echo "version $ver"

[ -d "$archive/$ver" ] || mkdir "$archive/$ver"

tmp1=`mktemp /tmp/typ-XXXXXXXXX`

echo "numgen\ttype"
for type in `bin/ceph-dencoder list_types`; do

    [ -d "$archive/$ver/objects/$type" ] || mkdir -p "$archive/$ver/objects/$type"

    num=`bin/ceph-dencoder type $type count_tests`
    echo "$num\t$type"
    max=$(($num - 1))
    for n in `seq 0 $max`; do
	bin/ceph-dencoder type $type select_test $n encode export $tmp1
	md=`md5sum $tmp1 | awk '{print $1}'`
	echo "\t$md"
	[ -e "$archive/$ver/objects/$type/$md" ] || cp $tmp1 $archive/$ver/objects/$type/$md
    done
done

rm $tmp1