testitpy 0.1__tar.gz → 0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testitpy-0.1 → testitpy-0.2}/.github/workflows/release.yml +1 -1
- {testitpy-0.1/src/testitpy.egg-info → testitpy-0.2}/PKG-INFO +32 -3
- testitpy-0.2/README.md +37 -0
- {testitpy-0.1 → testitpy-0.2}/pyproject.toml +1 -1
- {testitpy-0.1 → testitpy-0.2}/src/testit/main.py +2 -2
- {testitpy-0.1 → testitpy-0.2}/src/testit/run.py +77 -27
- {testitpy-0.1 → testitpy-0.2}/src/testit/run_util.py +8 -8
- testitpy-0.2/src/testit/templates/config.test +58 -0
- {testitpy-0.1 → testitpy-0.2}/src/testit/testit.py +21 -7
- {testitpy-0.1 → testitpy-0.2}/src/testit/testit_util.py +6 -9
- {testitpy-0.1 → testitpy-0.2/src/testitpy.egg-info}/PKG-INFO +32 -3
- {testitpy-0.1 → testitpy-0.2}/src/testitpy.egg-info/SOURCES.txt +0 -1
- testitpy-0.1/README.md +0 -8
- testitpy-0.1/old_setup.py +0 -34
- testitpy-0.1/src/testit/templates/config.test +0 -148
- {testitpy-0.1 → testitpy-0.2}/.gitignore +0 -0
- {testitpy-0.1 → testitpy-0.2}/LICENSE +0 -0
- {testitpy-0.1 → testitpy-0.2}/setup.cfg +0 -0
- {testitpy-0.1 → testitpy-0.2}/src/testit/__init__.py +0 -0
- {testitpy-0.1 → testitpy-0.2}/src/testit/templates/testit_golden.py +0 -0
- {testitpy-0.1 → testitpy-0.2}/src/testitpy.egg-info/dependency_links.txt +0 -0
- {testitpy-0.1 → testitpy-0.2}/src/testitpy.egg-info/entry_points.txt +0 -0
- {testitpy-0.1 → testitpy-0.2}/src/testitpy.egg-info/requires.txt +0 -0
- {testitpy-0.1 → testitpy-0.2}/src/testitpy.egg-info/top_level.txt +0 -0
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
publish-to-pypi:
|
|
34
34
|
name: >-
|
|
35
35
|
Publish Python 🐍 distribution 📦 to PyPI
|
|
36
|
-
|
|
36
|
+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
37
37
|
needs:
|
|
38
38
|
- build
|
|
39
39
|
runs-on: ubuntu-latest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: testitpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2
|
|
4
4
|
Summary: A tool for verifying RTL and FPGA models using custom SW applications
|
|
5
5
|
Author-email: Tommaso Terzano <tommaso.terzano@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -690,9 +690,38 @@ Requires-Dist: importlib_resources
|
|
|
690
690
|
|
|
691
691
|
# testit
|
|
692
692
|
|
|
693
|
+
A python package which automates the SBST verification of any embedded RTL project.
|
|
694
|
+
|
|
695
|
+
## Installation
|
|
696
|
+
|
|
697
|
+
```bash
|
|
698
|
+
pip install testitpy
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
## Usage
|
|
702
|
+
|
|
703
|
+
```bash
|
|
704
|
+
$ testit -h
|
|
705
|
+
|
|
706
|
+
usage: testit [-h] {run,setup,report} ...
|
|
707
|
+
|
|
708
|
+
TestIt CLI tool
|
|
709
|
+
|
|
710
|
+
positional arguments:
|
|
711
|
+
{run,setup,report}
|
|
712
|
+
run Run the verification process
|
|
713
|
+
setup Set up the verification environment
|
|
714
|
+
report Generate a report based on the test results
|
|
715
|
+
|
|
716
|
+
options:
|
|
717
|
+
-h, --help show this help message and exit
|
|
718
|
+
```
|
|
719
|
+
|
|
693
720
|
[](https://github.com/vlsi-lab/TestIt/actions/workflows/release.yml)
|
|
694
721
|
|
|
695
|
-
|
|
696
|
-
|
|
722
|
+
[](https://pypistats.org/packages/testitpy) [](https://pypi.org/project/testitpy/) [](https://github.com/vlsi-lab/TestIt)
|
|
723
|
+
|
|
724
|
+
---
|
|
697
725
|
|
|
726
|
+
This is the package structure:
|
|
698
727
|
|
testitpy-0.2/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# testit
|
|
2
|
+
|
|
3
|
+
A python package which automates the SBST verification of any embedded RTL project.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install testitpy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
$ testit -h
|
|
15
|
+
|
|
16
|
+
usage: testit [-h] {run,setup,report} ...
|
|
17
|
+
|
|
18
|
+
TestIt CLI tool
|
|
19
|
+
|
|
20
|
+
positional arguments:
|
|
21
|
+
{run,setup,report}
|
|
22
|
+
run Run the verification process
|
|
23
|
+
setup Set up the verification environment
|
|
24
|
+
report Generate a report based on the test results
|
|
25
|
+
|
|
26
|
+
options:
|
|
27
|
+
-h, --help show this help message and exit
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
[](https://github.com/vlsi-lab/TestIt/actions/workflows/release.yml)
|
|
31
|
+
|
|
32
|
+
[](https://pypistats.org/packages/testitpy) [](https://pypi.org/project/testitpy/) [](https://github.com/vlsi-lab/TestIt)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
This is the package structure:
|
|
37
|
+
|
|
@@ -18,7 +18,7 @@ def main():
|
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
run_parser.add_argument(
|
|
21
|
-
"--
|
|
21
|
+
"--sweep",
|
|
22
22
|
action="store_true",
|
|
23
23
|
help="Test every possible combination of parameters"
|
|
24
24
|
)
|
|
@@ -46,7 +46,7 @@ def main():
|
|
|
46
46
|
args = parser.parse_args()
|
|
47
47
|
|
|
48
48
|
if args.command == "run":
|
|
49
|
-
run.testit_run(args.nobuild, args.mammamia, args.
|
|
49
|
+
run.testit_run(args.nobuild, args.mammamia, args.sweep)
|
|
50
50
|
elif args.command == "setup":
|
|
51
51
|
run.testit_setup()
|
|
52
52
|
elif args.command == "report":
|
|
@@ -6,26 +6,33 @@ from . import testit
|
|
|
6
6
|
import os
|
|
7
7
|
import threading
|
|
8
8
|
import queue
|
|
9
|
+
import time
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
import os
|
|
12
|
+
import time
|
|
13
|
+
import json
|
|
14
|
+
from rich import print
|
|
15
|
+
from rich.progress import Progress, TextColumn, BarColumn, TimeRemainingColumn, SpinnerColumn
|
|
16
|
+
from rich.status import Status
|
|
17
|
+
|
|
18
|
+
def testit_run(no_build=False, italian_mode=False, sweep_mode=False):
|
|
11
19
|
|
|
12
20
|
current_directory = os.getcwd()
|
|
13
21
|
|
|
14
22
|
# Load the configuration file
|
|
15
23
|
data = run_util._load_config()
|
|
16
24
|
if data is None:
|
|
17
|
-
rich.print("[bold red]ERROR: config.test not found![/bold red")
|
|
25
|
+
rich.print("[bold red]ERROR: config.test not found![/bold red]")
|
|
18
26
|
rich.print("Please run the 'setup' command first.")
|
|
19
27
|
exit(1)
|
|
20
28
|
|
|
21
29
|
if not os.path.exists(f"{current_directory}/testit_golden.py"):
|
|
22
|
-
rich.print("[bold red]ERROR: testit_golden.py not found![/bold red")
|
|
30
|
+
rich.print("[bold red]ERROR: testit_golden.py not found![/bold red]")
|
|
23
31
|
rich.print("Please run the 'setup' command first.")
|
|
24
32
|
exit(1)
|
|
25
33
|
|
|
26
34
|
# Create the TestIt object
|
|
27
35
|
testEnv = testit.TestItEnv(data)
|
|
28
|
-
|
|
29
36
|
testEnv.clear_results()
|
|
30
37
|
|
|
31
38
|
if not italian_mode:
|
|
@@ -39,7 +46,7 @@ def testit_run(no_build=False, italian_mode=False, swipe_mode=False):
|
|
|
39
46
|
rich.print(" - [bold red]ERROR: Target project Makefile check failed![/bold red]")
|
|
40
47
|
rich.print(" Please ensure that the Makefile contains the required targets")
|
|
41
48
|
exit(1)
|
|
42
|
-
elif not run_util._configuration_check(data,
|
|
49
|
+
elif not run_util._configuration_check(data, sweep_mode):
|
|
43
50
|
rich.print(" - [bold red]ERROR: there is an issue with config.test critical parameters![/bold red]")
|
|
44
51
|
exit(1)
|
|
45
52
|
else:
|
|
@@ -102,7 +109,15 @@ def testit_run(no_build=False, italian_mode=False, swipe_mode=False):
|
|
|
102
109
|
else:
|
|
103
110
|
rich.print(" - Pelati cans [bold green][OPENED][/bold green]")
|
|
104
111
|
|
|
105
|
-
testEnv.setup_deb()
|
|
112
|
+
deb_setup_success = testEnv.setup_deb()
|
|
113
|
+
if not deb_setup_success:
|
|
114
|
+
rich.print(f" - [bold red]ERROR: Debugger setup failed![/bold red]")
|
|
115
|
+
exit(1)
|
|
116
|
+
else:
|
|
117
|
+
if not italian_mode:
|
|
118
|
+
rich.print(" - Debugger setup [bold green][OK][/bold green]")
|
|
119
|
+
else:
|
|
120
|
+
rich.print(" - Basil leaves [bold green][PICKED][/bold green]")
|
|
106
121
|
|
|
107
122
|
if not italian_mode:
|
|
108
123
|
with Status(" - [cyan]Setting up GDB...[/cyan]", spinner="dots") as status:
|
|
@@ -139,51 +154,68 @@ def testit_run(no_build=False, italian_mode=False, swipe_mode=False):
|
|
|
139
154
|
) as progress:
|
|
140
155
|
|
|
141
156
|
# Compute the total test iterations
|
|
142
|
-
if not
|
|
157
|
+
if not sweep_mode:
|
|
143
158
|
test_iterations = data['target']['iterations']
|
|
144
159
|
else:
|
|
145
|
-
|
|
160
|
+
sweep_test_iterations = run_util._get_tot_sweep_iterations(data)
|
|
146
161
|
|
|
147
162
|
test_index = 0
|
|
148
163
|
for test in data['tests']:
|
|
149
|
-
test['totIterations'] =
|
|
164
|
+
test['totIterations'] = sweep_test_iterations[test_index]
|
|
150
165
|
test['currentIteration'] = 0
|
|
151
166
|
test_index += 1
|
|
152
167
|
|
|
153
|
-
if isinstance(
|
|
154
|
-
test_iterations = max(
|
|
168
|
+
if isinstance(sweep_test_iterations, list):
|
|
169
|
+
test_iterations = max(sweep_test_iterations)
|
|
155
170
|
else:
|
|
156
|
-
test_iterations =
|
|
171
|
+
test_iterations = sweep_test_iterations
|
|
157
172
|
|
|
158
|
-
rich.print("[yellow]WARNING[/yellow]:
|
|
173
|
+
rich.print("[yellow]WARNING[/yellow]: sweep mode is active, TestIt will cycle through each possible combination of parameters for each test")
|
|
159
174
|
|
|
160
|
-
# Run the verification campaign
|
|
161
175
|
if not italian_mode:
|
|
162
|
-
|
|
176
|
+
task_message = " - Running tests..."
|
|
163
177
|
else:
|
|
164
|
-
|
|
178
|
+
task_message = " - Cooking..."
|
|
165
179
|
|
|
166
180
|
task = progress.add_task(task_message, total=test_iterations, start=False)
|
|
167
181
|
start = False
|
|
168
182
|
|
|
169
183
|
test_counter = 0
|
|
170
184
|
|
|
185
|
+
test_duration_report = {}
|
|
186
|
+
|
|
171
187
|
for test_iteration in range(test_iterations):
|
|
172
|
-
if not testEnv.gen_datasets(
|
|
173
|
-
|
|
174
|
-
|
|
188
|
+
if not testEnv.gen_datasets(sweep_mode, test_iteration):
|
|
189
|
+
rich.print(f" - [bold red]ERROR: Dataset generation failed![/bold red]")
|
|
190
|
+
exit(1)
|
|
175
191
|
|
|
176
192
|
update_list_of_tests = False
|
|
177
193
|
|
|
194
|
+
# Prepare a list for the current iteration's test durations
|
|
195
|
+
test_duration_report[test_iteration] = []
|
|
196
|
+
|
|
178
197
|
for test in data['tests']:
|
|
179
|
-
|
|
180
|
-
|
|
198
|
+
start_time = time.time()
|
|
199
|
+
|
|
200
|
+
# Re-setup debugger every 10 tests if using FPGA
|
|
201
|
+
if test_counter == 10 and data['target']['type'] == "fpga":
|
|
181
202
|
test_counter = 0
|
|
203
|
+
testEnv.stop_gdb()
|
|
182
204
|
testEnv.stop_deb()
|
|
205
|
+
|
|
206
|
+
deb_setup_success = testEnv.setup_deb()
|
|
207
|
+
if not deb_setup_success:
|
|
208
|
+
deb_setup_again_success = testEnv.setup_deb()
|
|
209
|
+
if not deb_setup_again_success:
|
|
210
|
+
rich.print(f" - [bold red]ERROR: Failed to re-setup debugger[/bold red]")
|
|
211
|
+
exit(1)
|
|
212
|
+
|
|
183
213
|
gdb_setup_success = testEnv.setup_gdb()
|
|
184
214
|
if not gdb_setup_success:
|
|
185
|
-
|
|
186
|
-
|
|
215
|
+
gdb_setup_again_success = testEnv.setup_gdb()
|
|
216
|
+
if not gdb_setup_again_success:
|
|
217
|
+
rich.print(f" - [bold red]ERROR: Failed to re-setup GDB[/bold red]")
|
|
218
|
+
exit(1)
|
|
187
219
|
else:
|
|
188
220
|
test_counter += 1
|
|
189
221
|
|
|
@@ -191,26 +223,43 @@ def testit_run(no_build=False, italian_mode=False, swipe_mode=False):
|
|
|
191
223
|
if not testEnv.launch_test(app_name=test['appName'], iteration=test_iteration, pattern=rf"{test['outputFormat']}", output_tags=test['outputTags'], timeout_t=1000):
|
|
192
224
|
rich.print(f" - [bold red]ERROR: Test {test['appName']} failed because of GDB timeout[/bold red]")
|
|
193
225
|
exit(1)
|
|
226
|
+
|
|
194
227
|
if not start:
|
|
195
228
|
progress.start_task(task)
|
|
196
|
-
# threading.Thread(target=run_util._update_time_estimation, args=(progress,task,), daemon=True).start()
|
|
197
229
|
start = True
|
|
198
230
|
|
|
199
|
-
progress.update(task, advance=1,
|
|
231
|
+
progress.update(task, advance=1,
|
|
232
|
+
description=f" - [cyan]{test_iteration + 1}/{test_iterations}: {test['appName']}",
|
|
233
|
+
refresh=True)
|
|
200
234
|
|
|
201
|
-
if
|
|
235
|
+
if sweep_mode:
|
|
202
236
|
test['currentIteration'] += 1
|
|
203
237
|
if test['currentIteration'] == test['totIterations']:
|
|
204
238
|
test_to_be_removed_name = test['appName']
|
|
205
239
|
new_data = [p for p in data['tests'] if p['appName'] != test_to_be_removed_name]
|
|
206
240
|
update_list_of_tests = True
|
|
207
|
-
|
|
241
|
+
|
|
242
|
+
end_time = time.time()
|
|
243
|
+
duration = end_time - start_time
|
|
244
|
+
|
|
245
|
+
test_duration_report[test_iteration].append({
|
|
246
|
+
"name": test['appName'],
|
|
247
|
+
"duration": duration
|
|
248
|
+
})
|
|
249
|
+
|
|
208
250
|
if update_list_of_tests:
|
|
209
251
|
data['tests'] = new_data
|
|
210
252
|
|
|
211
253
|
if data['target']['type'] == "fpga":
|
|
212
254
|
testEnv.stop_deb()
|
|
213
255
|
|
|
256
|
+
# Output the time duration of the tests
|
|
257
|
+
report_dir = data['report']['dir']
|
|
258
|
+
os.makedirs(report_dir, exist_ok=True)
|
|
259
|
+
json_path = os.path.join(report_dir, "test_durations.json")
|
|
260
|
+
with open(json_path, "w") as f:
|
|
261
|
+
json.dump(test_duration_report, f, indent=2)
|
|
262
|
+
|
|
214
263
|
if not italian_mode:
|
|
215
264
|
rich.print(" - All tests [bold green][RAN][/bold green]")
|
|
216
265
|
rich.print("\nTestIt campaign [bold green]completed![/bold green]")
|
|
@@ -218,6 +267,7 @@ def testit_run(no_build=False, italian_mode=False, swipe_mode=False):
|
|
|
218
267
|
rich.print(" - Pasta [bold green][COOKED][/bold green]!")
|
|
219
268
|
rich.print("\n[bold green]A tavola![/bold green]")
|
|
220
269
|
|
|
270
|
+
|
|
221
271
|
# If necessary, generates the necessary files for the TestIt package: testit_golden.py and config.test
|
|
222
272
|
def testit_setup():
|
|
223
273
|
current_directory = os.getcwd()
|
|
@@ -63,7 +63,7 @@ def _update_time_estimation(progress, task_id):
|
|
|
63
63
|
progress.refresh()
|
|
64
64
|
time.sleep(0.2) # Adjust this to control the update frequency
|
|
65
65
|
|
|
66
|
-
def _configuration_check(configuration,
|
|
66
|
+
def _configuration_check(configuration, sweep_mode):
|
|
67
67
|
if configuration['target']['type'] not in ["sim", "fpga"]:
|
|
68
68
|
rich.print(" [bold red]ERROR: Invalid target type![/bold red]")
|
|
69
69
|
rich.print(f" {configuration['target']['type']} is neither 'sim' nor 'fpga'")
|
|
@@ -73,27 +73,27 @@ def _configuration_check(configuration, swipe_mode):
|
|
|
73
73
|
rich.print(" [bold red]ERROR: invalid usbPort and/or baudrate![/bold red]")
|
|
74
74
|
return False
|
|
75
75
|
|
|
76
|
-
if
|
|
76
|
+
if sweep_mode:
|
|
77
77
|
for test in configuration['tests']:
|
|
78
78
|
if not any(isinstance(param["value"], list) for param in test["parameters"]):
|
|
79
|
-
rich.print(" [bold red]ERROR:
|
|
79
|
+
rich.print(" [bold red]ERROR: sweep mode requires every test to have at least one dynamic parameter![/bold red]")
|
|
80
80
|
return False
|
|
81
81
|
for param in test["parameters"]:
|
|
82
82
|
if isinstance(param['value'], list):
|
|
83
83
|
if 'step' not in param or not isinstance(param['step'], int):
|
|
84
|
-
rich.print(" [bold red]ERROR: with
|
|
84
|
+
rich.print(" [bold red]ERROR: with sweep mode, each parameter requires a 'step' parameter to be defined as an integer![/bold red]")
|
|
85
85
|
return False
|
|
86
86
|
|
|
87
87
|
return True
|
|
88
88
|
|
|
89
89
|
# Returns all the possible combinations of tests
|
|
90
|
-
def
|
|
91
|
-
|
|
90
|
+
def _get_tot_sweep_iterations(data):
|
|
91
|
+
sweep_parameters = []
|
|
92
92
|
for test in data['tests']:
|
|
93
93
|
tot = 1
|
|
94
94
|
for parameter in test['parameters']:
|
|
95
95
|
if isinstance(parameter['value'], list):
|
|
96
96
|
tot *= int(abs(parameter['value'][0] - parameter['value'][1])/parameter['step']) + 1
|
|
97
|
-
|
|
97
|
+
sweep_parameters.append(tot)
|
|
98
98
|
|
|
99
|
-
return
|
|
99
|
+
return sweep_parameters
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
target: {
|
|
3
|
+
name: "pynq-z2"
|
|
4
|
+
type: "fpga"
|
|
5
|
+
usbPort: 2
|
|
6
|
+
baudrate: 9600
|
|
7
|
+
iterations: 10
|
|
8
|
+
outputFile: "path/to/sim/dump"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
report: {
|
|
12
|
+
dir: "path/to/report/folder"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test: [
|
|
16
|
+
{
|
|
17
|
+
appName: "application_name"
|
|
18
|
+
dir: "path/to/app"
|
|
19
|
+
genFilesName: "test_data"
|
|
20
|
+
outputFormat: "(\\d+):(\\d+):(\\d+)"
|
|
21
|
+
outputTags: ["TestID", "Cycles", "Outcome"]
|
|
22
|
+
|
|
23
|
+
parameters: [
|
|
24
|
+
{
|
|
25
|
+
name: "SIZE"
|
|
26
|
+
value: [4, 10]
|
|
27
|
+
step: 2
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
inputDataset: [
|
|
32
|
+
{
|
|
33
|
+
name: "input_matrix_A"
|
|
34
|
+
dataType: "uint8_t"
|
|
35
|
+
valueRange: [0, 255]
|
|
36
|
+
dimensions: ["SIZE". "SIZE"]
|
|
37
|
+
}
|
|
38
|
+
{
|
|
39
|
+
name: "input_matrix_B"
|
|
40
|
+
dataType: "uint8_t"
|
|
41
|
+
valueRange: [0, 255]
|
|
42
|
+
dimensions: ["SIZE". "SIZE"]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
outputDataset: [
|
|
47
|
+
{
|
|
48
|
+
name: "output_matrix"
|
|
49
|
+
dataType: "uint8_t"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
goldenResultFunction: {
|
|
54
|
+
name: "matmul"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -83,7 +83,17 @@ class TestItEnv:
|
|
|
83
83
|
return True
|
|
84
84
|
|
|
85
85
|
def setup_deb(self):
|
|
86
|
-
|
|
86
|
+
deb_cmd = f"""
|
|
87
|
+
cd {os.getcwd()}
|
|
88
|
+
make deb-setup
|
|
89
|
+
"""
|
|
90
|
+
self.deb = pexpect.spawn(f"/bin/bash -c '{deb_cmd}'")
|
|
91
|
+
if self.deb.isalive():
|
|
92
|
+
return True
|
|
93
|
+
else:
|
|
94
|
+
print({self.deb.exitstatus})
|
|
95
|
+
return False
|
|
96
|
+
|
|
87
97
|
|
|
88
98
|
# Set-up GDB
|
|
89
99
|
def setup_gdb(self):
|
|
@@ -112,9 +122,13 @@ class TestItEnv:
|
|
|
112
122
|
exit(1)
|
|
113
123
|
|
|
114
124
|
# Stop GDB
|
|
115
|
-
def
|
|
125
|
+
def stop_gdb(self):
|
|
116
126
|
self.gdb.sendcontrol('c')
|
|
117
127
|
self.gdb.terminate()
|
|
128
|
+
|
|
129
|
+
def stop_deb(self):
|
|
130
|
+
self.deb.sendcontrol('c')
|
|
131
|
+
self.deb.terminate()
|
|
118
132
|
|
|
119
133
|
# Launch a test by compiling the target application and loading it into the FPGA flash via GDB
|
|
120
134
|
def launch_test(self, app_name, iteration, pattern=r'(\d+):(\d+):(\d+)', output_tags=None, timeout_t=0):
|
|
@@ -263,7 +277,7 @@ class TestItEnv:
|
|
|
263
277
|
|
|
264
278
|
# This function generates datasets for every test insered in config.test.
|
|
265
279
|
# Both input and output datasets are written in a single file, "data.c" and "data.h".
|
|
266
|
-
def gen_datasets(self,
|
|
280
|
+
def gen_datasets(self, sweep_mode=False, test_iteration=None):
|
|
267
281
|
testCopy = copy.deepcopy(self.cfg.get("tests", []))
|
|
268
282
|
for test in testCopy:
|
|
269
283
|
|
|
@@ -282,22 +296,22 @@ class TestItEnv:
|
|
|
282
296
|
|
|
283
297
|
# Iterate through parameters list
|
|
284
298
|
if "parameters" in test:
|
|
285
|
-
if
|
|
286
|
-
|
|
299
|
+
if sweep_mode:
|
|
300
|
+
sweep_parameters = testit_util._get_sweep_parameters(test_iteration, test['parameters'])
|
|
287
301
|
|
|
288
302
|
parameter_index = 0
|
|
289
303
|
for param in test['parameters']:
|
|
290
304
|
|
|
291
305
|
param_name = param["name"]
|
|
292
306
|
|
|
293
|
-
if not
|
|
307
|
+
if not sweep_mode:
|
|
294
308
|
|
|
295
309
|
# If the parameter's value is a list, take a random value from the range
|
|
296
310
|
if isinstance(param["value"], list):
|
|
297
311
|
param_value = random.randint(param["value"][0], param["value"][1])
|
|
298
312
|
param["value"] = param_value
|
|
299
313
|
else:
|
|
300
|
-
param["value"] =
|
|
314
|
+
param["value"] = sweep_parameters[parameter_index]
|
|
301
315
|
parameter_index += 1
|
|
302
316
|
|
|
303
317
|
param_value = param["value"]
|
|
@@ -111,9 +111,6 @@ def _serial_rx_setup(ser: serial.Serial, serial_comm_queue, endword="&"):
|
|
|
111
111
|
received = True
|
|
112
112
|
PRINT_DEB(f"Received {endword}: end of serial transmission thread")
|
|
113
113
|
return
|
|
114
|
-
elif "ERROR" in line:
|
|
115
|
-
print("FAILED VERIFICATION!")
|
|
116
|
-
exit(1)
|
|
117
114
|
except serial.SerialException as e:
|
|
118
115
|
print(f"Serial exception: {e}")
|
|
119
116
|
except Exception as e:
|
|
@@ -168,8 +165,8 @@ def __run_command(command):
|
|
|
168
165
|
|
|
169
166
|
process.wait() # Ensure process is fully done before exiting
|
|
170
167
|
|
|
171
|
-
def
|
|
172
|
-
|
|
168
|
+
def _get_sweep_parameters(iteration, parameters):
|
|
169
|
+
sweep_parameters = []
|
|
173
170
|
range_sizes = []
|
|
174
171
|
param_ranges = []
|
|
175
172
|
complete_parameters = []
|
|
@@ -190,13 +187,13 @@ def _get_swipe_parameters(iteration, parameters):
|
|
|
190
187
|
if idx > 0:
|
|
191
188
|
step_product *= range_sizes[idx - 1]
|
|
192
189
|
param_value = min_val + ((iteration // step_product) % range_sizes[idx]) * step
|
|
193
|
-
|
|
190
|
+
sweep_parameters.append(param_value)
|
|
194
191
|
|
|
195
|
-
|
|
192
|
+
sweep_index = 0
|
|
196
193
|
for param in parameters:
|
|
197
194
|
if isinstance(param['value'], list):
|
|
198
|
-
complete_parameters.append(
|
|
199
|
-
|
|
195
|
+
complete_parameters.append(sweep_parameters[sweep_index])
|
|
196
|
+
sweep_index += 1
|
|
200
197
|
else:
|
|
201
198
|
complete_parameters.append(param['value'])
|
|
202
199
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: testitpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2
|
|
4
4
|
Summary: A tool for verifying RTL and FPGA models using custom SW applications
|
|
5
5
|
Author-email: Tommaso Terzano <tommaso.terzano@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -690,9 +690,38 @@ Requires-Dist: importlib_resources
|
|
|
690
690
|
|
|
691
691
|
# testit
|
|
692
692
|
|
|
693
|
+
A python package which automates the SBST verification of any embedded RTL project.
|
|
694
|
+
|
|
695
|
+
## Installation
|
|
696
|
+
|
|
697
|
+
```bash
|
|
698
|
+
pip install testitpy
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
## Usage
|
|
702
|
+
|
|
703
|
+
```bash
|
|
704
|
+
$ testit -h
|
|
705
|
+
|
|
706
|
+
usage: testit [-h] {run,setup,report} ...
|
|
707
|
+
|
|
708
|
+
TestIt CLI tool
|
|
709
|
+
|
|
710
|
+
positional arguments:
|
|
711
|
+
{run,setup,report}
|
|
712
|
+
run Run the verification process
|
|
713
|
+
setup Set up the verification environment
|
|
714
|
+
report Generate a report based on the test results
|
|
715
|
+
|
|
716
|
+
options:
|
|
717
|
+
-h, --help show this help message and exit
|
|
718
|
+
```
|
|
719
|
+
|
|
693
720
|
[](https://github.com/vlsi-lab/TestIt/actions/workflows/release.yml)
|
|
694
721
|
|
|
695
|
-
|
|
696
|
-
|
|
722
|
+
[](https://pypistats.org/packages/testitpy) [](https://pypi.org/project/testitpy/) [](https://github.com/vlsi-lab/TestIt)
|
|
723
|
+
|
|
724
|
+
---
|
|
697
725
|
|
|
726
|
+
This is the package structure:
|
|
698
727
|
|
testitpy-0.1/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# testit
|
|
2
|
-
|
|
3
|
-
[](https://github.com/vlsi-lab/TestIt/actions/workflows/release.yml)
|
|
4
|
-
|
|
5
|
-
A python package which automates the SBST verification of any embedded RTL project.
|
|
6
|
-
This is the package structure:
|
|
7
|
-
|
|
8
|
-
|
testitpy-0.1/old_setup.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
# with open("README.md", "r", encoding = "utf-8") as fh:
|
|
4
|
-
# long_description = fh.read()
|
|
5
|
-
|
|
6
|
-
# setup(
|
|
7
|
-
# name="testit",
|
|
8
|
-
# version="0.0.1",
|
|
9
|
-
# author="Tommaso Terzano",
|
|
10
|
-
# author_email="tommaso.terzano@gmail.com",
|
|
11
|
-
# description="A tool for verifying FPGA models using custom SW applications",
|
|
12
|
-
# long_description = long_description,
|
|
13
|
-
# long_description_content_type = "text/markdown",
|
|
14
|
-
# package_dir = {"": "src"},
|
|
15
|
-
# include_package_data=True,
|
|
16
|
-
# package_data={
|
|
17
|
-
# "testit": ["templates/*"],
|
|
18
|
-
# },
|
|
19
|
-
# packages=find_packages(where="src"),
|
|
20
|
-
# install_requires=[
|
|
21
|
-
# "rich",
|
|
22
|
-
# "pexpect",
|
|
23
|
-
# "numpy",
|
|
24
|
-
# "pyserial",
|
|
25
|
-
# "hjson",
|
|
26
|
-
# "importlib_resources"
|
|
27
|
-
# ],
|
|
28
|
-
# entry_points={
|
|
29
|
-
# "console_scripts": [
|
|
30
|
-
# "testit=testit.main:main",
|
|
31
|
-
# ],
|
|
32
|
-
# },
|
|
33
|
-
# python_requires = ">=3.7"
|
|
34
|
-
# )
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
target:
|
|
3
|
-
{
|
|
4
|
-
name: "fpga_board_name" # or "simulation_tool_name", must be one of the targets defined in "testit.mk"
|
|
5
|
-
type: "fpga" # or "sim", MANDATORY
|
|
6
|
-
outputFormat: "(\\d+):(\\d+):(\\d+)" # Regular expression that defines the format of the output of the target
|
|
7
|
-
# e.g. (testId:executionTime:testOutcome)
|
|
8
|
-
# IMPORTANT: This format has to be consistent with the serial output
|
|
9
|
-
# software application.
|
|
10
|
-
outputTags: ["ID", "Cycles", "Outcome"]
|
|
11
|
-
usbPort: None # For FPGA targets
|
|
12
|
-
baudrate: 9600 # For FPGA targets
|
|
13
|
-
iterations: 100 # Set the number of iterations of the verification campaign
|
|
14
|
-
outputFile: "path/to/output/dir/file.log" # Directory to the UART log of the simulation
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
report: {
|
|
18
|
-
dir: "path/to/report/dir" # Insert the directory for the dumped report
|
|
19
|
-
includeExecutionTimeStats: true
|
|
20
|
-
includeResults: true
|
|
21
|
-
includeStatisticalAnalysis: true
|
|
22
|
-
includeFailedTestsDescription: true
|
|
23
|
-
includePerformanceAnalysis: true
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
test: [
|
|
27
|
-
{
|
|
28
|
-
name: "test1"
|
|
29
|
-
dir: "/path/to/dir1"
|
|
30
|
-
# The number of input and output datasets must be coherent with the function used to compute the golden result
|
|
31
|
-
numberInputDatasets: 1
|
|
32
|
-
numberOutputDatasets: 1
|
|
33
|
-
|
|
34
|
-
# Parameters are quite important. They can describe crucial information for the target algorithm,
|
|
35
|
-
# and for the golden function too. For example, they could indicate the number of channels in a convolution
|
|
36
|
-
# or the datatype of the output.
|
|
37
|
-
parameters: [
|
|
38
|
-
{
|
|
39
|
-
name: "paramSel" # The name of the parameter must be coherent with what the golden result function expects
|
|
40
|
-
value: "0"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
# Both input and output datasets are written in a single file, "data.c" for data and "data.h" for parameters
|
|
45
|
-
inputDataset: {
|
|
46
|
-
name: "input1"
|
|
47
|
-
dataType: "int"
|
|
48
|
-
valueRange: [-50, 50]
|
|
49
|
-
dimensions: [15] # Example of a fixed-size 1D array
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
outputDataset: {
|
|
53
|
-
name: "output1"
|
|
54
|
-
dataType
|
|
55
|
-
# The size of the output dataset is automatically computed by the golden result function
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
goldenResultFunction: {
|
|
59
|
-
name: "exampleFunction" # It must be included in the testit_golden.py that must be present in the root of the target folder
|
|
60
|
-
dataType: "int"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
{
|
|
64
|
-
name: "test2"
|
|
65
|
-
dir: "/path/to/dir2"
|
|
66
|
-
# The number of input and output datasets must be coherent with the function used to compute the golden result
|
|
67
|
-
numberInputDatasets: 3
|
|
68
|
-
numberOutputDatasets: 1
|
|
69
|
-
|
|
70
|
-
parameters: [
|
|
71
|
-
{
|
|
72
|
-
name: "paramSel" # The name of the parameter must be coherent with what the golden result function expects
|
|
73
|
-
value: "0"
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
|
|
77
|
-
inputDataset: [
|
|
78
|
-
{
|
|
79
|
-
name: "weights"
|
|
80
|
-
dataType: "uint8_t"
|
|
81
|
-
valueRange: [0, 50]
|
|
82
|
-
dimensions: [15, 15] # Example of a fixed-size 2D array
|
|
83
|
-
}
|
|
84
|
-
{
|
|
85
|
-
name: "biases"
|
|
86
|
-
dataType: "uint16_t"
|
|
87
|
-
valueRange: [0, 20]
|
|
88
|
-
dimensions: [15] # Example of a 1D array
|
|
89
|
-
}
|
|
90
|
-
{
|
|
91
|
-
name: "activations"
|
|
92
|
-
dataType: "uint32_t"
|
|
93
|
-
valueRange: [0, 100]
|
|
94
|
-
dimensions: [15, 15] # Example of a fixed-size 2D array
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
outputDataset: {
|
|
99
|
-
name: "convResult"
|
|
100
|
-
dataType: "int"
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
goldenResultFunction: [
|
|
104
|
-
{
|
|
105
|
-
name: "convolution" # One of the .py from the "lib" folder
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
{
|
|
110
|
-
name: "test3"
|
|
111
|
-
dir: "/path/to/dir3"
|
|
112
|
-
|
|
113
|
-
numberInputDatasets: 1
|
|
114
|
-
numberOutputDatasets: 1
|
|
115
|
-
|
|
116
|
-
parameters: [
|
|
117
|
-
{
|
|
118
|
-
name: "inputLength"
|
|
119
|
-
value: [1, 15] # Parameters' value can also be a range of values
|
|
120
|
-
}
|
|
121
|
-
{
|
|
122
|
-
name: "inputWidth"
|
|
123
|
-
value: [1, 5]
|
|
124
|
-
}
|
|
125
|
-
]
|
|
126
|
-
|
|
127
|
-
inputDataset: [
|
|
128
|
-
{
|
|
129
|
-
name: "inputs"
|
|
130
|
-
dataType: "int"
|
|
131
|
-
valueRange: [0, 50]
|
|
132
|
-
dimensions: ["inputLength", "inputWidth"] # Example of a dynamic-size 2D array, which depends on parameters
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
|
|
136
|
-
outputDataset: {
|
|
137
|
-
name: "result"
|
|
138
|
-
dataType: "int"
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
goldenResultFunction: [
|
|
142
|
-
{
|
|
143
|
-
name: "exampleFunction" # One of the .py from the "lib" folder
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|