Commit 77a2d8ea authored by Jérome Perrin's avatar Jérome Perrin

software/erp5/benchmarks: describe software used in measure files

This can be helpful when comparing measurements or more generally when
trying multiple versions
parent 7209b58a
...@@ -102,6 +102,41 @@ class TestOrderBuildPackingListSimulation( ...@@ -102,6 +102,41 @@ class TestOrderBuildPackingListSimulation(
self.measurement_file = open(f'measures{self.id()}.jsonl', 'w') self.measurement_file = open(f'measures{self.id()}.jsonl', 'w')
self.addCleanup(self.measurement_file.close) self.addCleanup(self.measurement_file.close)
# Describe the software used. TODO: use nxd-bom once integrated
self.write_measurement(
{
'type': 'sbom',
# content of runwsgi script, to know which versions of python packages were used
'runwsgi-content':
(pathlib.Path(
self.computer_partition_root_path
) / 'software_release' / 'bin' / 'runwsgi').read_text(),
'mysql-show-variables':
subprocess.check_output((
pathlib.Path(self.getComputerPartitionPath('mariadb')) / 'bin' / 'mysql',
'-e', 'show variables'), text=True),
'erp5-git-describe':
subprocess.check_output(
('git', 'describe', '--long'),
cwd=pathlib.Path(self.computer_partition_root_path) / 'software_release' / 'parts' / 'erp5',
text=True),
'erp5-git-diff':
subprocess.check_output(
('git', 'diff'),
cwd=pathlib.Path(self.computer_partition_root_path) / 'software_release' / 'parts' / 'erp5',
text=True),
'slapos-software-release-git-describe':
subprocess.check_output(
('git', 'describe', '--long'),
cwd=pathlib.Path(self.getSoftwareURL()).parent,
text=True),
'slapos-software-release-git-diff':
subprocess.check_output(
('git', 'diff'),
cwd=pathlib.Path(self.getSoftwareURL()).parent,
text=True),
})
def write_measurement( def write_measurement(
self, measurement: dict[str, typing.Union[str, float]]) -> None: self, measurement: dict[str, typing.Union[str, float]]) -> None:
json.dump( json.dump(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment