|
@@ -31,6 +31,11 @@ _cleanup()
|
|
|
_cleanup_test_img
|
|
|
_rm_test_img "$TEST_IMG.base"
|
|
|
_rm_test_img "$TEST_IMG.orig"
|
|
|
+
|
|
|
+ _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base"
|
|
|
+ _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.mid"
|
|
|
+ _rm_test_img "$TEST_DIR/subdir/t.$IMGFMT"
|
|
|
+ rmdir "$TEST_DIR/subdir" &> /dev/null
|
|
|
}
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
@@ -139,6 +144,45 @@ $QEMU_IO -c 'writev 0 64k' "$TEST_IMG" | _filter_qemu_io
|
|
|
$QEMU_IMG commit "$TEST_IMG"
|
|
|
_cleanup
|
|
|
|
|
|
+
|
|
|
+echo
|
|
|
+echo 'Testing commit in sub-directory with relative filenames'
|
|
|
+echo
|
|
|
+
|
|
|
+pushd "$TEST_DIR" > /dev/null
|
|
|
+
|
|
|
+mkdir subdir
|
|
|
+
|
|
|
+TEST_IMG="subdir/t.$IMGFMT.base" _make_test_img 1M
|
|
|
+TEST_IMG="subdir/t.$IMGFMT.mid" _make_test_img -b "t.$IMGFMT.base" -F $IMGFMT
|
|
|
+TEST_IMG="subdir/t.$IMGFMT" _make_test_img -b "t.$IMGFMT.mid" -F $IMGFMT
|
|
|
+
|
|
|
+# Should work
|
|
|
+$QEMU_IMG commit -b "t.$IMGFMT.mid" "subdir/t.$IMGFMT"
|
|
|
+
|
|
|
+# Might theoretically work, but does not in practice (we have to
|
|
|
+# decide between this and the above; and since we always represent
|
|
|
+# backing file names as relative to the overlay, we go for the above)
|
|
|
+$QEMU_IMG commit -b "subdir/t.$IMGFMT.mid" "subdir/t.$IMGFMT" 2>&1 | \
|
|
|
+ _filter_imgfmt
|
|
|
+
|
|
|
+# This should work as well
|
|
|
+$QEMU_IMG commit -b "$TEST_DIR/subdir/t.$IMGFMT.mid" "subdir/t.$IMGFMT"
|
|
|
+
|
|
|
+popd > /dev/null
|
|
|
+
|
|
|
+# Now let's try with just absolute filenames
|
|
|
+# (This will not work with external data files, though, because when
|
|
|
+# using relative paths for those, qemu will always resolve them
|
|
|
+# relative to its CWD. Therefore, it cannot find those data files now
|
|
|
+# that we left $TEST_DIR.)
|
|
|
+if _get_data_file '' > /dev/null; then
|
|
|
+ echo 'Image committed.' # Skip test
|
|
|
+else
|
|
|
+ $QEMU_IMG commit -b "$TEST_DIR/subdir/t.$IMGFMT.mid" \
|
|
|
+ "$TEST_DIR/subdir/t.$IMGFMT"
|
|
|
+fi
|
|
|
+
|
|
|
# success, all done
|
|
|
echo "*** done"
|
|
|
rm -f $seq.full
|