Skip to content

Commit

Permalink
project: Introduces open62541 as a new project to analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
vulder committed Oct 3, 2024
1 parent b87a13c commit 5bc8c4e
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/experiment/test_workload_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_workload_config_param_token(self) -> None:
self.assertEqual(len(commands), 1)
command = commands[0]
args = command.command.rendered_args(project=project)
self.assertEquals(args, tuple(["-c"]))
self.assertEqual(args, tuple(["-c"]))

@run_in_test_environment(UnitTestFixtures.PAPER_CONFIGS)
def test_workload_commands_requires_patch(self) -> None:
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 @@ -7,6 +7,7 @@ class ProjectDomains(Enum):
"""Defines a set of project domains."""
value: str

ARCHITECTURE = "Architecture"
CHAT_CLIENT = "Chat client"
CODEC = "Codec"
COMPRESSION = "Compression"
Expand Down
78 changes: 78 additions & 0 deletions varats/varats/projects/c_projects/open62541.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""Project file for open62541."""
import typing as tp

import benchbuild as bb
from benchbuild.utils.cmd import cmake, make, ls, pwd

Check warning on line 5 in varats/varats/projects/c_projects/open62541.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/projects/c_projects/open62541.py#L5 <611>

Unused ls imported from benchbuild.utils.cmd (unused-import)
Raw output
varats/varats/projects/c_projects/open62541.py:5:0: W0611: Unused ls imported from benchbuild.utils.cmd (unused-import)

Check warning on line 5 in varats/varats/projects/c_projects/open62541.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/projects/c_projects/open62541.py#L5 <611>

Unused pwd imported from benchbuild.utils.cmd (unused-import)
Raw output
varats/varats/projects/c_projects/open62541.py:5:0: W0611: Unused pwd imported from benchbuild.utils.cmd (unused-import)
from benchbuild.utils.settings import get_number_of_jobs
from plumbum import local

from varats.containers.containers import ImageBase, get_base_image
from varats.paper.paper_config import PaperConfigSpecificGit
from varats.project.project_domain import ProjectDomains
from varats.project.project_util import (
BinaryType,
ProjectBinaryWrapper,
RevisionBinaryMap,
get_local_project_repo,
verify_binaries,
)
from varats.project.varats_project import VProject
from varats.utils.git_util import ShortCommitHash
from varats.utils.settings import bb_cfg


class Open62541(VProject):
"""open62541 (http://open62541.org) is an open source implementation of OPC
UA (OPC Unified Architecture / IEC 62541) written in the C language."""

NAME = 'open62541'
GROUP = 'c_projects'
DOMAIN = ProjectDomains.ARCHITECTURE

SOURCE = [
PaperConfigSpecificGit(
project_name='open62541',
remote="https://github.com/open62541/open62541.git",
local="open62541",
refspec="origin/HEAD",
limit=None,
shallow=False
)
]

CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
'apt', 'install', '-y', "git", "build-essential", "pkg-config", "cmake",
"python3"
)

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash
) -> tp.List[ProjectBinaryWrapper]:
binary_map = RevisionBinaryMap(get_local_project_repo(Open62541.NAME))

binary_map.specify_binary(
'build/bin/libopen62541.a', BinaryType.STATIC_LIBRARY
)

return binary_map[revision]

def run_tests(self) -> None:
pass

def compile(self) -> None:
"""Compile the project."""
open62541_version_source = local.path(self.source_of_primary)

c_compiler = bb.compiler.cc(self)
build_folder = open62541_version_source / "build"
build_folder.mkdir()

with local.cwd(build_folder):
with local.env(CC=str(c_compiler)):
bb.watch(cmake)("..")

bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

with local.cwd(open62541_version_source):
verify_binaries(self)
1 change: 1 addition & 0 deletions varats/varats/tools/bb_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def update_projects(
'varats.projects.c_projects.libxml2',
'varats.projects.c_projects.lrzip',
'varats.projects.c_projects.lz4',
'varats.projects.c_projects.open62541',
'varats.projects.c_projects.openssl',
'varats.projects.c_projects.openvpn',
'varats.projects.c_projects.opus',
Expand Down

0 comments on commit 5bc8c4e

Please sign in to comment.