Lines Matching +full:- +full:- +full:local
4 # Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
24 HOSTOS=$(uname -s)
25 arch=$(uname -m)
40 if ! command -v gsed >/dev/null 2>&1; then
41 if sed --version 2>&1 | grep -v 'not GNU sed' | grep 'GNU sed' > /dev/null;
59 command dd --help | grep noxfer > /dev/null 2>&1
61 if [ "$?" -eq 0 ]
82 local img=$1 ofs=$2 len=$3 val=$4 str=''
84 while ((len--)); do
96 local img=$1 ofs=$2 len=$3 val=$4
97 local str=$(printf "%0$((len * 2))x\n" $val | sed 's/\(..\)/\\x\1/g')
105 local val=0 shift=0 byte
107 # coreutils' od --endian is not portable, so manually assemble bytes.
108 for byte in $(od -j"$2" -N"$3" -An -v -tu1 "$1"); do
118 local val=0 byte
120 # coreutils' od --endian is not portable, so manually assemble bytes.
121 for byte in $(od -j"$2" -N"$3" -An -v -tu1 "$1"); do
136 if [ -n "$1" ]; then
146 du --block-size=1 "$1" | awk '{print $1}'
151 # $ VALGRIND_QEMU_IO= ./check -qcow2 -valgrind 015
161 # $ VALGRIND_OPTS="--leak-check=yes" ./check -qcow2 -valgrind 015
165 local VALGRIND_LOGFILE="$1"
168 exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$@"
176 local VALGRIND_LOGFILE="$1"
177 local RETVAL="$2"
182 rm -f "${VALGRIND_LOGFILE}"
188 local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
190 if [ -n "${QEMU_NEED_PID}" ]; then
191 echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid"
195 if [ -n "${GDB_OPTIONS}" ]; then
209 local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
221 local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
222 local QEMU_IO_ARGS="$QEMU_IO_OPTIONS"
224 QEMU_IO_ARGS="--image-opts $QEMU_IO_ARGS"
225 if [ -n "$IMGKEYSECRET" ]; then
226 QEMU_IO_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IO_ARGS"
240 local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
243 "$QEMU_NBD_PROG" --pid-file="${QEMU_TEST_DIR}/qemu-nbd.pid" \
253 local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
255 if [ -n "${QSD_NEED_PID}" ]; then
256 echo $BASHPID > "${QEMU_TEST_DIR}/qemu-storage-daemon.pid"
282 QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
283 if [ -n "$IMGKEYSECRET" ]; then
284 QEMU_IMG_EXTRA_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IMG_EXTRA_ARGS"
287 DRIVER="$DRIVER,key-secret=keysec0"
298 TEST_IMG="$DRIVER,file.filename=$SOCK_DIR/fuse-t.$IMGFMT"
317 TEST_IMG="$SOCK_DIR/fuse-t.$IMGFMT"
320 REMOTE_TEST_DIR="ssh://\\($USER@\\)\\?127.0.0.1\\(:[0-9]\\+\\)\\?$TEST_DIR"
336 if [ -z "$TEST_DIR" ]; then
342 if [ ! -e "$TEST_DIR" ]; then
346 if [ ! -d "$TEST_DIR" ]; then
351 if [ -z "$REMOTE_TEST_DIR" ]; then
355 if [ ! -d "$SAMPLE_IMG_DIR" ]; then
365 if [ $? -ne 0 ]
374 if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then
375 local QEMU_NBD_PID
376 read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid"
378 rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid" "$SOCK_DIR/nbd"
388 if ! echo "$IMGOPTS" | grep -q 'data_file='; then
392 echo "$IMGOPTS" | sed -e 's/.*data_file=\([^,]*\).*/\1/' \
393 | sed -e "s#\\\$TEST_IMG#$1#"
406 echo "$1" | sed -e "s#$SOCK_DIR/fuse-#$TEST_DIR/#"
410 echo "$1" | sed -e "s#nfs://127.0.0.1##"
415 sed -e "s#ssh://\\($USER@\\)\\?127.0.0.1\\(:[0-9]\\+\\)\\?##"
426 # extra qemu-img options can be added by tests
428 local extra_img_options=""
429 local optstr=""
430 local img_name=""
431 local use_backing=0
432 local backing_file=""
433 local object_options=""
434 local opts_param=false
435 local misc_params=()
437 if [[ $IMGPROTO == fuse && $TEST_IMG == $SOCK_DIR/fuse-* ]]; then
442 if [ -z "$TEST_IMG_FILE" ]; then
444 elif [ "$IMGOPTSSYNTAX" != "true" -a \
457 if [ -n "$IMGOPTS" ]; then
458 imgopts_expanded=$(echo "$IMGOPTS" | sed -e "s#\\\$TEST_IMG#$img_name#")
461 if [ -n "$IMGKEYSECRET" ]; then
462 object_options="--object secret,id=keysec0,data=$IMGKEYSECRET"
463 optstr=$(_optstr_add "$optstr" "key-secret=keysec0")
467 if [ "$use_backing" = "1" -a -z "$backing_file" ]; then
477 -b)
481 -o)
485 --no-opts)
495 if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
499 if [ -n "$optstr" ]; then
500 extra_img_options="-o $optstr $extra_img_options"
510 …$QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" "${m…
512 …$QEMU_IMG create $object_options -f $IMGFMT $extra_img_options "$img_name" "${misc_params[@]}" 2>&1
517 # Once NBD gains resize support, we may also want to use -f raw at the
521 # Pass a sufficiently high number to -e that should be enough for all
523 eval "$QEMU_NBD -v -t -k '$SOCK_DIR/nbd' -f $IMGFMT -e 42 -x '' $TEST_IMG_FILE >/dev/null &"
524 sleep 1 # FIXME: qemu-nbd needs to be listening before we continue
527 if [ $IMGPROTO = "fuse" -a -f "$img_name" ]; then
528 local export_mp
529 local pid
530 local pidfile
531 local timeout
533 export_mp=$(echo "$img_name" | sed -e "s#$TEST_DIR/#$SOCK_DIR/fuse-#")
534 if ! echo "$export_mp" | grep -q "^$SOCK_DIR"; then
540 rm -f "$SOCK_DIR/fuse-output"
543 # protocol-level driver here, so we have to leave the format to the
545 # Switch off allow-other, because in general we do not need it for
546 # iotests. The default allow-other=auto has the downside of printing a
550 --blockdev file,node-name=export-node,filename=$img_name,discard=unmap \
551 …--export fuse,id=fuse-export,node-name=export-node,mountpoint="$export_mp",writable=on,growable=on…
554 pidfile="$QEMU_TEST_DIR/qemu-storage-daemon.pid"
557 while [ ! -f "$pidfile" ]; do
562 rm -f "$pidfile"
571 local img=$1
573 if [[ $IMGPROTO == fuse && $img == $SOCK_DIR/fuse-* ]]; then
575 local df_output
576 local i
577 local image_file
578 local index=''
579 local timeout
588 if [ -z "$index" ]; then
604 if [ -n "$df_output" ]; then
605 if ! echo "$df_output" | grep -q "$img"; then
612 timeout=$((timeout - 1))
619 rm -f "$img"
624 image_file=$(echo "$img" | sed -e "s#$SOCK_DIR/fuse-#$TEST_DIR/#")
631 "$QEMU_IMG" info "$img" 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
632 | xargs -I {} rm -f "{}"
636 rm -f "$data_file"
639 rm -f "$img"
648 rm -f "$TEST_IMG_FILE"
652 local mp
666 if [ -n "$SAMPLE_IMG_FILE" ]
668 rm -f "$TEST_DIR/$SAMPLE_IMG_FILE"
675 rbd --no-progress rm "$TEST_DIR/t.$IMGFMT" > /dev/null
687 $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1
711 if [[ "$1" == "--format-specific" ]]; then
712 local format_specific=1
715 local format_specific=0
719 regex_json_spec_start='^ *"format-specific": \{'
722 sed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
723 -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
724 -e "s#$TEST_DIR#TEST_DIR#g" \
725 -e "s#$SOCK_DIR/fuse-#TEST_DIR/#g" \
726 -e "s#$SOCK_DIR/#SOCK_DIR/#g" \
727 -e "s#$IMGFMT#IMGFMT#g" \
728 -e 's/\(compression type: \)\(zlib\|zstd\)/\1COMPRESSION_TYPE/' \
729 -e "/^disk size:/ D" \
730 -e "/actual-size/ D" | \
731 while IFS='' read -r line; do
769 echo "$*" | tee -a "$TEST_DIR/$seq.full"
780 # work, however (most notably read-only formats), so they can opt out by
783 if [ "$f" = "$IMGFMT" -o "$f" = "generic" -a "$IMGFMT_GENERIC" = "true" ]; then
810 if [ "$f" = "$IMGPROTO" -o "$f" = "generic" ]; then
859 $QEMU_IMG create -f raw "$testfile" 1M > /dev/null
860 out=$($QEMU_IO -f raw -t none -c quit "$testfile" 2>&1)
861 rm -f "$testfile"
882 # $1 - cache mode to use by default
883 # $2 - (optional) cache mode to use by default if O_DIRECT is not supported
887 if [ -z "$2" ] || _check_o_direct; then
892 QEMU_IO="$QEMU_IO --cache $CACHEMODE"
909 QEMU_IO="$QEMU_IO --aio $1"
918 if echo "$IMGOPTS " | grep -q 2>/dev/null "$bad_opt"
931 $QEMU_IMG create -f luks \
932 --object secret,id=sec0,data=hunter0 \
933 -o key-secret=sec0 \
934 -o iter-time=10 \
944 reason=$(echo "$output" | grep "$file:" | sed -e "s#.*$file: *##")
945 if [ -z "$reason" ]; then
967 [ -x "$c" ] || _notrun "$1 utility required, skipped this test"
974 available=$($QEMU -drive format=help | \
975 sed -e '/Supported formats:/!d' -e 's/Supported formats://')
978 if ! echo "$available" | grep -q " $driver\( \|$\)"; then
988 if [ -z "$TEST_IMG_FILE" ]; then
993 if ! truncate --size="$1" "$FILENAME"; then
1002 local unusable=false
1006 if [ -z "$TEST_IMG_FILE" ]; then
1011 if [ -e "FILENAME" ]; then
1015 $QEMU_IMG create -f raw "$FILENAME" 5M > /dev/null
1016 if [ $(disk_usage "$FILENAME") -gt $((1024*1024)) ]; then
1019 $QEMU_IMG create -f raw -o preallocation=full "$FILENAME" 5M > /dev/null
1020 if [ $(disk_usage "$FILENAME") -lt $((4*1024*1024)) ]; then
1023 rm -f "$FILENAME"
1033 available=$($QEMU -M none -device help 2> /dev/null | \
1034 grep ^name | sed -e 's/^name "//' -e 's/".*$//')
1037 if ! echo "$available" | grep -q "$device" ; then
1045 available=$($QEMU -M none -device help 2> /dev/null | \
1046 grep ^name | sed -e 's/^name "//' -e 's/".*$//')
1049 if echo "$available" | grep -q "$device" ; then
1058 if [[ "$1" == "--no-filter-compression" ]]; then
1059 local filter_compression=0
1062 local filter_compression=1
1066 if [ -z "$img" ]; then
1071 $PYTHON qcow2.py "$img" dump-header
1073 $PYTHON qcow2.py "$img" dump-header | _filter_qcow2_compression_type_bit