Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / workunits / erasure-code / encode-decode-non-regression.sh
1 #!/bin/bash -ex
2 #
3 # Copyright (C) 2014 Red Hat <contact@redhat.com>
4 #
5 # Author: Loic Dachary <loic@dachary.org>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Library Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Library Public License for more details.
16 #
17
18 : ${CORPUS:=https://github.com/ceph/ceph-erasure-code-corpus.git}
19 : ${DIRECTORY:=$CEPH_ROOT/ceph-erasure-code-corpus}
20
21 # when running from sources, the current directory must have precedence
22 export PATH=:$PATH
23
24 if ! test -d $DIRECTORY ; then
25     git clone $CORPUS $DIRECTORY
26 fi
27
28 my_version=v$(ceph --version | cut -f3 -d ' ')
29
30 all_versions=$((ls -d $DIRECTORY/v* ; echo $DIRECTORY/$my_version ) | sort)
31
32 for version in $all_versions ; do
33     if test -d $version ; then
34         $version/non-regression.sh
35     fi
36     if test $version = $DIRECTORY/$my_version ; then
37         break
38     fi
39 done