32 lines
781 B
Python
32 lines
781 B
Python
import subprocess
|
|
|
|
green = '\033[32m'
|
|
red = '\033[31m'
|
|
clr = '\033[0m'
|
|
|
|
expected = {
|
|
"2048 dm uc": 0.8903,
|
|
"1024 dm uc": 0.8731,
|
|
"2048 dm sc": 0.9104,
|
|
"1024 dm sc": 0.8903,
|
|
"2048 fa uc": 0.9174,
|
|
"1024 fa uc": 0.8918,
|
|
"2048 fa sc": 0.9167,
|
|
"1024 fa sc": 0.8955,
|
|
}
|
|
|
|
for (args, ex) in expected.items():
|
|
try:
|
|
command = ['./cache_sim'] + args.split(' ') + [ ]
|
|
sim = subprocess.Popen(command, stdout=subprocess.PIPE)
|
|
sim.wait()
|
|
subprocess.check_call(('grep', f'Hit Rate: {ex}'), stdin = sim.stdout)
|
|
print(f'[{green}V{clr}] {args}: {ex}')
|
|
except:
|
|
print(f'[{red}X{clr}] {args}: {ex}')
|
|
|
|
# Optimally, we would tee the output from the original sim here, but it's too teedious :)
|
|
sim2 = subprocess.Popen(command)
|
|
sim2.wait()
|
|
print()
|