2010-04-26 17:44:05 +08:00
|
|
|
#!/bin/bash
|
2009-06-23 00:29:05 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2009 Red Hat, Inc.
|
|
|
|
# Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# This program 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 program 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.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2009-07-17 01:26:54 +08:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-06-23 00:29:05 +08:00
|
|
|
#
|
|
|
|
|
|
|
|
dd()
|
|
|
|
{
|
|
|
|
if [ "$HOSTOS" == "Linux" ]
|
2013-09-04 19:16:04 +08:00
|
|
|
then
|
|
|
|
command dd --help | grep noxfer > /dev/null 2>&1
|
|
|
|
|
|
|
|
if [ "$?" -eq 0 ]
|
|
|
|
then
|
|
|
|
command dd status=noxfer $@
|
|
|
|
else
|
|
|
|
command dd $@
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
else
|
2013-09-04 19:16:04 +08:00
|
|
|
command dd $@
|
2009-06-23 00:29:05 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-08-06 15:44:49 +08:00
|
|
|
# poke_file 'test.img' 512 '\xff\xfe'
|
|
|
|
poke_file()
|
|
|
|
{
|
|
|
|
printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null
|
|
|
|
}
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
# we need common.config
|
|
|
|
if [ "$iam" != "check" ]
|
|
|
|
then
|
|
|
|
if ! . ./common.config
|
|
|
|
then
|
|
|
|
echo "$iam: failed to source common.config"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# make sure we have a standard umask
|
|
|
|
umask 022
|
|
|
|
|
2011-01-18 01:01:17 +08:00
|
|
|
if [ "$IMGPROTO" = "file" ]; then
|
|
|
|
TEST_IMG=$TEST_DIR/t.$IMGFMT
|
2012-11-02 21:01:23 +08:00
|
|
|
elif [ "$IMGPROTO" = "nbd" ]; then
|
|
|
|
TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
|
|
|
|
TEST_IMG="nbd:127.0.0.1:10810"
|
2013-04-09 22:30:55 +08:00
|
|
|
elif [ "$IMGPROTO" = "ssh" ]; then
|
|
|
|
TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
|
|
|
|
TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE"
|
2011-01-18 01:01:17 +08:00
|
|
|
else
|
|
|
|
TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
|
2012-06-28 22:55:54 +08:00
|
|
|
function valgrind_qemu_io()
|
|
|
|
{
|
|
|
|
valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
cat /tmp/$$.valgrind
|
|
|
|
fi
|
|
|
|
rm -f /tmp/$$.valgrind
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-27 19:45:14 +08:00
|
|
|
_optstr_add()
|
|
|
|
{
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
echo "$1,$2"
|
|
|
|
else
|
|
|
|
echo "$2"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_set_default_imgopts()
|
|
|
|
{
|
|
|
|
if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
|
|
|
|
IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-09-25 20:12:20 +08:00
|
|
|
_use_sample_img()
|
|
|
|
{
|
|
|
|
SAMPLE_IMG_FILE="${1%\.bz2}"
|
|
|
|
TEST_IMG="$TEST_DIR/$SAMPLE_IMG_FILE"
|
|
|
|
bzcat "$SAMPLE_IMG_DIR/$1" > "$TEST_IMG"
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "_use_sample_img error, cannot extract '$SAMPLE_IMG_DIR/$1'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
_make_test_img()
|
|
|
|
{
|
|
|
|
# extra qemu-img options can be added by tests
|
|
|
|
# at least one argument (the image size) needs to be added
|
2012-03-15 02:57:23 +08:00
|
|
|
local extra_img_options=""
|
|
|
|
local image_size=$*
|
2012-03-27 19:45:14 +08:00
|
|
|
local optstr=""
|
2012-11-02 21:01:23 +08:00
|
|
|
local img_name=""
|
|
|
|
|
|
|
|
if [ -n "$TEST_IMG_FILE" ]; then
|
|
|
|
img_name=$TEST_IMG_FILE
|
|
|
|
else
|
|
|
|
img_name=$TEST_IMG
|
|
|
|
fi
|
2012-03-27 19:45:14 +08:00
|
|
|
|
|
|
|
if [ -n "$IMGOPTS" ]; then
|
|
|
|
optstr=$(_optstr_add "$optstr" "$IMGOPTS")
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
|
2012-03-15 02:57:23 +08:00
|
|
|
if [ "$1" = "-b" ]; then
|
|
|
|
extra_img_options="$1 $2"
|
|
|
|
image_size=$3
|
|
|
|
fi
|
2010-11-01 04:10:20 +08:00
|
|
|
if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
|
2012-03-27 19:45:14 +08:00
|
|
|
optstr=$(_optstr_add "$optstr" "cluster_size=$CLUSTER_SIZE")
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$optstr" ]; then
|
|
|
|
extra_img_options="-o $optstr $extra_img_options"
|
2009-10-02 01:29:59 +08:00
|
|
|
fi
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
# XXX(hch): have global image options?
|
2013-09-10 19:59:43 +08:00
|
|
|
$QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size 2>&1 | \
|
2012-08-09 19:17:14 +08:00
|
|
|
sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
|
|
|
|
-e "s#$TEST_DIR#TEST_DIR#g" \
|
|
|
|
-e "s#$IMGFMT#IMGFMT#g" \
|
|
|
|
-e "s# encryption=off##g" \
|
|
|
|
-e "s# cluster_size=[0-9]\\+##g" \
|
|
|
|
-e "s# table_size=[0-9]\\+##g" \
|
|
|
|
-e "s# compat='[^']*'##g" \
|
|
|
|
-e "s# compat6=\\(on\\|off\\)##g" \
|
|
|
|
-e "s# static=\\(on\\|off\\)##g" \
|
2013-05-03 09:31:40 +08:00
|
|
|
-e "s# zeroed_grain=\\(on\\|off\\)##g" \
|
|
|
|
-e "s# subformat='[^']*'##g" \
|
2013-05-03 15:31:16 +08:00
|
|
|
-e "s# adapter_type='[^']*'##g" \
|
2012-08-09 19:17:14 +08:00
|
|
|
-e "s# lazy_refcounts=\\(on\\|off\\)##g"
|
2012-11-02 21:01:23 +08:00
|
|
|
|
|
|
|
# Start an NBD server on the image file, which is what we'll be talking to
|
|
|
|
if [ $IMGPROTO = "nbd" ]; then
|
|
|
|
eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 $TEST_IMG_FILE &"
|
|
|
|
QEMU_NBD_PID=$!
|
|
|
|
sleep 1 # FIXME: qemu-nbd needs to be listening before we continue
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_cleanup_test_img()
|
|
|
|
{
|
2011-01-18 01:01:17 +08:00
|
|
|
case "$IMGPROTO" in
|
|
|
|
|
2012-11-02 21:01:23 +08:00
|
|
|
nbd)
|
|
|
|
kill $QEMU_NBD_PID
|
2013-09-25 20:12:22 +08:00
|
|
|
rm -f "$TEST_IMG_FILE"
|
2012-11-02 21:01:23 +08:00
|
|
|
;;
|
2011-01-18 01:01:17 +08:00
|
|
|
file)
|
2013-09-25 20:12:22 +08:00
|
|
|
rm -f "$TEST_DIR/t.$IMGFMT"
|
|
|
|
rm -f "$TEST_DIR/t.$IMGFMT.orig"
|
|
|
|
rm -f "$TEST_DIR/t.$IMGFMT.base"
|
2013-09-25 20:12:20 +08:00
|
|
|
if [ -n "$SAMPLE_IMG_FILE" ]
|
|
|
|
then
|
|
|
|
rm -f "$TEST_DIR/$SAMPLE_IMG_FILE"
|
|
|
|
fi
|
2011-01-18 01:01:17 +08:00
|
|
|
;;
|
|
|
|
|
|
|
|
rbd)
|
2013-09-25 20:12:22 +08:00
|
|
|
rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
|
2011-01-18 01:01:17 +08:00
|
|
|
;;
|
|
|
|
|
|
|
|
sheepdog)
|
2013-09-25 20:12:22 +08:00
|
|
|
collie vdi delete "$TEST_DIR/t.$IMGFMT"
|
2011-01-18 01:01:17 +08:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
2009-06-23 00:29:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_check_test_img()
|
|
|
|
{
|
2013-09-25 20:12:22 +08:00
|
|
|
$QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1 | _filter_testdir | \
|
2013-02-08 00:15:04 +08:00
|
|
|
sed -e '/allocated.*fragmented.*compressed clusters/d' \
|
2013-01-28 19:59:46 +08:00
|
|
|
-e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \
|
|
|
|
-e '/Image end offset: [0-9]\+/d'
|
2009-06-23 00:29:05 +08:00
|
|
|
}
|
|
|
|
|
2012-10-17 20:02:32 +08:00
|
|
|
_img_info()
|
|
|
|
{
|
qemu-iotests: Discard specific info in _img_info
In _img_info, filter out additional information specific to the image
format provided by qemu-img info, since tests designed for multiple
image formats would produce different outputs for every image format
otherwise.
In a human-readable dump, that new information will always be last for
each "image information block" (multiple blocks are emitted when
inspecting the backing file chain). Every block is separated by an empty
line. Therefore, in this case, everything starting with the line "Format
specific information:" up to that empty line (or EOF, if it is the last
block) has to be stripped.
The JSON dump will always emit pretty JSON data. Therefore, the opening
and closing braces of every object will be on lines which are indented
by exactly the same amount, and all lines in between will have more
indentation. Thus, in this case, everything starting with a line
matching the regular expression /^ *"format-specific": {/ until /^ *},?/
has to be stripped, where the number of spaces at the beginning of the
respective lines is equal.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-09 16:46:19 +08:00
|
|
|
discard=0
|
|
|
|
regex_json_spec_start='^ *"format-specific": \{'
|
2013-09-25 20:12:22 +08:00
|
|
|
$QEMU_IMG info "$@" "$TEST_IMG" 2>&1 | \
|
2012-10-17 20:02:32 +08:00
|
|
|
sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
|
|
|
|
-e "s#$TEST_DIR#TEST_DIR#g" \
|
|
|
|
-e "s#$IMGFMT#IMGFMT#g" \
|
|
|
|
-e "/^disk size:/ D" \
|
qemu-iotests: Discard specific info in _img_info
In _img_info, filter out additional information specific to the image
format provided by qemu-img info, since tests designed for multiple
image formats would produce different outputs for every image format
otherwise.
In a human-readable dump, that new information will always be last for
each "image information block" (multiple blocks are emitted when
inspecting the backing file chain). Every block is separated by an empty
line. Therefore, in this case, everything starting with the line "Format
specific information:" up to that empty line (or EOF, if it is the last
block) has to be stripped.
The JSON dump will always emit pretty JSON data. Therefore, the opening
and closing braces of every object will be on lines which are indented
by exactly the same amount, and all lines in between will have more
indentation. Thus, in this case, everything starting with a line
matching the regular expression /^ *"format-specific": {/ until /^ *},?/
has to be stripped, where the number of spaces at the beginning of the
respective lines is equal.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-09 16:46:19 +08:00
|
|
|
-e "/actual-size/ D" | \
|
|
|
|
while IFS='' read line; do
|
|
|
|
if [[ $line == "Format specific information:" ]]; then
|
|
|
|
discard=1
|
|
|
|
elif [[ $line =~ $regex_json_spec_start ]]; then
|
|
|
|
discard=2
|
|
|
|
regex_json_spec_end="^${line%%[^ ]*}\\},? *$"
|
|
|
|
fi
|
|
|
|
if [[ $discard == 0 ]]; then
|
|
|
|
echo "$line"
|
|
|
|
elif [[ $discard == 1 && ! $line ]]; then
|
|
|
|
echo
|
|
|
|
discard=0
|
|
|
|
elif [[ $discard == 2 && $line =~ $regex_json_spec_end ]]; then
|
|
|
|
discard=0
|
|
|
|
fi
|
|
|
|
done
|
2012-10-17 20:02:32 +08:00
|
|
|
}
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
_get_pids_by_name()
|
|
|
|
{
|
|
|
|
if [ $# -ne 1 ]
|
|
|
|
then
|
2013-09-04 19:16:04 +08:00
|
|
|
echo "Usage: _get_pids_by_name process-name" 1>&2
|
|
|
|
exit 1
|
2009-06-23 00:29:05 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Algorithm ... all ps(1) variants have a time of the form MM:SS or
|
|
|
|
# HH:MM:SS before the psargs field, use this as the search anchor.
|
|
|
|
#
|
|
|
|
# Matches with $1 (process-name) occur if the first psarg is $1
|
|
|
|
# or ends in /$1 ... the matching uses sed's regular expressions,
|
|
|
|
# so passing a regex into $1 will work.
|
|
|
|
|
|
|
|
ps $PS_ALL_FLAGS \
|
|
|
|
| sed -n \
|
2013-09-04 19:16:04 +08:00
|
|
|
-e 's/$/ /' \
|
|
|
|
-e 's/[ ][ ]*/ /g' \
|
|
|
|
-e 's/^ //' \
|
|
|
|
-e 's/^[^ ]* //' \
|
|
|
|
-e "/[0-9]:[0-9][0-9] *[^ ]*\/$1 /s/ .*//p" \
|
|
|
|
-e "/[0-9]:[0-9][0-9] *$1 /s/ .*//p"
|
2009-06-23 00:29:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# fqdn for localhost
|
|
|
|
#
|
|
|
|
_get_fqdn()
|
|
|
|
{
|
|
|
|
host=`hostname`
|
|
|
|
$NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
|
|
|
|
}
|
|
|
|
|
|
|
|
# check if run as root
|
|
|
|
#
|
|
|
|
_need_to_be_root()
|
|
|
|
{
|
|
|
|
id=`id | $SED_PROG -e 's/(.*//' -e 's/.*=//'`
|
|
|
|
if [ "$id" -ne 0 ]
|
|
|
|
then
|
2013-09-04 19:16:04 +08:00
|
|
|
echo "Arrgh ... you need to be root (not uid=$id) to run this test"
|
|
|
|
exit 1
|
2009-06-23 00:29:05 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Do a command, log it to $seq.full, optionally test return status
|
|
|
|
# and die if command fails. If called with one argument _do executes the
|
|
|
|
# command, logs it, and returns its exit status. With two arguments _do
|
|
|
|
# first prints the message passed in the first argument, and then "done"
|
|
|
|
# or "fail" depending on the return status of the command passed in the
|
|
|
|
# second argument. If the command fails and the variable _do_die_on_error
|
|
|
|
# is set to "always" or the two argument form is used and _do_die_on_error
|
|
|
|
# is set to "message_only" _do will print an error message to
|
|
|
|
# $seq.out and exit.
|
|
|
|
|
|
|
|
_do()
|
|
|
|
{
|
|
|
|
if [ $# -eq 1 ]; then
|
2013-09-04 19:16:04 +08:00
|
|
|
_cmd=$1
|
2009-06-23 00:29:05 +08:00
|
|
|
elif [ $# -eq 2 ]; then
|
2013-09-04 19:16:04 +08:00
|
|
|
_note=$1
|
|
|
|
_cmd=$2
|
|
|
|
echo -n "$_note... "
|
2009-06-23 00:29:05 +08:00
|
|
|
else
|
2013-09-04 19:16:04 +08:00
|
|
|
echo "Usage: _do [note] cmd" 1>&2
|
|
|
|
status=1; exit
|
2009-06-23 00:29:05 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
(eval "echo '---' \"$_cmd\"") >>$here/$seq.full
|
|
|
|
(eval "$_cmd") >$tmp._out 2>&1; ret=$?
|
|
|
|
cat $tmp._out >>$here/$seq.full
|
|
|
|
if [ $# -eq 2 ]; then
|
2013-09-04 19:16:04 +08:00
|
|
|
if [ $ret -eq 0 ]; then
|
|
|
|
echo "done"
|
|
|
|
else
|
|
|
|
echo "fail"
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
fi
|
|
|
|
if [ $ret -ne 0 ] \
|
2013-09-04 19:16:04 +08:00
|
|
|
&& [ "$_do_die_on_error" = "always" \
|
|
|
|
-o \( $# -eq 2 -a "$_do_die_on_error" = "message_only" \) ]
|
2009-06-23 00:29:05 +08:00
|
|
|
then
|
2013-09-04 19:16:04 +08:00
|
|
|
[ $# -ne 2 ] && echo
|
|
|
|
eval "echo \"$_cmd\" failed \(returned $ret\): see $seq.full"
|
|
|
|
status=1; exit
|
2009-06-23 00:29:05 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
return $ret
|
|
|
|
}
|
|
|
|
|
|
|
|
# bail out, setting up .notrun file
|
|
|
|
#
|
|
|
|
_notrun()
|
|
|
|
{
|
|
|
|
echo "$*" >$seq.notrun
|
|
|
|
echo "$seq not run: $*"
|
|
|
|
status=0
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
# just plain bail out
|
|
|
|
#
|
|
|
|
_fail()
|
|
|
|
{
|
|
|
|
echo "$*" | tee -a $here/$seq.full
|
|
|
|
echo "(see $seq.full for details)"
|
|
|
|
status=1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# tests whether $IMGFMT is one of the supported image formats for a test
|
|
|
|
#
|
|
|
|
_supported_fmt()
|
|
|
|
{
|
|
|
|
for f; do
|
2013-09-27 20:48:15 +08:00
|
|
|
if [ "$f" = "$IMGFMT" -o "$f" = "generic" -a "$IMGFMT_GENERIC" = "true" ]; then
|
2013-09-04 19:16:04 +08:00
|
|
|
return
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
_notrun "not suitable for this image format: $IMGFMT"
|
|
|
|
}
|
|
|
|
|
2011-01-18 01:01:17 +08:00
|
|
|
# tests whether $IMGPROTO is one of the supported image protocols for a test
|
|
|
|
#
|
|
|
|
_supported_proto()
|
|
|
|
{
|
|
|
|
for f; do
|
2013-09-04 19:16:04 +08:00
|
|
|
if [ "$f" = "$IMGPROTO" -o "$f" = "generic" ]; then
|
|
|
|
return
|
|
|
|
fi
|
2011-01-18 01:01:17 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
_notrun "not suitable for this image protocol: $IMGPROTO"
|
|
|
|
}
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
# tests whether the host OS is one of the supported OSes for a test
|
|
|
|
#
|
|
|
|
_supported_os()
|
|
|
|
{
|
|
|
|
for h
|
|
|
|
do
|
2013-09-04 19:16:04 +08:00
|
|
|
if [ "$h" = "$HOSTOS" ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
_notrun "not suitable for this OS: $HOSTOS"
|
|
|
|
}
|
|
|
|
|
2012-08-09 20:05:57 +08:00
|
|
|
_unsupported_qemu_io_options()
|
|
|
|
{
|
|
|
|
for bad_opt
|
|
|
|
do
|
|
|
|
for opt in $QEMU_IO_OPTIONS
|
|
|
|
do
|
|
|
|
if [ "$bad_opt" = "$opt" ]
|
|
|
|
then
|
|
|
|
_notrun "not suitable for qemu-io option: $bad_opt"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
# this test requires that a specified command (executable) exists
|
|
|
|
#
|
|
|
|
_require_command()
|
|
|
|
{
|
|
|
|
[ -x "$1" ] || _notrun "$1 utility required, skipped this test"
|
|
|
|
}
|
|
|
|
|
|
|
|
_full_imgfmt_details()
|
|
|
|
{
|
2012-03-27 19:45:14 +08:00
|
|
|
if [ -n "$IMGOPTS" ]; then
|
|
|
|
echo "$IMGFMT ($IMGOPTS)"
|
|
|
|
else
|
|
|
|
echo "$IMGFMT"
|
|
|
|
fi
|
2009-06-23 00:29:05 +08:00
|
|
|
}
|
|
|
|
|
2011-01-18 01:01:17 +08:00
|
|
|
_full_imgproto_details()
|
|
|
|
{
|
|
|
|
echo "$IMGPROTO"
|
|
|
|
}
|
|
|
|
|
2009-06-23 00:29:05 +08:00
|
|
|
_full_platform_details()
|
|
|
|
{
|
|
|
|
os=`uname -s`
|
|
|
|
host=`hostname -s`
|
|
|
|
kernel=`uname -r`
|
|
|
|
platform=`uname -m`
|
|
|
|
echo "$os/$platform $host $kernel"
|
|
|
|
}
|
|
|
|
|
|
|
|
_link_out_file()
|
|
|
|
{
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo Error must pass \$seq.
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
rm -f $1
|
|
|
|
if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
|
|
|
|
ln -s $1.irix $1
|
|
|
|
elif [ "`uname`" == "Linux" ]; then
|
|
|
|
ln -s $1.linux $1
|
|
|
|
else
|
|
|
|
echo Error test $seq does not run on the operating system: `uname`
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_die()
|
|
|
|
{
|
|
|
|
echo $@
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# make sure this script returns success
|
|
|
|
/bin/true
|