Skip to content

Commit

Permalink
tests: add simple storage performance tests
Browse files Browse the repository at this point in the history
Add few simple storage performance tests using fio tool.
Tests are checking dom0's root and varlibqubes pools (by default the
same thing, but in case of XFS or BTRFS setups, they are
different). And VM's root/private/volatile. The last one is tested by
creating ext4 filesystem there first. This isn't very representative
(normally volatile is used for swap and CoW data), but allows comparing
results with other volumes.

The tests can be also started outside of the full test run by calling
/usr/lib/qubes/tests/storage_perf.py. It requires giving name of a VM to
test (which may be dom0).

The test scenarios are modeled after what kdiskmark tool uses.

QubesOS/qubes-issues#5740
  • Loading branch information
marmarek committed Feb 14, 2025
1 parent 6c06362 commit 6bcfcc8
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 0 deletions.
1 change: 1 addition & 0 deletions qubes/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,7 @@ def load_tests(loader, tests, pattern): # pylint: disable=unused-argument
"qubes.tests.integ.devices_pci",
"qubes.tests.integ.qrexec",
"qubes.tests.integ.qrexec_perf",
"qubes.tests.integ.storage_perf",
"qubes.tests.integ.dom0_update",
"qubes.tests.integ.vm_update",
"qubes.tests.integ.network",
Expand Down
184 changes: 184 additions & 0 deletions qubes/tests/integ/storage_perf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2025 Marek Marczykowski-Górecki
# <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with this program; if not, see <http://www.gnu.org/licenses/>.

import asyncio
import os
import subprocess
import sys
import time

import qubes.tests

test_script = "/usr/lib/qubes/tests/storage_perf.py"


class StoragePerfBase(qubes.tests.SystemTestCase):
def setUp(self):
super().setUp()
self.vm = self.app.domains[0]

def run_test(self, volume, name):
cmd = [
test_script,
f"--volume={volume}",
f"--vm={self.vm.name}",
name,
]
p = self.loop.run_until_complete(asyncio.create_subprocess_exec(*cmd))
self.loop.run_until_complete(p.wait())
if p.returncode:
self.fail(f"'{' '.join(cmd)}' failed: {p.returncode}")


class TC_00_StoragePerfDom0(StoragePerfBase):
def test_000_root_seq1m_q8t1_read(self):
self.run_test("root", "seq1m_q8t1_read")

def test_001_root_seq1m_q8t1_write(self):
self.run_test("root", "seq1m_q8t1_write")

def test_003_root_seq1m_q1t1_read(self):
self.run_test("root", "seq1m_q1t1_read")

def test_004_root_seq1m_q1t1_write(self):
self.run_test("root", "seq1m_q1t1_write")

def test_005_root_rnd4k_q32t1_read(self):
self.run_test("root", "rnd4k_q32t1_read")

def test_005_root_rnd4k_q32t1_write(self):
self.run_test("root", "rnd4k_q32t1_write")

def test_006_root_rnd4k_q1t1_read(self):
self.run_test("root", "rnd4k_q1t1_read")

def test_007_root_rnd4k_q1t1_write(self):
self.run_test("root", "rnd4k_q1t1_write")

def test_010_varlibqubes_seq1m_q8t1_read(self):
self.run_test("varlibqubes", "seq1m_q8t1_read")

def test_011_varlibqubes_seq1m_q8t1_write(self):
self.run_test("varlibqubes", "seq1m_q8t1_write")

def test_013_varlibqubes_seq1m_q1t1_read(self):
self.run_test("varlibqubes", "seq1m_q1t1_read")

def test_014_varlibqubes_seq1m_q1t1_write(self):
self.run_test("varlibqubes", "seq1m_q1t1_write")

def test_015_varlibqubes_rnd4k_q32t1_read(self):
self.run_test("varlibqubes", "rnd4k_q32t1_read")

def test_015_varlibqubes_rnd4k_q32t1_write(self):
self.run_test("varlibqubes", "rnd4k_q32t1_write")

def test_016_varlibqubes_rnd4k_q1t1_read(self):
self.run_test("varlibqubes", "rnd4k_q1t1_read")

def test_017_varlibqubes_rnd4k_q1t1_write(self):
self.run_test("varlibqubes", "rnd4k_q1t1_write")


class TC_10_StoragePerfVM(StoragePerfBase):
def setUp(self):
super().setUp()
self.vm = self.app.add_new_vm(
"AppVM",
name=self.make_vm_name("vm1"),
label="red",
)
self.loop.run_until_complete(
self.vm.create_on_disk(),
)
self.loop.run_until_complete(
self.vm.start(),
)

def test_000_root_seq1m_q8t1_read(self):
self.run_test("root", "seq1m_q8t1_read")

def test_001_root_seq1m_q8t1_write(self):
self.run_test("root", "seq1m_q8t1_write")

def test_002_root_seq1m_q1t1_read(self):
self.run_test("root", "seq1m_q1t1_read")

def test_003_root_seq1m_q1t1_write(self):
self.run_test("root", "seq1m_q1t1_write")

def test_004_root_rnd4k_q32t1_read(self):
self.run_test("root", "rnd4k_q32t1_read")

def test_005_root_rnd4k_q32t1_write(self):
self.run_test("root", "rnd4k_q32t1_write")

def test_006_root_rnd4k_q1t1_read(self):
self.run_test("root", "rnd4k_q1t1_read")

def test_007_root_rnd4k_q1t1_write(self):
self.run_test("root", "rnd4k_q1t1_write")

def test_010_private_seq1m_q8t1_read(self):
self.run_test("private", "seq1m_q8t1_read")

def test_011_private_seq1m_q8t1_write(self):
self.run_test("private", "seq1m_q8t1_write")

def test_012_private_seq1m_q1t1_read(self):
self.run_test("private", "seq1m_q1t1_read")

def test_013_private_seq1m_q1t1_write(self):
self.run_test("private", "seq1m_q1t1_write")

def test_014_private_rnd4k_q32t1_read(self):
self.run_test("private", "rnd4k_q32t1_read")

def test_015_private_rnd4k_q32t1_write(self):
self.run_test("private", "rnd4k_q32t1_write")

def test_016_private_rnd4k_q1t1_read(self):
self.run_test("private", "rnd4k_q1t1_read")

def test_017_private_rnd4k_q1t1_write(self):
self.run_test("private", "rnd4k_q1t1_write")

def test_020_volatile_seq1m_q8t1_read(self):
self.run_test("volatile", "seq1m_q8t1_read")

def test_021_volatile_seq1m_q8t1_write(self):
self.run_test("volatile", "seq1m_q8t1_write")

def test_022_volatile_seq1m_q1t1_read(self):
self.run_test("volatile", "seq1m_q1t1_read")

def test_023_volatile_seq1m_q1t1_write(self):
self.run_test("volatile", "seq1m_q1t1_write")

def test_024_volatile_rnd4k_q32t1_read(self):
self.run_test("volatile", "rnd4k_q32t1_read")

def test_025_volatile_rnd4k_q32t1_write(self):
self.run_test("volatile", "rnd4k_q32t1_write")

def test_026_volatile_rnd4k_q1t1_read(self):
self.run_test("volatile", "rnd4k_q1t1_read")

def test_027_volatile_rnd4k_q1t1_write(self):
self.run_test("volatile", "rnd4k_q1t1_write")
2 changes: 2 additions & 0 deletions rpm_spec/core-dom0.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ done
%{python3_sitelib}/qubes/tests/integ/qrexec.py
%{python3_sitelib}/qubes/tests/integ/qrexec_perf.py
%{python3_sitelib}/qubes/tests/integ/storage.py
%{python3_sitelib}/qubes/tests/integ/storage_perf.py
%{python3_sitelib}/qubes/tests/integ/vm_qrexec_gui.py

%dir %{python3_sitelib}/qubes/tests/integ/tools
Expand All @@ -549,6 +550,7 @@ done
/usr/lib/qubes/fix-dir-perms.sh
/usr/lib/qubes/startup-misc.sh
/usr/lib/qubes/tests/qrexec_perf.py
/usr/lib/qubes/tests/storage_perf.py
%{_unitdir}/[email protected]/30_qubes.conf
%{_unitdir}/qubes-core.service
%{_unitdir}/qubes-qmemman.service
Expand Down
Loading

0 comments on commit 6bcfcc8

Please sign in to comment.