Upload Tizen:Base source
[framework/base/util-linux-ng.git] / tests / run.sh
1 #!/bin/bash
2
3 #
4 # Copyright (C) 2007 Karel Zak <kzak@redhat.com>
5 #
6 # This file is part of util-linux-ng.
7 #
8 # This file is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This file is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18
19 TS_TOPDIR=$(cd $(dirname $0) && pwd)
20 comps=$(find $TS_TOPDIR/ts/ -type f -perm /a+x -regex ".*/[^\.~]*" |  sort)
21
22 if [ -n "$1" ]; then
23         if [ -d "$TS_TOPDIR/ts/$1" ]; then
24                 comps=$(find $TS_TOPDIR/ts/$1 -type f -perm /a+x -regex ".*/[^\.~]*" |  sort)
25         else
26                 echo
27                 echo "usage: $0 [<component>]"
28                 echo "supported components:"
29                         for ts in $comps; do
30                                 echo -e "\t$(basename $(dirname $ts))"
31                         done | sort -u
32                 echo
33                 exit 1
34         fi
35 fi
36
37 echo
38 echo "------------------ Utils-linux-ng regression tests ------------------"
39 echo
40 echo "                    For development purpose only.                    "
41 echo "                 Don't execute on production system!                 "
42 echo
43
44 res=0
45 count=0
46 for ts in $comps; do
47         $ts "$1"
48         res=$(( $res + $? ))
49         count=$(( $count + 1 ))
50 done
51
52 echo
53 echo "---------------------------------------------------------------------"
54 if [ $res -eq 0 ]; then
55         echo "  All $count tests PASSED"
56         res=0
57 else
58         echo "  $res tests of $count FAILED"
59         res=1
60 fi
61 echo "---------------------------------------------------------------------"
62 exit $res