Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add simple storage performance tests #649

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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