GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Sleipnir/src/sleipnir.py at main · microsoft/Sleipnir

Expand file tree

/

sleipnir.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
86 lines (66 loc) · 2.74 KB
/

sleipnir.py

Copy path

File metadata and controls

86 lines (66 loc) · 2.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Used as entry point when Sleipnir is invoked."""
# ruff: noqa: F401 I001 # slp_logger needs to be imported before any other modules
import argparse
import logging
import os
import pathlib
import slp_logger as logger
import slp_dwarf_parser as dp
import slp_preprocessor as pp
import slp_utils as utils
if not os.getenv("ELF_PATH"):
msg = "ELF_PATH environment variable not set."
raise OSError(msg)
ELF_PATH_FRAME = pathlib.Path().joinpath(os.getenv("ELF_PATH"), "frame.elf")
"""Path to the ELF file that contains the DWARF information for the data types."""
# Check if Sleipnir's dependencies have been generated first
if not ELF_PATH_FRAME.exists():
msg = f"{ELF_PATH_FRAME} does not exist... please generate it first."
raise FileNotFoundError(msg)
def main(input_yml: str, output_yml: str) -> None:
"""Entry function."""
suite = pp.process_in_yaml(input_yml)
dwarfs_frame = dp.parse_dwarf_from_elf(ELF_PATH_FRAME)
# Parse enums and datatypes in ELF
dp.enm = dp.BfEnums(dwarfs_frame["enums"])
dp.types = dwarfs_frame["types"]
for test in suite["test"]:
if (not test["params"]) or (not test["params"].get("sleipnir", False)):
logging.info("'sleipnir' key not found in params for test id %s", test["id"])
continue
params = test["params"]
# ----------------------------------------------------------------------
# Generate random data
# ----------------------------------------------------------------------
utils.gen_data(test)
# ----------------------------------------------------------------------
# Generate random frames
# ----------------------------------------------------------------------
utils.gen_frames(test)
# ----------------------------------------------------------------------
# Delete the sleipnir params entry before writing it out
# ----------------------------------------------------------------------
del params["sleipnir"]
# Write the updated suite.yml back
with pathlib.Path(output_yml).open(mode="w") as output_file:
pp.yaml.dump(suite, output_file)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Invoke Sleipnir with the input yml to generate the outputs."
)
parser.add_argument(
"input_yml",
type=str,
metavar="<input yml>",
help="path to the input yml",
)
parser.add_argument(
"output_yml",
type=str,
metavar="<output yml>",
help="path to the output yml which is generated by Sleipnir",
)
args = parser.parse_args()
main(args.input_yml, args.output_yml)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.