aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
Diffstat (limited to 'debug')
-rwxr-xr-xdebug/gdbserver.py9
-rw-r--r--debug/testlib.py12
2 files changed, 11 insertions, 10 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py
index ba30b9b..235814a 100755
--- a/debug/gdbserver.py
+++ b/debug/gdbserver.py
@@ -11,7 +11,6 @@ import os
import re
import itertools
-from datetime import datetime
import targets
import testlib
from testlib import assertEqual, assertNotEqual
@@ -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
diff --git a/debug/testlib.py b/debug/testlib.py
index 41d9cea..0279b08 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -1,6 +1,7 @@
import collections
import os
import os.path
+import random
import re
import shlex
import subprocess
@@ -9,6 +10,8 @@ import tempfile
import time
import traceback
+from datetime import datetime
+
import tty
import pexpect
import yaml
@@ -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=':')
@@ -1293,7 +1304,6 @@ class BaseTest:
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