diff --git a/qemu/tests/cache_sizes_test.py b/qemu/tests/cache_sizes_test.py new file mode 100644 index 0000000000000000000000000000000000000000..a2d331036f98add4598ee0fecf8e4c8c8d4a0395 --- /dev/null +++ b/qemu/tests/cache_sizes_test.py @@ -0,0 +1,36 @@ +import logging + +from provider import qemu_img_utils as img_utils + + +def run(test, params, env): + """ + Cache sizes test for a guest. + + 1. Boot a guest up with different cache sizes. + 2. Check writing data to the guest works fine. + 3. Shut the guest down. + + :param test: Qemu test object + :param params: Dictionary with the test parameters + :param env: Dictionary with test environment + """ + file = params["guest_file_name"] + initial_tag = params["images"] + cache_sizes = params["cache_sizes"].split() + + logging.info("Boot a guest up from initial image: %s, and create a" + " file %s on the disk.", initial_tag, file) + for cache_size in cache_sizes: + params["drv_extra_params"] = "cache-size=%s" % cache_size + vm = img_utils.boot_vm_with_images(test, params, env) + session = vm.wait_for_login() + guest_temp_file = params["guest_file_name"] + sync_bin = params.get("sync_bin", "sync") + + logging.debug("Create temporary file on guest: %s", guest_temp_file) + img_utils.save_random_file_to_vm(vm, guest_temp_file, 2048 * 512, + sync_bin) + + session.close() + vm.destroy() diff --git a/qemu/tests/cfg/cache_sizes_test.cfg b/qemu/tests/cfg/cache_sizes_test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..9a2abae04f8c24bfd20728be96fc84c7515010e8 --- /dev/null +++ b/qemu/tests/cfg/cache_sizes_test.cfg @@ -0,0 +1,17 @@ +- cache_sizes_test: + only qcow2 + virt_test_type = qemu + type = cache_sizes_test + start_vm = no + kill_vm = yes + force_create_image = no + tmp_dir = /var/tmp + tmp_file_name = ${tmp_dir}/testfile + guest_file_name = ${tmp_file_name} + cache_sizes = "0 2 1024 65525 65527" + Windows: + guest_file_name = C:\testfile + x86_64: + sync_bin = WIN_UTILS:\Sync\sync64.exe /accepteula + i386, i686: + sync_bin = WIN_UTILS:\Sync\sync.exe /accepteula