This tool performs YAML file roundtripping using either ruamelyaml or pyyaml. It ensures the consistency of YAML parsing and serialization by verifying that the file remains the same across multiple parse-dump cycles.
- Place all task files next to the
riscv-unified-dbdirectory (i.e., not inside it). - The
test_casesfolder (attached) contains the expected output files generated from the scenarios below.
- Python version: 3.13
- OS: Ubuntu 24.04 or Windows 11
Run the main Python script run.py using one of the following commands:
python3 run.py # Uses ruamelyaml by default
python3 run.py ruamelyaml # Explicitly uses ruamelyaml
python3 run.py pyyaml # Uses pyyaml insteadYou can optionally provide:
- Output file name
- Original YAML input file path
Examples:
# Uses hardcoded original file, custom output name
python3 run.py ruamelyaml output1
# Uses custom input and output
python3 run.py ruamelyaml output2 output1.yaml# Step 1: Run on original YAML
python3 run.py ruamelyaml output1 riscv-unified-db/spec/std/isa/proc_cert_model/MockProcessor.yaml
# Step 2: Run again using the first output as input
python3 run.py ruamelyaml output2 output1.yaml
# Step 3: Validate outputs
# Files: MockProcessor.yaml, output1.yaml, output2.yaml
# ✅ All should be identicalpython3 run.py ruamelyaml output1 riscv-unified-db/spec/std/isa/inst/B/andn.yaml
python3 run.py ruamelyaml output2 output1.yamlpython3 run.py ruamelyaml output1 riscv-unified-db/spec/std/isa/inst/mock.yaml
python3 run.py ruamelyaml output2 output1.yamlpython3 run.py ruamelyaml output1
python3 run.py ruamelyaml output2 output1.yaml