Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug: suppress PRNG seed ... log messages when gdbserver.py --list-tests <target> used #561

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1160,6 +1163,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 @@ -1292,7 +1303,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
Loading