Skip to content

Commit

Permalink
misc: 'sim{out/err}' -> 'sim{out/err}.txt' (#250)
Browse files Browse the repository at this point in the history
By default, the `--stderr-file` and `--stdout-file` arguments were
directing the simulator to output files named "simerr" and "simout"
respectively if an output redirect was requested.

A small annoyance is these files lack an extension meaning programs
refuse to open them, or don't do so withou additional effort. On many
systems they are assumed to scripts.

This patch adds the `.txt` extension to both, thus clearly indicating to
other programs these are text files and can be opened and read as such.
  • Loading branch information
BobbyRBruce committed Sep 28, 2023
2 parents 5d254ff + 391f62b commit 62d34ef
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions ext/testlib/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ def define_constants(constants):
constants.supported_hosts = constants.supported_tags["host"]

constants.tempdir_fixture_name = "tempdir"
constants.gem5_simulation_stderr = "simerr"
constants.gem5_simulation_stdout = "simout"
constants.gem5_simulation_stderr = "simerr.txt"
constants.gem5_simulation_stdout = "simout.txt"
constants.gem5_simulation_stats = "stats.txt"
constants.gem5_simulation_config_ini = "config.ini"
constants.gem5_simulation_config_json = "config.json"
Expand Down
4 changes: 2 additions & 2 deletions src/python/m5/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ def parse_options():
option(
"--stdout-file",
metavar="FILE",
default="simout",
default="simout.txt",
help="Filename for -r redirection [Default: %default]",
)
option(
"--stderr-file",
metavar="FILE",
default="simerr",
default="simerr.txt",
help="Filename for -e redirection [Default: %default]",
)
option(
Expand Down
2 changes: 1 addition & 1 deletion src/systemc/tests/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def run(self, tests):
missing = []
log_file = ".".join([test.name, "log"])
log_path = gd.entry(log_file)
simout_path = os.path.join(out_dir, "simout")
simout_path = os.path.join(out_dir, "simout.txt")
if not os.path.exists(simout_path):
missing.append("log output")
elif log_path:
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tests/gem5/dram_lowp/test_dram_lowp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@

from testlib import *

verifiers = (verifier.MatchStdoutNoPerf(joinpath(getcwd(), "ref", "simout")),)
verifiers = (
verifier.MatchStdoutNoPerf(joinpath(getcwd(), "ref", "simout.txt")),
)

gem5_verify_config(
name="test-low_power-close_adaptive",
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tests/gem5/insttest_se/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
for isa in test_progs:
for binary in test_progs[isa]:
ref_path = joinpath(getcwd(), "ref")
verifiers = (verifier.MatchStdoutNoPerf(joinpath(ref_path, "simout")),)
verifiers = (
verifier.MatchStdoutNoPerf(joinpath(ref_path, "simout.txt")),
)

for cpu in cpu_types[isa]:
gem5_verify_config(
Expand Down
2 changes: 1 addition & 1 deletion tests/gem5/m5threads_test_atomic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
test_atomic = DownloadedProgram(url, base_path, binary)

verifiers = (
verifier.MatchStdoutNoPerf(joinpath(getcwd(), "ref/sparc64/simout")),
verifier.MatchStdoutNoPerf(joinpath(getcwd(), "ref/sparc64/simout.txt")),
)

for cpu in cpu_types:
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tests/gem5/stdlib/simulator/test_event_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
with different configurations of the BaseCPUProcessor.
"""

verifiers = (verifier.MatchStdoutNoPerf(joinpath(getcwd(), "ref", "simout")),)
verifiers = (
verifier.MatchStdoutNoPerf(joinpath(getcwd(), "ref", "simout.txt")),
)


gem5_verify_config(
Expand Down
2 changes: 1 addition & 1 deletion tests/gem5/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MatchGoldStandard(Verifier):
"""

def __init__(
self, standard_filename, ignore_regex=None, test_filename="simout"
self, standard_filename, ignore_regex=None, test_filename="simout.txt"
):
"""
:param standard_filename: The path of the standard file to compare
Expand Down
8 changes: 4 additions & 4 deletions util/plot_dram/dram_lat_mem_rd_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import re

# This script is intended to post process and plot the output from
# running configs/dram/lat_mem_rd.py, as such it parses the simout and
# running configs/dram/lat_mem_rd.py, as such it parses the simout.txt and
# stats.txt to get the relevant data points.
def main():

Expand All @@ -62,9 +62,9 @@ def main():
exit(-1)

try:
simout = open(sys.argv[1] + "/simout", "r")
simout = open(sys.argv[1] + "/simout.txt", "r")
except IOError:
print("Failed to open ", sys.argv[1] + "/simout", " for reading")
print("Failed to open ", sys.argv[1] + "/simout.txt", " for reading")
exit(-1)

# Get the address ranges
Expand All @@ -85,7 +85,7 @@ def main():
simout.close()

if not got_ranges:
print("Failed to get address ranges, ensure simout is up-to-date")
print("Failed to get address ranges, ensure simout.txt is up-to-date")
exit(-1)

# Now parse the stats
Expand Down
8 changes: 5 additions & 3 deletions util/plot_dram/dram_sweep_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def main():
exit(-1)

try:
simout = open(sys.argv[2] + "/simout", "r")
simout = open(sys.argv[2] + "/simout.txt", "r")
except IOError:
print("Failed to open ", sys.argv[2] + "/simout", " for reading")
print("Failed to open ", sys.argv[2] + "/simout.txt", " for reading")
exit(-1)

# Get the burst size, number of banks and the maximum stride from
Expand All @@ -102,7 +102,9 @@ def main():
simout.close()

if not got_sweep:
print("Failed to establish sweep details, ensure simout is up-to-date")
print(
"Failed to establish sweep details, ensure simout.txt is up-to-date"
)
exit(-1)

# Now parse the stats
Expand Down

0 comments on commit 62d34ef

Please sign in to comment.