Skip to content

Commit

Permalink
Merge pull request #561 from TommyMurphyTM1234/fix-list-tests
Browse files Browse the repository at this point in the history
Debug: suppress `PRNG seed ...` log messages when `gdbserver.py --list-tests <target>` used
  • Loading branch information
aap-sc authored Jun 27, 2024
2 parents e06a435 + 6c1ab37 commit 74c9c14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 0 additions & 9 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import re
import itertools

from datetime import datetime
import targets
import testlib
from testlib import assertEqual, assertNotEqual
Expand Down Expand Up @@ -2213,14 +2212,6 @@ def main():

module = sys.modules[__name__]

# initialize PRNG
selected_seed = parsed.seed
if parsed.seed is None:
selected_seed = int(datetime.now().timestamp())
print(f"PRNG seed for {target.name} is generated automatically")
print(f"PRNG seed for {target.name} is {selected_seed}")
random.seed(selected_seed)

return testlib.run_all_tests(module, target, parsed)

# TROUBLESHOOTING TIPS
Expand Down
12 changes: 11 additions & 1 deletion debug/testlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collections
import os
import os.path
import random
import re
import shlex
import subprocess
Expand All @@ -9,6 +10,8 @@
import time
import traceback

from datetime import datetime

import tty
import pexpect
import yaml
Expand Down Expand Up @@ -1161,6 +1164,14 @@ def run_all_tests(module, target, parsed):
excluded_tests = load_excluded_tests(parsed.exclude_tests, target.name)
target.skip_tests += excluded_tests

# initialize PRNG
selected_seed = parsed.seed
if parsed.seed is None:
selected_seed = int(datetime.now().timestamp())
print(f"PRNG seed for {target.name} is generated automatically")
print(f"PRNG seed for {target.name} is {selected_seed}")
random.seed(selected_seed)

results, count = run_tests(parsed, target, todo)

header(f"ran {count} tests in {time.time() - overall_start:.0f}s", dash=':')
Expand Down Expand Up @@ -1293,7 +1304,6 @@ def __init__(self, target, hart=None):
if not hart is None:
self.hart = hart
else:
import random # pylint: disable=import-outside-toplevel
self.hart = random.choice(target.harts)
#self.hart = target.harts[-1]
self.server = None
Expand Down

0 comments on commit 74c9c14

Please sign in to comment.