diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-11-09 13:10:35 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2023-11-09 13:10:35 -0500 |
commit | 16b1543eb8cf12b974f8386ed25d497c71a7acfa (patch) | |
tree | feda445f24f1b2716cc9d77a9ef1d379f1df2d98 | |
parent | 2384a0271f91684172f6774951855adf48824241 (diff) |
Add timeout for baseline53-formattage-script-python
-rw-r--r-- | benchmarking/test-suite/requirements_win.txt | 1 | ||||
-rwxr-xr-x | benchmarking/test-suite/testsweet.py | 28 |
2 files changed, 16 insertions, 13 deletions
diff --git a/benchmarking/test-suite/requirements_win.txt b/benchmarking/test-suite/requirements_win.txt index a9855d0..645fea3 100644 --- a/benchmarking/test-suite/requirements_win.txt +++ b/benchmarking/test-suite/requirements_win.txt @@ -1,2 +1 @@ -winapps windows-curses diff --git a/benchmarking/test-suite/testsweet.py b/benchmarking/test-suite/testsweet.py index def4652..f5a2056 100755 --- a/benchmarking/test-suite/testsweet.py +++ b/benchmarking/test-suite/testsweet.py @@ -1,8 +1,9 @@ -#!/bin/python3installing it with +#!/bin/python3 # -*- coding: utf-8 -*- import datetime import os +import shutil import subprocess import sys import tarfile @@ -111,7 +112,7 @@ class Linux(OS): for directory in os.listdir(self.cache_dir): if directory not in os.environ["PATH"]: os.environ["PATH"] += f":{self.cache_dir}/{directory}" - return True + return shutil.which(package) is not None def install(self, package, force=False): print(f"Installing {package}...") @@ -147,9 +148,6 @@ class Linux(OS): os.system("killall glances") - - - class Windows(OS): """Windows Operating System""" @@ -157,12 +155,14 @@ class Windows(OS): super().__init__("windows") def is_installed(self, package): + binary = SOURCES[package][self.name+"_bin"] # Check if the package is installed on the system with where - if shutil.which(package) is not None: - return True - else: - return False - # return os.system(f"where {package}") == 0 + return ( + # Check if the package is installed on the system with where + shutil.which(package) and + # The dict mentions a binary + binary is not None + ) is not None def install(self, package, force=False): # Cd into the cachedir @@ -200,8 +200,12 @@ class Windows(OS): "--export", "csv", f"--export-csv-file={self.stats_dir}/{date}_{package}.csv"]) for _ in range(iterations): - subprocess.run([f"{package}", - f"{SOURCES[package][self.name+'_flags']}"]) + if package == "baseline": + # Wait for 1 second + subprocess.run(["timeout", "/t", "1"]) + else: + subprocess.run([f"{package}", + f"{SOURCES[package][self.name+'_flags']}"]) if monitor: subprocess.run(["taskkill", "/IM", "glances.exe", "/F"]) |