2007-01-04 07:23:48 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
2007-07-20 07:43:49 -05:00
|
|
|
#
|
|
|
|
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
|
|
|
|
#
|
2010-11-30 04:41:59 -06:00
|
|
|
# This file is part of util-linux.
|
2007-07-20 07:43:49 -05:00
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This file is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
2007-01-04 07:23:48 -06:00
|
|
|
|
2009-01-19 15:36:27 -06:00
|
|
|
TS_TOPDIR=$(cd $(dirname $0) && pwd)
|
2011-11-03 07:20:24 -05:00
|
|
|
SUBTESTS=
|
|
|
|
OPTS=
|
|
|
|
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
case "$1" in
|
|
|
|
--force)
|
|
|
|
OPTS="$OPTS --force"
|
|
|
|
;;
|
|
|
|
--fake)
|
|
|
|
OPTS="$OPTS --fake"
|
|
|
|
;;
|
|
|
|
--*)
|
|
|
|
echo "Unknown option $1"
|
|
|
|
echo "Usage: run [--fake] [--force] [<component> ...]"
|
2009-01-19 11:27:15 -06:00
|
|
|
exit 1
|
2011-11-03 07:20:24 -05:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
SUBTESTS="$SUBTESTS $1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$SUBTESTS" ]; then
|
|
|
|
# selected tests only
|
|
|
|
for s in $SUBTESTS; do
|
|
|
|
if [ -d "$TS_TOPDIR/ts/$s" ]; then
|
|
|
|
co=$(find $TS_TOPDIR/ts/$s -type f -perm /a+x -regex ".*/[^\.~]*" | sort)
|
|
|
|
comps="$comps $co"
|
|
|
|
else
|
|
|
|
echo "Unknown test component '$s'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
|
|
|
# all tests
|
|
|
|
comps=$(find $TS_TOPDIR/ts/ -type f -perm /a+x -regex ".*/[^\.~]*" | sort)
|
2009-01-19 11:27:15 -06:00
|
|
|
fi
|
|
|
|
|
2007-01-04 07:23:48 -06:00
|
|
|
echo
|
2010-12-01 15:06:15 -06:00
|
|
|
echo "------------------ Utils-linux regression tests ------------------"
|
2007-01-04 07:23:48 -06:00
|
|
|
echo
|
2007-08-07 17:42:29 -05:00
|
|
|
echo " For development purpose only. "
|
|
|
|
echo " Don't execute on production system! "
|
|
|
|
echo
|
2007-01-04 07:23:48 -06:00
|
|
|
|
|
|
|
res=0
|
|
|
|
count=0
|
2009-01-19 11:27:15 -06:00
|
|
|
for ts in $comps; do
|
2011-11-03 07:20:24 -05:00
|
|
|
$ts "$OPTS"
|
2007-01-04 07:23:48 -06:00
|
|
|
res=$(( $res + $? ))
|
|
|
|
count=$(( $count + 1 ))
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "---------------------------------------------------------------------"
|
|
|
|
if [ $res -eq 0 ]; then
|
|
|
|
echo " All $count tests PASSED"
|
2007-01-27 18:24:15 -06:00
|
|
|
res=0
|
2007-01-04 07:23:48 -06:00
|
|
|
else
|
|
|
|
echo " $res tests of $count FAILED"
|
2007-01-27 18:24:15 -06:00
|
|
|
res=1
|
2007-01-04 07:23:48 -06:00
|
|
|
fi
|
|
|
|
echo "---------------------------------------------------------------------"
|
2007-01-27 18:24:15 -06:00
|
|
|
exit $res
|