Skip to content

Commit

Permalink
Merge branch 'vara-dev' into f-ConfigIDBasedRevLookup
Browse files Browse the repository at this point in the history
  • Loading branch information
vulder authored Nov 27, 2023
2 parents f4d9411 + 8eed404 commit 20e2ac2
Show file tree
Hide file tree
Showing 35 changed files with 3,502 additions and 2,292 deletions.
12 changes: 12 additions & 0 deletions icons/breeze/light/vcs-commit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<file>breeze/light/document-save.svg</file>
<file>breeze/light/application-exit.svg</file>
<file>breeze/light/document-open.svg</file>
<file>breeze/light/vcs-commit.svg</file>
<file>operators/and-operator.svg</file>
<file>operators/or-operator.svg</file>
<file>operators/not-operator.svg</file>
Expand Down
2 changes: 1 addition & 1 deletion icons/update-icons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
script=$(readlink -f "$0")
scriptpath=$(dirname "${script}")

pyrcc5 icons.qrc -o "${scriptpath}"/../varats/gui/icons_rc.py
pyrcc5 icons.qrc -o "${scriptpath}"/../varats/varats/gui/icons_rc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Patch with a regression severity
path: bug.patch
project_name: FeaturePerfCSCollection
shortname: regression-severity
regression_severity: 1000
4 changes: 2 additions & 2 deletions tests/experiment/test_workload_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_workload_commands_requires_patch(self) -> None:
ShortCommitHash("7930350628")
)[0]
workloads = wu.workload_commands(project, binary, [])
self.assertEqual(2, len(workloads))
self.assertEqual(8, len(workloads))

@run_in_test_environment(UnitTestFixtures.PAPER_CONFIGS)
def test_workload_commands_requires_patch2(self) -> None:
Expand All @@ -124,7 +124,7 @@ def test_workload_commands_requires_patch2(self) -> None:
binary = SynthIPTemplate \
.binaries_for_revision(ShortCommitHash("7930350628"))[0]
workloads = wu.workload_commands(project, binary, [])
self.assertEqual(0, len(workloads))
self.assertEqual(8, len(workloads))


class TestWorkloadFilenames(unittest.TestCase):
Expand Down
39 changes: 31 additions & 8 deletions tests/provider/test_patch_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
FeaturePerfCSCollection,
)
from varats.provider.patch.patch_provider import PatchProvider, Patch, PatchSet
from varats.utils.git_util import ShortCommitHash
from varats.utils.git_util import (
ShortCommitHash,
get_all_revisions_between,
get_initial_commit,
)


class TestPatchProvider(unittest.TestCase):
Expand All @@ -35,6 +39,25 @@ def test_get_patch_by_shortname(self):
patch = provider.get_by_shortname("dummy-patch")
self.assertIsNone(patch)

def test_parse_regression_severity(self):
regression_patch = Patch.from_yaml(
Path(
TEST_INPUTS_DIR /
'patch_configs/FeaturePerfCSCollection/regression-severity.info'
)
)

other_patch = Patch.from_yaml(
Path(
TEST_INPUTS_DIR /
'patch_configs/FeaturePerfCSCollection/unrestricted-range.info'
)
)

self.assertIsNotNone(regression_patch.regression_severity)
self.assertEqual(1000, regression_patch.regression_severity)
self.assertIsNone(other_patch.regression_severity)


class TestPatchRevisionRanges(unittest.TestCase):

Expand All @@ -53,14 +76,14 @@ def setUpClass(cls) -> None:

project_git_source.fetch()

repo_git = _get_git_for_path(
target_prefix() + "/FeaturePerfCSCollection"
)
repo_git_path = Path(target_prefix() + "/FeaturePerfCSCollection")

cls.all_revisions = {
ShortCommitHash(h) for h in
repo_git('log', '--pretty=%H', '--first-parent').strip().split()
}
cls.all_revisions = set(
get_all_revisions_between(
get_initial_commit(repo_git_path).hash, "", ShortCommitHash,
repo_git_path
)
)

def __test_patch_revisions(
self, shortname: str, expected_revisions: set[ShortCommitHash]
Expand Down
36 changes: 33 additions & 3 deletions tests/report/test_gnu_time_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
Average total size (kbytes): 0
Maximum resident set size (kbytes): 1804
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Major (requiring I/O) page faults: 2
Minor (reclaiming a frame) page faults: 142
Voluntary context switches: 1
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 0
File system inputs: 1
File system outputs: 2
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Expand Down Expand Up @@ -63,6 +63,12 @@ def test_max_resident_size(self):
with self.assertRaises(WrongTimeReportFormat):
TimeReport._parse_max_resident_size(" Something other timed:")

def test_major_page_faults(self):
"""Test if we correctly parse the amount of major page faults from the
input line."""
with self.assertRaises(WrongTimeReportFormat):
TimeReport._parse_major_page_faults(" Something other timed:")

def test_max_resident_size_byte_type(self):
"""Test if we correctly parse the max resident size from the input
line."""
Expand Down Expand Up @@ -97,6 +103,30 @@ def test_system_time(self):
"""Test if we can extract the system time from the parsed file."""
self.assertEqual(self.report.system_time, timedelta(seconds=3))

def test_wall_clock_time(self):
"""Test if we can extract the wall clock time from the parsed file."""
self.assertEqual(self.report.wall_clock_time, timedelta(seconds=42))

def test_max_resident_size(self) -> None:
"""Test if we can extract the max resident size from the parsed file."""
self.assertEqual(self.report.max_res_size, 1804)

def test_major_page_faults(self) -> None:
"""Test if we can extract the number of major page faults from the
parsed file."""
self.assertEqual(self.report.major_page_faults, 2)

def test_minor_page_faults(self) -> None:
"""Test if we can extract the number of minor page faults from the
parsed file."""
self.assertEqual(self.report.minor_page_faults, 142)

def test_filesystem_io(self) -> None:
"""Test if we can extract the number of filesystem inputs/outputs from
the parsed file."""
self.assertEqual(self.report.filesystem_io[0], 1)
self.assertEqual(self.report.filesystem_io[1], 2)

def test_repr_str(self):
"""Test string representation of TimeReports."""
expected_result = """Command: echo
Expand Down
102 changes: 102 additions & 0 deletions tests/report/test_linux_perf_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
"""Test LinuxPerfReport."""

import unittest
from pathlib import Path
from unittest import mock

from varats.report.linux_perf_report import LinuxPerfReport

PERF_REPORT_1 = """# started on Sun Jul 23 22:51:54 2023
Performance counter stats for 'echo foo:bar':
0.30 msec task-clock:u # 0.406 CPUs utilized
0 context-switches:u # 0.000 /sec
0 cpu-migrations:u # 0.000 /sec
64 page-faults:u # 212.723 K/sec
360,721 cycles:u # 1.199 GHz
26,199 stalled-cycles-frontend:u # 7.26% frontend cycles idle
111,008 stalled-cycles-backend:u # 30.77% backend cycles idle
200,655 instructions:u # 0.56 insn per cycle
# 0.55 stalled cycles per insn
48,631 branches:u # 161.639 M/sec
3,012 branch-misses:u # 6.19% of all branches
<not counted> L1-dcache-loads:u (0.00%)
<not counted> L1-dcache-load-misses:u (0.00%)
<not supported> LLC-loads:u
<not supported> LLC-load-misses:u
0.000741511 seconds time elapsed
0.000000000 seconds user
0.000822000 seconds sys
"""

PERF_REPORT_2 = """# started on Sun Jul 23 22:44:31 2023
Performance counter stats for 'foobar':
1.23 msec task-clock:u # 0.000 CPUs utilized
0 context-switches:u # 0.000 /sec
0 cpu-migrations:u # 0.000 /sec
132 page-faults:u # 107.572 K/sec
850,975 cycles:u # 0.693 GHz (12.81%)
140,154 stalled-cycles-frontend:u # 16.47% frontend cycles idle
1,012,322 stalled-cycles-backend:u # 118.96% backend cycles idle
1,785,912 instructions:u # 2.10 insn per cycle
# 0.57 stalled cycles per insn
325,708 branches:u # 265.433 M/sec
11,160 branch-misses:u # 3.43% of all branches
840,918 L1-dcache-loads:u # 685.298 M/sec (87.19%)
<not counted> L1-dcache-load-misses:u (0.00%)
<not supported> LLC-loads:u
<not supported> LLC-load-misses:u
5.945920439 seconds time elapsed
0.000376000 seconds user
0.001390000 seconds sys
"""


class TestLinuxPerfReport(unittest.TestCase):
"""Tests if the Linux perf report can be loaded correctly."""

report_1: LinuxPerfReport
report_2: LinuxPerfReport

@classmethod
def setUpClass(cls) -> None:
"""Load Linux perf report."""
with mock.patch(
"builtins.open", new=mock.mock_open(read_data=PERF_REPORT_1)
):
cls.report_1 = LinuxPerfReport(Path("fake_file_path"))

with mock.patch(
"builtins.open", new=mock.mock_open(read_data=PERF_REPORT_2)
):
cls.report_2 = LinuxPerfReport(Path("fake_file_path"))

def test_task_clock_parsing(self) -> None:
"""Checks if we correctly parsed the value for task clock."""
self.assertEqual(self.report_1.elapsed_time, 0.000741511)
self.assertEqual(self.report_2.elapsed_time, 5.945920439)

def test_context_switches_parsing(self) -> None:
"""Checks if we correctly parsed the value for context switches."""
self.assertEqual(self.report_1.ctx_switches, 0)
self.assertEqual(self.report_2.ctx_switches, 0)

def test_branch_misses_parsing(self) -> None:
"""Checks if we correctly parsed the value for branch misses."""
self.assertEqual(self.report_1.branch_misses, 3012)
self.assertEqual(self.report_2.branch_misses, 11160)
10 changes: 7 additions & 3 deletions tests/test_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class TestImageBase(unittest.TestCase):
def test_distro(self) -> None:
self.assertEqual(Distro.DEBIAN, ImageBase.DEBIAN_10.distro)

def test_distro_version_number(self) -> None:
self.assertEqual(10, ImageBase.DEBIAN_10.version)
self.assertEqual(12, ImageBase.DEBIAN_12.version)


class TestContainerSupport(unittest.TestCase):
"""Test container support related functionality."""
Expand Down Expand Up @@ -96,7 +100,7 @@ def test_create_stage_10_from_pip(self) -> None:
self.check_layer_type(layers[0], FromLayer)

varats_core_install_layer = self.check_layer_type(layers[2], RunLayer)
self.assertEqual("pip3", varats_core_install_layer.command)
self.assertEqual("pip", varats_core_install_layer.command)
self.assertTupleEqual(
("install", "--ignore-installed", "varats-core", "varats"),
varats_core_install_layer.args
Expand All @@ -123,7 +127,7 @@ def test_create_stage_10_from_source(self) -> None:
self.check_layer_type(layers[0], FromLayer)

varats_core_install_layer = self.check_layer_type(layers[4], RunLayer)
self.assertEqual("pip3", varats_core_install_layer.command)
self.assertEqual("pip", varats_core_install_layer.command)
self.assertTupleEqual(("install", "/varats/varats-core"),
varats_core_install_layer.args)
mounting_parameters = "type=bind,src=varats_src,target=/varats"
Expand All @@ -133,7 +137,7 @@ def test_create_stage_10_from_source(self) -> None:
varats_core_install_layer.kwargs)

varats_install_layer = self.check_layer_type(layers[5], RunLayer)
self.assertEqual("pip3", varats_install_layer.command)
self.assertEqual("pip", varats_install_layer.command)
self.assertTupleEqual(("install", "/varats/varats"),
varats_install_layer.args)
mounting_parameters = "type=bind,src=varats_src,target=/varats"
Expand Down
50 changes: 50 additions & 0 deletions uicomponents/SingleCommitFilterProperties.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SingleCommitFilterProperties</class>
<widget class="QWidget" name="SingleCommitFilterProperties">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>51</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Commit</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="uiCommitHash">
<property name="font">
<font>
<family>Monospace</family>
</font>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
1 change: 1 addition & 0 deletions uicomponents/update_ui
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pyuic5 --import-from varats.gui -x FilterMain.ui -o ${scriptpath}/../varats/vara
pyuic5 -x FilterProperties.ui -o ${scriptpath}/../varats/varats/gui/views/ui_FilterProperties.py
pyuic5 -x FilterNodeProperties.ui -o ${scriptpath}/../varats/varats/gui/views/ui_FilterNodeProperties.py
pyuic5 -x FilterUnaryWarning.ui -o ${scriptpath}/../varats/varats/gui/views/ui_FilterUnaryWarning.py
pyuic5 -x SingleCommitFilterProperties.ui -o ${scriptpath}/../varats/varats/gui/views/ui_SingleCommitFilterProperties.py
pyuic5 -x AuthorFilterProperties.ui -o ${scriptpath}/../varats/varats/gui/views/ui_AuthorFilterProperties.py
pyuic5 -x CommitterFilterProperties.ui -o ${scriptpath}/../varats/varats/gui/views/ui_CommitterFilterProperties.py
pyuic5 -x AuthorDateMinFilter.ui -o ${scriptpath}/../varats/varats/gui/views/ui_AuthorDateMinFilter.py
Expand Down
1 change: 1 addition & 0 deletions varats-core/varats/project/project_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ProjectDomains(Enum):
EDITOR = "Editor"
FILE_FORMAT = "File format"
HW_EMULATOR = "Hardware emulator"
HPC = "High Performance Applications"
PARSER = "Parser"
PLANNING = "Planning"
PROG_LANG = "Programming language"
Expand Down
Loading

0 comments on commit 20e2ac2

Please sign in to comment.