diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-04-02 11:44:30 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-04-02 11:44:30 +0200 |
| commit | 41f39d2b69bb0747c1aed63c84d440b32b303d2c (patch) | |
| tree | 527d1e453f8ce2903f6fede8709c5760300cdf70 /src/benchmark.py | |
| parent | 7f19d36ced806ffd138c4b48de6145068cc4f0b3 (diff) | |
| download | allocbench-41f39d2b69bb0747c1aed63c84d440b32b303d2c.tar.gz allocbench-41f39d2b69bb0747c1aed63c84d440b32b303d2c.zip | |
move find_cmd to src/util.py
Diffstat (limited to 'src/benchmark.py')
| -rw-r--r-- | src/benchmark.py | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/benchmark.py b/src/benchmark.py index 2fea8df..23efb1e 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -132,33 +132,14 @@ class Benchmark (object): self.results[s][allocator] = d def prepare(self): - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - - os.environ["PATH"] += ":" + os.path.join("build", "benchmarks", - self.name) + os.environ["PATH"] += os.pathsep + os.path.join("build", "benchmarks", self.name) for r in self.requirements: - fpath, fname = os.path.split(r) - - # Search for file - if fpath: - if not is_exe(r): - raise Exception("Requirement: {} not found".format(r)) - else: - self.results["facts"]["libcs"][exe_file] = src.facter.get_libc_version(bin=exe_file) - # Search in PATH + exe = find_cmd(r) + if exe is not None: + self.results["facts"]["libc"][r] = src.facter.get_libc_version(bin=exe) else: - found = False - for path in os.environ["PATH"].split(os.pathsep): - exe_file = os.path.join(path, r) - if is_exe(exe_file): - self.results["facts"]["libcs"][exe_file] = src.facter.get_libc_version(bin=exe_file) - found = True - break - - if not found: - raise Exception("Requirement: {} not found".format(r)) + raise Exception("Requirement: {} not found".format(r)) def iterate_args(self, args=None): """Return a dict for each possible combination of args""" |
