From 84374b4b4e41c4bb7896092c10098b5e6b5f68c1 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 11 Sep 2019 17:59:23 +0200 Subject: explicitly collect binary versions There is no generic way to retrieve the version of a binary. Not everyone followes GNU cli guidelines and supports "--version". The larson benchmark for example reads input from stdin when started with "larson --version" blocking the Benchmark.prepare() call. --- src/benchmarks/httpd.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/benchmarks/httpd.py') diff --git a/src/benchmarks/httpd.py b/src/benchmarks/httpd.py index 4569500..7284e2e 100644 --- a/src/benchmarks/httpd.py +++ b/src/benchmarks/httpd.py @@ -20,6 +20,7 @@ import re from src.benchmark import Benchmark +import src.facter class BenchmarkHTTPD(Benchmark): @@ -42,6 +43,12 @@ class BenchmarkHTTPD(Benchmark): super().__init__(name) + def prepare(self): + super().prepare() + + self.results["facts"]["versions"]["nginx"] = src.facter.exe_version("nginx", "-v") + self.results["facts"]["versions"]["ab"] = src.facter.exe_version("ab", "-V") + @staticmethod def process_output(result, stdout, stderr, allocator, perm): result["time"] = re.search("Time taken for tests:\\s*(\\d*\\.\\d*) seconds", stdout).group(1) -- cgit v1.2.3