socx-cli 0.1.0__tar.gz → 0.2.1__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.
Files changed (107) hide show
  1. {socx_cli-0.1.0 → socx_cli-0.2.1}/.gitignore +6 -3
  2. socx_cli-0.2.1/PKG-INFO +644 -0
  3. socx_cli-0.2.1/README.md +603 -0
  4. {socx_cli-0.1.0 → socx_cli-0.2.1}/pyproject.toml +31 -19
  5. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/__init__.py +72 -22
  6. socx_cli-0.2.1/src/socx/__main__.py +10 -0
  7. {socx_cli-0.1.0/src/socx/config → socx_cli-0.2.1/src/socx}/_config.py +60 -78
  8. socx_cli-0.1.0/src/socx/core/_uid.py → socx_cli-0.2.1/src/socx/_meta.py +19 -6
  9. socx_cli-0.2.1/src/socx/cli/__init__.py +155 -0
  10. socx_cli-0.2.1/src/socx/cli/_cli.py +108 -0
  11. socx_cli-0.2.1/src/socx/cli/_params.py +48 -0
  12. socx_cli-0.2.1/src/socx/cli/_rich.py +44 -0
  13. socx_cli-0.2.1/src/socx/cli/cli.py +28 -0
  14. socx_cli-0.1.0/src/socx/config/__init__.py → socx_cli-0.2.1/src/socx/config.py +29 -4
  15. socx_cli-0.2.1/src/socx/decorators.py +37 -0
  16. socx_cli-0.2.1/src/socx/log.py +265 -0
  17. socx_cli-0.2.1/src/socx/mixins.py +97 -0
  18. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/parser.py +0 -19
  19. socx_cli-0.2.1/src/socx/regression.py +351 -0
  20. socx_cli-0.2.1/src/socx/static/settings/plugins.toml +19 -0
  21. socx_cli-0.2.1/src/socx/static/settings/regression.toml +85 -0
  22. socx_cli-0.2.1/src/socx/static/sql/socx.sql +22 -0
  23. socx_cli-0.2.1/src/socx/test.py +479 -0
  24. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/visitor.py +25 -10
  25. socx_cli-0.2.1/src/socx_patches/post_process_sim_log.py +193 -0
  26. socx_cli-0.2.1/src/socx_plugins/config.py +115 -0
  27. {socx_cli-0.1.0/src/plugins → socx_cli-0.2.1/src/socx_plugins}/convert/lst.py +5 -2
  28. {socx_cli-0.1.0/src/plugins → socx_cli-0.2.1/src/socx_plugins}/example.py +5 -3
  29. socx_cli-0.2.1/src/socx_plugins/regression/_cli.py +73 -0
  30. socx_cli-0.2.1/src/socx_plugins/regression/_opts.py +24 -0
  31. socx_cli-0.2.1/src/socx_plugins/regression/cli.py +46 -0
  32. socx_cli-0.2.1/uv.lock +1945 -0
  33. socx_cli-0.1.0/.env +0 -14
  34. socx_cli-0.1.0/.github/workflows/python-app.yml +0 -34
  35. socx_cli-0.1.0/PKG-INFO +0 -34
  36. socx_cli-0.1.0/assets/lst/inputs/FullSectorsPixieNVM.hex +0 -3700
  37. socx_cli-0.1.0/assets/lst/inputs/GNVM.hex +0 -117
  38. socx_cli-0.1.0/assets/lst/inputs/HwsROM.json +0 -77
  39. socx_cli-0.1.0/assets/lst/inputs/PixieDramOutVerilog.hex +0 -1
  40. socx_cli-0.1.0/assets/lst/inputs/PixieNVM.hex +0 -1252
  41. socx_cli-0.1.0/assets/lst/inputs/PixieNvmOutVerilog.hex +0 -1221
  42. socx_cli-0.1.0/assets/lst/inputs/PixieOutVerilog.hex +0 -5920
  43. socx_cli-0.1.0/assets/lst/inputs/PixieParser.log +0 -1305
  44. socx_cli-0.1.0/assets/lst/inputs/PixieRomOutVerilog.hex +0 -4700
  45. socx_cli-0.1.0/assets/lst/inputs/SpuOutNVM.hex +0 -5
  46. socx_cli-0.1.0/assets/lst/inputs/SpuOutROM.hex +0 -1169
  47. socx_cli-0.1.0/assets/lst/inputs/SpuROM.json +0 -302
  48. socx_cli-0.1.0/assets/lst/inputs/SpuRomTable.hex +0 -39
  49. socx_cli-0.1.0/assets/lst/inputs/hwsNVM.hex +0 -30
  50. socx_cli-0.1.0/assets/lst/inputs/hwsNVM.txt +0 -516
  51. socx_cli-0.1.0/assets/lst/inputs/hwsROM.hex +0 -55
  52. socx_cli-0.1.0/assets/lst/inputs/hwsROM.txt +0 -971
  53. socx_cli-0.1.0/assets/lst/inputs/spuNVM.txt +0 -16
  54. socx_cli-0.1.0/assets/lst/inputs/spuROM.txt +0 -4208
  55. socx_cli-0.1.0/assets/lst/inputs/wiliot.liclipse +0 -867
  56. socx_cli-0.1.0/assets/lst/outputs/MCUList.svh +0 -412
  57. socx_cli-0.1.0/assets/lst/outputs/SPUList.backup +0 -317
  58. socx_cli-0.1.0/assets/lst/outputs/SPUList.svh +0 -317
  59. socx_cli-0.1.0/assets/lst/outputs/hwsList.svh +0 -128
  60. socx_cli-0.1.0/assets/lst/reference/pixie_hws_cgs.sv +0 -139
  61. socx_cli-0.1.0/assets/lst/reference/pixie_hws_sb_raw.svh +0 -3055
  62. socx_cli-0.1.0/assets/rgr/inputs/regression_summary.log +0 -1199
  63. socx_cli-0.1.0/assets/rgr/inputs/rerun_list.cfg +0 -17
  64. socx_cli-0.1.0/src/plugins/config.py +0 -92
  65. socx_cli-0.1.0/src/plugins/rgr.py +0 -28
  66. socx_cli-0.1.0/src/socx/__main__.py +0 -5
  67. socx_cli-0.1.0/src/socx/cli.py +0 -169
  68. socx_cli-0.1.0/src/socx/core/__init__.py +0 -2
  69. socx_cli-0.1.0/src/socx/core/mixins.py +0 -34
  70. socx_cli-0.1.0/src/socx/log.py +0 -224
  71. socx_cli-0.1.0/src/socx/regression/__init__.py +0 -14
  72. socx_cli-0.1.0/src/socx/regression/regression.py +0 -129
  73. socx_cli-0.1.0/src/socx/regression/test.py +0 -244
  74. socx_cli-0.1.0/src/socx/static/toml/convert.local.toml +0 -2
  75. socx_cli-0.1.0/src/socx/static/toml/plugins.toml +0 -5
  76. socx_cli-0.1.0/src/socx/static/toml/regression.toml +0 -47
  77. socx_cli-0.1.0/src/socx/static/toml/test.toml +0 -9
  78. socx_cli-0.1.0/src/socx-tui/app.py +0 -7
  79. socx_cli-0.1.0/src/socx-tui/regression/table.py +0 -0
  80. socx_cli-0.1.0/test_db.sqlite +0 -0
  81. socx_cli-0.1.0/uv.lock +0 -1218
  82. /socx_cli-0.1.0/README.md → /socx_cli-0.2.1/.env +0 -0
  83. {socx_cli-0.1.0 → socx_cli-0.2.1}/.python-version +0 -0
  84. {socx_cli-0.1.0 → socx_cli-0.2.1}/LICENSE +0 -0
  85. {socx_cli-0.1.0 → socx_cli-0.2.1}/assets/lst/inputs/MCUList.lst +0 -0
  86. {socx_cli-0.1.0 → socx_cli-0.2.1}/assets/lst/inputs/SPUList.list +0 -0
  87. {socx_cli-0.1.0 → socx_cli-0.2.1}/assets/lst/inputs/SPUList.lst +0 -0
  88. {socx_cli-0.1.0 → socx_cli-0.2.1}/assets/lst/inputs/hwsList.lst +0 -0
  89. {socx_cli-0.1.0 → socx_cli-0.2.1}/assets/lst/inputs/memLd.json +0 -0
  90. {socx_cli-0.1.0 → socx_cli-0.2.1}/assets/rgr/inputs/failed_tests_history.log +0 -0
  91. {socx_cli-0.1.0 → socx_cli-0.2.1}/bin/version +0 -0
  92. {socx_cli-0.1.0 → socx_cli-0.2.1}/ruff.toml +0 -0
  93. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/console.py +0 -0
  94. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/converter.py +0 -0
  95. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/formatter.py +0 -0
  96. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/memory.py +0 -0
  97. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/reader.py +0 -0
  98. {socx_cli-0.1.0/src/socx/static/toml → socx_cli-0.2.1/src/socx/static/settings}/converter.toml +0 -0
  99. {socx_cli-0.1.0/src/socx/static/toml → socx_cli-0.2.1/src/socx/static/settings}/filetypes.toml +0 -0
  100. {socx_cli-0.1.0/src/socx/static/toml → socx_cli-0.2.1/src/socx/static/settings}/settings.toml +0 -0
  101. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/tokenizer.py +0 -0
  102. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/validators.py +0 -0
  103. {socx_cli-0.1.0 → socx_cli-0.2.1}/src/socx/writer.py +0 -0
  104. {socx_cli-0.1.0/src/socx-tui → socx_cli-0.2.1/src/socx_plugins}/__init__.py +0 -0
  105. /socx_cli-0.1.0/assets/lst/inputs/hwsDRAM.hex → /socx_cli-0.2.1/src/socx_plugins/regression/__init__.py +0 -0
  106. {socx_cli-0.1.0 → socx_cli-0.2.1}/tests/test_uid.py +0 -0
  107. {socx_cli-0.1.0 → socx_cli-0.2.1}/uv.toml +0 -0
@@ -5,17 +5,20 @@
5
5
  # Unexclude relevant files/directories
6
6
 
7
7
  !*/
8
+
8
9
  !/bin/*
10
+
9
11
  !/src/*.py
10
12
  !/src/socx/**/*.py
11
- !/src/plugins/**/*.py
13
+ !/src/patches/*.py
14
+ !/src/socx_plugins/**/*.py
12
15
  !/src/socx/static/**/*
13
16
  !/src/socx/template/**/*
17
+
14
18
  !/tests/**/*.py
19
+
15
20
  !/assets/**/inputs/**/*
16
21
  !/assets/**/reference/**/*
17
- !/plugins/**/*.py
18
- !/settings/**/*.toml
19
22
 
20
23
  # Unexclude common files
21
24
 
@@ -0,0 +1,644 @@
1
+ Metadata-Version: 2.4
2
+ Name: socx-cli
3
+ Version: 0.2.1
4
+ Summary: Tool executer and plugin manager for SoC team.
5
+ Project-URL: Homepage, https://github.com/MomsPancakes/socx
6
+ Project-URL: Issues, https://github.com/MomsPancakes/socx/issues
7
+ Author-email: Sagi Kimhi <sagi.kim5@gmail.com>
8
+ Maintainer-email: Sagi Kimhi <sagi.kim5@gmail.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: click>=8.1.8
13
+ Requires-Dist: dynaconf>=3.2.7
14
+ Requires-Dist: hatchling>=1.27.0
15
+ Requires-Dist: jinja2>=3.1.5
16
+ Requires-Dist: numpy>=2.2.3
17
+ Requires-Dist: platformdirs>=4.3.6
18
+ Requires-Dist: psutil>=7.0.0
19
+ Requires-Dist: pyarrow>=19.0.0
20
+ Requires-Dist: python-dotenv[cli]>=1.0.1
21
+ Requires-Dist: rich-click>=1.8.6
22
+ Requires-Dist: textual-serve>=1.1.1
23
+ Requires-Dist: textual-web>=0.4.2
24
+ Requires-Dist: trogon>=0.6.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: debugpy>=1.8.12; extra == 'dev'
27
+ Requires-Dist: flake8-bugbear; extra == 'dev'
28
+ Requires-Dist: flake8-simplify; extra == 'dev'
29
+ Requires-Dist: mypy; extra == 'dev'
30
+ Requires-Dist: pre-commit>=4.1.0; extra == 'dev'
31
+ Requires-Dist: pycodestyle; extra == 'dev'
32
+ Requires-Dist: pydocstyle; extra == 'dev'
33
+ Requires-Dist: pytest; extra == 'dev'
34
+ Requires-Dist: pytest-cov; extra == 'dev'
35
+ Requires-Dist: pyupgrade; extra == 'dev'
36
+ Requires-Dist: ruff; extra == 'dev'
37
+ Requires-Dist: textual-dev>=1.7.0; extra == 'dev'
38
+ Requires-Dist: textual-terminal>=0.3.0; extra == 'dev'
39
+ Requires-Dist: textual[dev]>=2.0.4; extra == 'dev'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # SOCX – SoC Verification CLI Tool
43
+
44
+ **SOCX** is a command-line tool designed for RISC-V SoC verification
45
+ teams to streamline common tasks. It provides a unified CLI with modular
46
+ commands (via plugins) to manage test regressions, parse and convert
47
+ output files, and configure settings.
48
+
49
+ SOCX helps verification engineers run test suites, generate coverage
50
+ artifacts, and inspect or tweak tool configuration – all from one
51
+ convenient interface.
52
+
53
+ ## Key Features
54
+
55
+ - **Regression Automation:**
56
+
57
+ Run multiple tests in parallel and gather pass/fail results with a
58
+ single command. Easily re-run failing tests from previous regressions.
59
+
60
+ - **LST Conversion to SV:**
61
+
62
+ Convert symbol table listing files (LST) into SystemVerilog covergroup
63
+ definitions or other formats, automating coverage model generation.
64
+
65
+ - **Configuration Management:**
66
+ Inspect and modify tool settings on the fly. All configurations
67
+ (paths, parallelism, etc.) are centralized and adjustable via CLI commands.
68
+
69
+ - **Plugin Architecture:**
70
+
71
+ Extend SOCX with custom commands. Built-in plugins include regression
72
+ (`rgr`), conversion (`convert`), configuration (`config`), and an
73
+ example plugin to demonstrate how new extensions can be added.
74
+
75
+ ## Getting Started
76
+
77
+ Once SOCX is installed (via pip or in a virtual environment), you can
78
+ invoke the CLI by typing `socx` in your terminal. To see available
79
+ commands and general options, run:
80
+
81
+ ```bash
82
+ socx --help
83
+ ```
84
+
85
+ This will display a list of top-level commands (plugins) such as
86
+ **`config`**, **`convert`**, **`rgr`**, and **`example`**. You can also
87
+ get help on a specific command, for example: `socx rgr --help` or `socx
88
+ config edit --help` to see usage details and options.
89
+
90
+ Before running certain commands, ensure any required environment
91
+ variables (like `$WAREA` or `$TOP_VERIF`) are set to match your
92
+ project’s directory structure (see **Configuration** section below).
93
+
94
+ ## Commands and Usage
95
+
96
+ Below is an overview of each main command group in SOCX, with typical
97
+ usage examples and applications:
98
+
99
+ ### 1. Configuration Management (`socx config`)
100
+
101
+ The `socx config` command group allows you to view and change SOCX’s
102
+ configuration settings. This is useful for customizing file paths,
103
+ adjusting parallel run limits, or toggling features to fit your
104
+ environment.
105
+
106
+ Available subcommands under `socx config` include:
107
+
108
+ - **`socx config inspect`** – Displays the internal configuration object
109
+ with all fields (for debugging purposes).
110
+
111
+ - **`socx config list`** – Prints all current configuration values as a
112
+ dictionary. This is a quick way to see what settings are in effect
113
+ (including defaults and any overrides).
114
+
115
+ - **`socx config tree`** – Shows the configuration in a hierarchical
116
+ tree format, which is easier to read for nested settings.
117
+
118
+ - **`socx config get <name>`** – Retrieves a specific configuration
119
+ value (or group of values) by name. For example:
120
+
121
+ ```bash
122
+ socx config get regression.max_runs_in_parallel
123
+ ```
124
+
125
+ would output the current setting for the maximum number of
126
+ parallel test runs (default is 10).
127
+
128
+ - **`socx config set <name> <value>`** – Updates a configuration setting
129
+ at runtime. For example, you can do:
130
+
131
+ ```bash
132
+ socx config set regression.max_runs_in_parallel 5
133
+ ```
134
+
135
+ to temporarily limit parallel test execution to 5. (The change
136
+ applies to the running session – see note below on persistence.)
137
+
138
+ - **`socx config edit`** – Launches an interactive editor to modify
139
+ configuration files. You’ll be prompted to choose which config file to
140
+ edit (default or local override) and which editor to use (e.g., vim or
141
+ nano).
142
+
143
+ This allows you to permanently change settings (like paths or
144
+ defaults) in the TOML config files. Simply save and exit the editor to
145
+ apply changes, or exit without saving to cancel.
146
+
147
+ **Use Case:**
148
+
149
+ *Configuration management is useful when setting up SOCX for the first
150
+ time or adjusting it for a new project environment.*
151
+
152
+ For instance, if your regression logs or LST files reside in non-default
153
+ locations, you can update those paths using `socx config set` or by
154
+ editing the config. To get an overview of all configurable options,
155
+ `socx config list` or `socx config tree` provides a full dump.
156
+
157
+ **Persistence Note:**
158
+
159
+ The `get` and `list` commands are read-only. The `set` command changes
160
+ the configuration for the current session (in memory). To make changes
161
+ permanent, use `socx config edit` to update the configuration file
162
+ (which is typically a `settings.local.toml` or similar in the SOCX
163
+ config directory). Alternatively, you can set environment variables or
164
+ create a local config file as described in the project docs to override
165
+ defaults.
166
+
167
+ ### 2. LST File Conversion (`socx convert`)
168
+
169
+ The `socx convert` group contains commands to transform various file
170
+ types for verification purposes. Currently, the primary conversion
171
+ provided is for **LST files** (listings of symbols or addresses) into
172
+ SystemVerilog constructs.
173
+
174
+ Subcommand: **`socx convert lst`**
175
+
176
+ - **Description:**
177
+
178
+ Converts symbol table files (usually with extensions `.lst` or
179
+ `.list`) into SystemVerilog covergroup files. This helps generate
180
+ coverage models or constant definitions automatically from a list of
181
+ symbols/addresses.
182
+
183
+ - **Operation:**
184
+
185
+ By default, the tool will look into a source directory (configured in
186
+ settings as `convert.lst.source`) for any files matching specified
187
+ patterns (e.g., `*.lst` or `*.list`). It will read those files, parse
188
+ their content, and produce output files in the target directory
189
+ (`convert.lst.target`) according to defined name mappings. The
190
+ conversion uses a built-in parser and formatter to ensure the output
191
+ is properly structured SystemVerilog code.
192
+
193
+ - **Usage:**
194
+
195
+ Simply run:
196
+
197
+ ```bash
198
+ socx convert lst
199
+ ```
200
+
201
+ This will process all include-matching files in the source path
202
+ and write converted outputs to the target path. The conversion runs
203
+ non-interactively and prints logs to indicate which files were
204
+ processed.
205
+
206
+ For example, suppose you have a file `hwsList.lst` (containing hardware
207
+ signal indices for coverage) in the source directory. The tool might
208
+ generate an output file named `pixie_hws_cgs.svh` in the target
209
+ directory (according to a mapping rule for that specific
210
+ filename). Likewise, a file `SPUList.list` might be converted to
211
+ `SPUList.sv`, etc. The mapping between input and output names can be
212
+ configured (by default, `.lst` files become `.svh`, and `.list` files
213
+ become `.sv`, with some special cases handled as defined in the config).
214
+
215
+ **Practical Application:**
216
+
217
+ *Automating coverage and model generation.*
218
+
219
+ Instead of manually writing covergroup definitions or constant tables
220
+ for every signal, you maintain an LST file (often generated by another
221
+ script or tool). Running `socx convert lst` quickly turns those lists
222
+ into ready-to-use SystemVerilog include files. This ensures consistency
223
+ and saves time, especially when symbol tables change frequently.
224
+
225
+ **Configuration:**
226
+
227
+ The source and target directories, file inclusion patterns, and naming
228
+ conventions are all configurable via `socx config`. For instance, `socx
229
+ config get convert.lst.source` will show the current source path. By
230
+ default, these may use environment variables like `$WAREA` or
231
+ `$TOP_VERIF` to integrate with your verification environment. Ensure
232
+ those environment variables are set, or modify the paths in config, so
233
+ that SOCX knows where to find your input LST files and where to put
234
+ outputs. You can also specify include/exclude patterns for file names
235
+ and how to handle name collisions (overwrite or backup) in the
236
+ conversion settings.
237
+
238
+ ### 3. Regression Test Runner (`socx rgr`)
239
+
240
+ The `socx rgr` command group is one of the core features of SOCX,
241
+ designed to help run suites of tests (a regression) and manage the
242
+ results. It wraps around your existing test execution command (for
243
+ example, a `socrun` command or similar that actually runs a test in
244
+ simulation) and provides orchestration and result collection. This is
245
+ especially useful for nightly regressions or continuous integration,
246
+ where you want to run many tests and then focus on the failures.
247
+
248
+ Subcommands under `socx rgr` include:
249
+
250
+ - **`socx rgr run -i <file>`** – Run a regression based on a list of
251
+ test commands.
252
+
253
+ - **Input:** You provide an input file (`-i` or `--input`) which
254
+ contains one test invocation per line. Each line should be the full
255
+ command to run a test. For example, your file might contain lines
256
+ like:
257
+
258
+ ```text
259
+ socrun --flow sim --build Debug --test path/to/test1.cfg --seed 0
260
+ socrun --flow sim --build Debug --test path/to/test2.cfg --seed 0
261
+ ```
262
+
263
+ (Here `socrun` is assumed to be your test execution script or
264
+ binary. It could be any command – SOCX will execute it as given.)
265
+
266
+ - **Execution:** SOCX will launch each test in parallel (by default,
267
+ up to 10 at a time, as configured by
268
+ `regression.max_runs_in_parallel`). It uses asynchronous scheduling
269
+ to maximize throughput while respecting the limit. You will see a
270
+ progress indicator or logs showing tests being scheduled and
271
+ completed.
272
+
273
+ - **Results:** After all tests finish, SOCX produces two output files:
274
+ one listing all tests that **passed** and one listing all tests that
275
+ **failed**. By default, these files are placed in a timestamped
276
+ directory under the configured output path for regression
277
+ results. For example, you might find a folder named `28-02-2025/`
278
+ (using the current date) containing `04-05_passed.log` and
279
+ `04-05_failed.log` (if the run started at 04:05). Each of those
280
+ files contains the original command lines from your input
281
+ corresponding to tests that passed or failed, respectively. It also
282
+ logs summary information to the console.
283
+
284
+ - **Example:**
285
+ ```bash
286
+ socx rgr run -i tests_to_run.txt
287
+ ```
288
+ Suppose `tests_to_run.txt` had 100 test lines. SOCX will run them (10
289
+ at a time by default) and, upon completion, you might see
290
+ `28-02-2025/07-30_passed.log` with (let’s say) 90 lines and
291
+ `28-02-2025/07-30_failed.log` with 10 lines, if 10 tests failed. You
292
+ can then inspect those failing tests for debugging or feed them into a
293
+ rerun.
294
+
295
+ - *Tip:* You can control the parallelism or other behaviors via
296
+ config. For instance, to run tests one at a time (for easier log
297
+ viewing or resource reasons), set `regression.max_runs_in_parallel`
298
+ to 1 using the config commands.
299
+
300
+ - **`socx rgr rerun_failure_history`** (alias: **`socx rgr rrfh`**) –
301
+ Re-run previously failed tests from past regressions.
302
+
303
+ - **Description:** This command looks at the recorded history of
304
+ failed tests and triggers a rerun for them. It is essentially an
305
+ automated way to take all failing test cases from your last
306
+ regression(s) and run them again, perhaps after fixes or just to
307
+ verify flakiness.
308
+
309
+ - **How it works:** By default, SOCX expects a "failure history" log
310
+ file in a known location (configured as
311
+ `regression.logs.files.failure_history`, typically pointing to
312
+ something like a `failed_tests_history.log`). This file should
313
+ contain a list of test command lines that previously failed
314
+ (aggregated over time or at least from the most recent run). When
315
+ you run `socx rgr rerun_failure_history` without any arguments, SOCX
316
+ will use that configured file as the input and automatically execute
317
+ those tests, just like the `run` command does. You can also specify
318
+ `-i` and `-o` options to override the default input file or output
319
+ directory if needed (but usually it’s not required for this
320
+ command).
321
+
322
+ - **Results:** The rerun will generate new passed/failed logs (in the
323
+ same manner as the `run` command). By default, the output directory
324
+ for reruns is configured separately (to avoid overwriting the
325
+ original run’s logs). For example, it may save results under a
326
+ `rerun_failures/<date>/` folder. After running, you can see which
327
+ previously failing tests are now passing and which still fail, by
328
+ checking the newly created logs.
329
+
330
+ - **Usage:**
331
+
332
+ ```bash
333
+ socx rgr rerun_failure_history
334
+ ```
335
+ (This assumes your config knows where the failure history log
336
+ is. If you want to point to a specific file of failures, you could
337
+ do `-i custom_fail_list.txt`. Usually, the alias `rrfh` does the
338
+ same thing in a shorter form.)
339
+
340
+ - **Example Scenario:** You ran a large regression with `socx rgr run`
341
+ and got a set of failing tests recorded. After investigating and
342
+ fixing some issues, you want to quickly re-test all those
343
+ failures. Instead of manually preparing an input file, just run the
344
+ rerun command. SOCX will pick up the last failure list and rerun
345
+ them. This is very handy for iterative debug and fix cycles.
346
+
347
+ Both `run` and `rerun_failure_history` accept an optional **`-o
348
+ <directory>`** argument to specify a custom output directory for the
349
+ results. If you don’t specify `-o`, SOCX uses its default path (which
350
+ includes organizing by date/time as described). You can configure that
351
+ default path via `socx config` if you prefer all results to go to a
352
+ certain folder.
353
+
354
+ - **Additional Notes for `rgr`:** The regression mechanism in SOCX will
355
+ capture each test’s output and return code. It considers a test “passed”
356
+ if the process exits with code 0 and **no internal errors** are
357
+ detected, and “failed” if a non-zero code or errors are present. SOCX
358
+ even parses simulator log files (through a post-processing utility) to
359
+ double-check test outcomes, ensuring that a pass truly means all checks
360
+ passed (not just that the process exited cleanly). The tool will handle
361
+ termination signals and exceptions – if you abort (`Ctrl+C`) in the
362
+ middle of a run, it will try to terminate any running test processes.
363
+
364
+ ### 4. Example Plugin (`socx example`)
365
+
366
+ The `socx example` command is a simple demonstration of SOCX’s plugin
367
+ system. It doesn’t perform verification tasks, but it’s included to show
368
+ how easy it is to extend the CLI with new commands.
369
+
370
+ - **Usage:** `socx example`
371
+
372
+ - **What it does:** When you run this, it will clear the console and
373
+ print a friendly greeting message (with some fun ASCII/emoji art via
374
+ rich text). It will then prompt you (Yes/No) asking if you want to see
375
+ the source code of the example plugin itself. If you answer yes, it
376
+ will display the Python code for the plugin on the screen with syntax
377
+ highlighting. If no, it just exits after the greeting.
378
+
379
+ - **Why it’s there:** If you are a developer or an advanced user
380
+ interested in adding your own plugin, the example serves as a
381
+ template. It shows the basic structure: a function decorated with
382
+ `@click.command` (or `@click.group`) and the use of rich text
383
+ formatting and confirmation prompts. Essentially, you can copy this
384
+ pattern to create new subcommands for SOCX.
385
+
386
+ Feel free to run `socx example` to ensure your installation is working
387
+ and to see SOCX’s rich output formatting in action.
388
+
389
+ ## Configuration and Environment Details
390
+
391
+ SOCX’s behavior is highly configurable to fit into different project
392
+ environments. The configuration is managed via Dynaconf and is loaded
393
+ from TOML files (with defaults provided in the package and optional
394
+ local overrides).
395
+
396
+ Some important configuration aspects to be aware of:
397
+
398
+ - **Default Config Files:** The tool comes with default config in
399
+ `settings.toml` (and included files like `plugins.toml`,
400
+ `converter.toml`, `regression.toml`, etc.). These define default
401
+ paths, file patterns, and plugin mappings. You typically do not need
402
+ to edit the defaults; instead, create a local config if overrides are
403
+ needed.
404
+
405
+ - **Local Configuration:** You can have a `settings.local.toml` (which
406
+ is read by Dynaconf if present) to override defaults. The `socx config
407
+ edit` command can help create/edit this file. Values in the local
408
+ config will take priority over the defaults. This is the recommended
409
+ way to customize SOCX for your environment (for example, setting the
410
+ regression `path` to your own regression results directory, or
411
+ changing `max_runs_in_parallel`).
412
+
413
+ - **Environment Variables:** The config supports environment variable
414
+ interpolation. In the default config, you’ll notice placeholders like
415
+ `{env[WAREA]}` or `{env[TOP_VERIF]}`. These mean SOCX will substitute
416
+ the value of the environment variable `WAREA` or `TOP_VERIF` if it’s
417
+ set in your shell. For example, `convert.lst.source` might be defined
418
+ as:
419
+
420
+ ```toml
421
+ source = "{env[WAREA]}/Pixie_ROM_FW/..."
422
+ ```
423
+
424
+ This allows the tool to
425
+ dynamically use paths based on your environment. **Before running
426
+ SOCX, ensure those environment vars are exported** or adjust the
427
+ config to not require them. If an environment variable is not set, the
428
+ path may resolve to an empty string or incorrect location, so it’s
429
+ important to configure these correctly. You can always check what path
430
+ is being used by running `socx config get convert.lst.source` (or the
431
+ relevant key) to see the resolved result.
432
+
433
+ - **Plugin Configuration:** The `plugins.toml` file in config lists all
434
+ plugin scripts that SOCX will load. By default it includes `rgr`,
435
+ `config`, `example`, and `convert` (LST). If you ever develop a new
436
+ plugin module, you’d register it in this file (or via `socx config`
437
+ commands) so that the main CLI picks it up. The tool’s design is such
438
+ that it will automatically discover these and make them available as
439
+ `socx <plugin-name>` commands.
440
+
441
+ - **Logging and Verbosity:** SOCX uses a rich logging system under the
442
+ hood. While it generally prints user-friendly output, you can increase
443
+ verbosity (for debugging) by a global option if provided (e.g., `-v`
444
+ for debug logs, if supported). Check `socx --help` to see if a
445
+ `--verbosity` or similar option exists globally. This can help
446
+ troubleshoot issues by printing internal debug messages. By
447
+ default, only important info is shown.
448
+
449
+ ## Examples and Typical Workflows
450
+
451
+ To tie everything together, here are a couple of realistic scenarios
452
+ using SOCX:
453
+
454
+ - **Running a Nightly Regression:**
455
+
456
+ 1. Ensure your test list is up-to-date (say you generate
457
+ `nightly_tests.txt` with all tests to run).
458
+
459
+ 2. Execute `socx rgr run -i nightly_tests.txt`. Go grab a coffee while
460
+ tests execute in parallel. You’ll see progress in the terminal.
461
+
462
+ 3. After completion, open the `<date>/<time>_failed.log` to see which
463
+ tests failed. Suppose 5 tests failed.
464
+
465
+ 4. Use those results for debugging. Perhaps also add those 5 lines to
466
+ a cumulative failure history file if you maintain one (the tool can be
467
+ configured to do this automatically or you can copy them).
468
+
469
+ 5. The next day (or after fixes), run `socx rgr rerun_failure_history`
470
+ to re-run all historically failing tests and confirm if they pass
471
+ now. This uses the recorded failure list so you don’t miss any
472
+ regressions in previously failing cases.
473
+
474
+ - **Generating Coverage Definitions from Spec:**
475
+
476
+ 1. After design changes, you get updated *.lst files (e.g., a list of
477
+ opcodes or events to cover). Place these files in the directory that
478
+ SOCX is configured to read (or update the config to point to them).
479
+
480
+ 2. Run `socx convert lst`. The tool will parse each list and create
481
+ corresponding SystemVerilog include files with coverage group
482
+ definitions or constants.
483
+
484
+ 3. Include these generated `.svh`/`.sv` files in your simulation
485
+ environment. They contain up-to-date definitions reflecting the latest
486
+ design info, without manual editing.
487
+
488
+ 4. If something isn’t right (e.g., a path was wrong or a file was
489
+ skipped), use `socx config list` or `tree` to review the convert
490
+ settings (you might find an exclude pattern that filtered out your
491
+ file, etc.), adjust accordingly, and run again.
492
+
493
+ - **Inspecting/Changing Configuration:**
494
+
495
+ 1. You want to change the default number of parallel runs from 10 to 4
496
+ for a specific debug session (maybe to avoid heavy load). You run:
497
+ ```bash
498
+ socx config set regression.max_runs_in_parallel 4
499
+ socx rgr run -i failing_tests.txt
500
+ ``` Now SOCX will run with at most 4 tests at once.
501
+
502
+ 2. Later, you decide to make this change permanent in your config.
503
+
504
+ Run `socx config edit`, pick the appropriate config file (likely
505
+ `settings.local.toml`), and add:
506
+
507
+ ```toml
508
+ [regression] max_runs_in_parallel = 4
509
+ ```
510
+
511
+ Save and exit.
512
+
513
+ Next time you run a regression, it will default to 4 in parallel.
514
+
515
+
516
+ 3. Unsure of what config keys exist? Run `socx config tree` to see the
517
+ structure.
518
+
519
+ You might discover other useful knobs (for example,
520
+ `regression.path` for log storage, or `convert.lst.includes` for
521
+ file patterns).
522
+
523
+ ## Troubleshooting and Tips
524
+
525
+ - **“Command not found” or No Output:**
526
+
527
+ If running `socx` does nothing or the command is not found, make sure
528
+ the installation succeeded and the Python environment is
529
+ activated.
530
+
531
+ The `socx` entry point is installed via the package’s setup; if
532
+ needed, you can also run it as a module with `python -m socx ...`.
533
+
534
+ - **Environment Variables Not Recognized:**
535
+
536
+ If a convert or regression command is not finding files or writing
537
+ where expected, check if environment variables like `WAREA` or
538
+ `TOP_VERIF` are set in your shell. If not, either set them or update
539
+ the SOCX config to use explicit paths. You can always override the
540
+ configured paths by editing the config or by providing command options
541
+ (for example, if a future version of `socx convert lst` supports
542
+ `-s/--source` and `-t/--target` options, those could override the
543
+ defaults at runtime).
544
+
545
+ - **Test Execution Fails Immediately:**
546
+
547
+ The `rgr run` command relies on an external test runner (e.g.,
548
+ `socrun`). If SOCX cannot spawn the test process (for instance, if
549
+ `socrun` is not in your PATH or is misnamed), the tests will
550
+ fail. Ensure your input file lines are correct and that you can run
551
+ those commands manually. SOCX will capture the stdout/stderr of each
552
+ test; you can check the failure log or console output for any error
553
+ messages from the test process.
554
+
555
+ - **Partial Runs or Interruption:**
556
+
557
+ If you interrupt a regression run (Ctrl+C), SOCX will try to kill
558
+ running tests. However, in some cases you might end up with some
559
+ processes still running (depending on how graceful the system
560
+ was). Use `ps` or your system’s process monitor to ensure all test
561
+ instances stopped if you had to force-quit. On the next run, you may
562
+ want to use the rerun feature to resume where you left off (adding any
563
+ not-run tests to the input file).
564
+
565
+ - **Viewing Detailed Logs:**
566
+
567
+ SOCX uses the **Rich** library to format output. If you prefer plain
568
+ text logs or need to redirect output to a file, you can do so (the
569
+ colors may come through as ANSI codes in a raw file; in that case,
570
+ consider piping through `sed` or using the `--no-color` option if
571
+ available). For internal debugging, increasing verbosity via config or
572
+ environment (e.g., setting an env var like `SOCX_LOG_LEVEL=DEBUG` if
573
+ supported) will show more info. The tool’s debug logs can reveal how
574
+ plugins are loaded or why a particular file was skipped.
575
+
576
+ ## Extending SOCX with Plugins (Advanced)
577
+
578
+ SOCX is built with a plugin architecture, meaning you can add new
579
+ commands without modifying the core code. Each plugin is essentially a
580
+ Python module that defines a Click command or group (with subcommands),
581
+ and is registered in the configuration so that SOCX loads it at runtime.
582
+
583
+ If your verification workflow has additional needs – for example,
584
+ parsing a custom log, generating reports, or interfacing with other
585
+ tools – you can create your own plugin. Here’s a high-level guide:
586
+
587
+ - **Create a Plugin Module:**
588
+
589
+ Write a Python file (e.g., `myplugin.py`) following the pattern of
590
+ existing ones. Use `@click.command` or `@click.group` to define CLI
591
+ entry points, and implement the logic you need. You can use `rich` for
592
+ pretty output, and you have access to all SOCX utilities and config by
593
+ importing from the `socx` package (for example, `from socx import
594
+ console, settings` to use the global console and config).
595
+
596
+ - **Return a Command named `cli`:**
597
+
598
+ In your plugin module, ensure you define a function (or group) named
599
+ `cli` – this is what SOCX looks for when loading the plugin. For a
600
+ single command plugin, do something like:
601
+
602
+ ```python
603
+ import rich_click as click
604
+
605
+ @click.command("myplugin")
606
+ @click.option("--foo", help="Example option")
607
+ def cli(foo):
608
+ """One-line description of my plugin."""
609
+ # ... your code ...
610
+ click.echo("My plugin is running with foo=%s" % foo)
611
+ ```
612
+
613
+ This will create a new command `socx myplugin`. If you need
614
+ subcommands, use `@click.group("myplugin")` and then define functions
615
+ with `@cli.command()` as seen in the regression or config plugins.
616
+
617
+ - **Register the Plugin:**
618
+
619
+ Open the `plugins.toml` configuration (via `socx config edit` or
620
+ editing the file under `socx/static/toml/plugins.toml` in the
621
+ source). Add an entry for your
622
+ plugin, for example:
623
+
624
+ ```toml
625
+ [plugins]
626
+ myplugin = "@path @format /full/path/to/myplugin.py"
627
+ ```
628
+
629
+ (You can also use a relative path if it’s within the project
630
+ directory.) Save the config. The `@path @format` syntax is used in
631
+ config to indicate a file path – just follow the pattern of existing
632
+ entries.
633
+
634
+ - **Run SOCX:**
635
+
636
+ The next time you run `socx`, it will load your plugin and make the
637
+ `myplugin` command available. You can verify by running `socx --help`
638
+ and seeing your new command listed.
639
+
640
+ By structuring the tool this way, the verification team can grow the CLI
641
+ as the project evolves – adding new capabilities without touching the
642
+ core. The example plugin (`socx example`) can be consulted as a
643
+ reference for how to do things like clearing the screen, prompting the
644
+ user, or even printing its own source code.