Skip to content
Snippets Groups Projects

P2P

Open
Jammer, Timrequested to merge
p2p into main
1 file
+ 10
3
Compare changes
  • Side-by-side
  • Inline
+ 10
3
@@ -5,7 +5,6 @@ import typing
@@ -5,7 +5,6 @@ import typing
from scripts.Infrastructure.Instruction import Instruction
from scripts.Infrastructure.Instruction import Instruction
template = """// @{generatedby}@
template = """// @{generatedby}@
/* ///////////////////////// The MPI Bug Bench ////////////////////////
/* ///////////////////////// The MPI Bug Bench ////////////////////////
@@ -149,15 +148,23 @@ class TemplateManager:
@@ -149,15 +148,23 @@ class TemplateManager:
.replace("@{version}@", version)
.replace("@{version}@", version)
.replace("@{test_code}@", code_string))
.replace("@{test_code}@", code_string))
def register_instruction(self, inst: Instruction | typing.List[Instruction]):
def register_instruction(self, inst: str | Instruction | typing.List[Instruction], identifier: str = None):
"""
"""
Registers an instruction block with the template. inserting it at the end, before the mpi finalize
Registers an instruction block with the template. inserting it at the end, before the mpi finalize
Parameters:
Parameters:
- block: The instruction block to register.
- inst: The instruction to register.
 
- optional: identifier: overwirtes the identifier of the instructioneith the provided one (no override if None)
"""
"""
if isinstance(inst, list):
if isinstance(inst, list):
 
if identifier is not None:
 
for i in inst:
 
i.set_identifier(identifier)
self._instructions.extend(inst)
self._instructions.extend(inst)
else:
else:
 
if isinstance(inst, str):
 
self._instructions.append(Instruction(inst, identifier))
 
if identifier is not None:
 
inst.set_identifier(identifier)
self._instructions.append(inst)
self._instructions.append(inst)
def get_version(self) -> str:
def get_version(self) -> str:
Loading