Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions SystemReady-band/build-scripts/build-buildroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ do_build ()
cp -r $TOP_DIR/edk2-test-parser root_fs_overlay/usr/bin/
fi
cp -r $TOP_DIR/../common/log_parser root_fs_overlay/usr/bin
mkdir -p root_fs_overlay/usr/bin/log_parser/tools
cp $TOP_DIR/../common/tools/acs-results-schema.json \
$TOP_DIR/../common/tools/suite_registry.json \
$TOP_DIR/../common/tools/suite_registry.py \
$TOP_DIR/../common/tools/validate.py \
root_fs_overlay/usr/bin/log_parser/tools/
cp -r $TOP_DIR/systemready-scripts root_fs_overlay/usr/bin
cp $TOP_DIR/ramdisk/linux-bsa/bsa root_fs_overlay/bin/
cp $TOP_DIR/ramdisk/linux-bsa/bsa_acs.ko root_fs_overlay/lib/modules/
Expand Down
6 changes: 0 additions & 6 deletions SystemReady-devicetree-band/Yocto/build-scripts/get_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@ copy_recipes()
cp $TOP_DIR/../../common/linux_scripts/read_write_check_blk_devices.py $TOP_DIR/meta-woden/recipes-acs/install-files/files

cp -r $TOP_DIR/../../common/log_parser $TOP_DIR/meta-woden/recipes-acs/install-files/files/
mkdir -p $TOP_DIR/meta-woden/recipes-acs/install-files/files/log_parser/tools
cp $TOP_DIR/../../common/tools/acs-results-schema.json \
$TOP_DIR/../../common/tools/suite_registry.json \
$TOP_DIR/../../common/tools/suite_registry.py \
$TOP_DIR/../../common/tools/validate.py \
$TOP_DIR/meta-woden/recipes-acs/install-files/files/log_parser/tools/
popd
# copy any patches to linux src files directory
cp $COMMON_DIR_PATH/patches/tpm-tis-spi-Add-hardware-wait-polling.patch $TOP_DIR/meta-woden/recipes-kernel/linux/files
Expand Down
10 changes: 1 addition & 9 deletions common/log_parser/enrich_suite_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent
TOOLS_CANDIDATES = (
BASE_DIR.parent / "tools",
BASE_DIR / "tools",
)
TOOLS_DIR = next(
(path for path in TOOLS_CANDIDATES if (path / "suite_registry.py").is_file()),
TOOLS_CANDIDATES[0],
)
sys.path.insert(0, str(TOOLS_DIR))
sys.path.insert(0, str(BASE_DIR))

from suite_registry import REGISTRY_PATH, load_registry

Expand Down
11 changes: 3 additions & 8 deletions common/log_parser/main_log_parser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ BASE_DIR=$(dirname "$(realpath "$0")")

# Determine paths
SCRIPTS_PATH="$BASE_DIR"
if [ -f "$BASE_DIR/../tools/suite_registry.json" ]; then
TOOLS_PATH=$(realpath "$BASE_DIR/../tools")
else
TOOLS_PATH="$BASE_DIR/tools"
fi

# Update this parser release version when publishing a new log parser release.
LOG_PARSER_VERSION="1.0.0"
Expand Down Expand Up @@ -70,9 +65,9 @@ WAIVER_JSON=$4
POST_SCRIPT_LOG="$LOGS_PATH/post-script/post-script.log"

if [ $YOCTO_FLAG_PRESENT -eq 1 ]; then
test_category="/usr/bin/log_parser/test_categoryDT.json"
test_category="$BASE_DIR/test_categoryDT.json"
else
test_category="/usr/bin/log_parser/test_category.json"
test_category="$BASE_DIR/test_category.json"
fi

# Check if ACS_CONFIG_PATH is provided
Expand Down Expand Up @@ -865,7 +860,7 @@ fi

if [ ${#JSON_FILES[@]} -gt 0 ]; then
python3 "$SCRIPTS_PATH/enrich_suite_json.py" \
--registry "$TOOLS_PATH/suite_registry.json" \
--registry "$SCRIPTS_PATH/suite_registry.json" \
--test-category "$test_category" \
"${JSON_FILES[@]}"
python3 "$SCRIPTS_PATH/merge_jsons.py" "$MERGED_JSON" "${JSON_FILES[@]}"
Expand Down
16 changes: 4 additions & 12 deletions common/log_parser/merge_jsons.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent
TOOLS_CANDIDATES = (
BASE_DIR.parent / "tools",
BASE_DIR / "tools",
)
TOOLS_DIR = next(
(path for path in TOOLS_CANDIDATES if (path / "suite_registry.py").is_file()),
TOOLS_CANDIDATES[0],
)
sys.path.insert(0, str(TOOLS_DIR))
sys.path.insert(0, str(BASE_DIR))

from suite_registry import (
normalize_suite_name as registry_normalize_suite_name,
Expand Down Expand Up @@ -246,9 +238,9 @@ def load_test_category_data(mode, test_category_path=None):
"""
if not test_category_path:
if mode == "DT":
test_category_path = "/usr/bin/log_parser/test_categoryDT.json"
test_category_path = BASE_DIR / "test_categoryDT.json"
else:
test_category_path = "/usr/bin/log_parser/test_category.json"
test_category_path = BASE_DIR / "test_category.json"

try:
with open(test_category_path, "r") as catf:
Expand Down Expand Up @@ -858,7 +850,7 @@ def main():
parser.add_argument("--selected-suites", default="",
help="Comma-separated suite names to include in compliance reporting")
parser.add_argument("--test-category", default="",
help="Explicit test category JSON path; legacy installed paths remain the default")
help="Explicit test category JSON path; defaults to the bundled mode-specific file")
parser.add_argument("output_file", help="Output merged JSON file")
parser.add_argument("json_files", nargs='+',
help="List of JSON files to merge (including acs_info.json if present)")
Expand Down
29 changes: 8 additions & 21 deletions common/log_parser/package_standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,18 @@ SCRIPT_DIR=$(dirname "$(realpath "$0")")
REPO_ROOT=$(realpath "$SCRIPT_DIR/../..")
OUTPUT_PATH=${1:-"$PWD/systemready-log-parser-standalone.tar.gz"}

required_paths=(
"common/log_parser/main_log_parser.sh"
"common/log_parser/standalone_runner.py"
"common/log_parser/requirements.txt"
"common/log_parser/test_category.json"
"common/log_parser/test_categoryDT.json"
"common/tools/acs-results-schema.json"
"common/tools/suite_registry.json"
"common/tools/suite_registry.py"
"common/tools/validate.py"
# Package the complete parser directory so every suite parser and support file
# is included automatically. The remaining paths are partner documentation.
package_paths=(
"common/log_parser"
"docs/acs_schema_guide.md"
"docs/log_parser_guide.md"
"LICENSE.md"
)

for relative_path in "${required_paths[@]}"; do
if [ ! -f "$REPO_ROOT/$relative_path" ]; then
echo "ERROR: Required package file is missing: $REPO_ROOT/$relative_path" >&2
for relative_path in "${package_paths[@]}"; do
if [ ! -e "$REPO_ROOT/$relative_path" ]; then
echo "ERROR: Required package path is missing: $REPO_ROOT/$relative_path" >&2
exit 1
fi
done
Expand All @@ -63,14 +57,7 @@ tar \
--transform='s,^,systemready-log-parser/,' \
-czf "$TEMP_ARCHIVE" \
-C "$REPO_ROOT" \
common/log_parser \
common/tools/acs-results-schema.json \
common/tools/suite_registry.json \
common/tools/suite_registry.py \
common/tools/validate.py \
docs/acs_schema_guide.md \
docs/log_parser_guide.md \
LICENSE.md
"${package_paths[@]}"

mv "$TEMP_ARCHIVE" "$OUTPUT_PATH"
output_dir=$(dirname "$OUTPUT_PATH")
Expand Down
17 changes: 5 additions & 12 deletions common/log_parser/standalone_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent
TOOLS_CANDIDATES = (
BASE_DIR.parent / "tools",
BASE_DIR / "tools",
)
TOOLS_DIR = next(
(path for path in TOOLS_CANDIDATES if (path / "suite_registry.py").is_file()),
TOOLS_CANDIDATES[0],
)
sys.path.insert(0, str(TOOLS_DIR))
sys.path.insert(0, str(BASE_DIR))

from suite_registry import (
expand_selected_suites,
Expand All @@ -49,8 +41,8 @@
)


DEFAULT_REGISTRY = TOOLS_DIR / "suite_registry.json"
SCHEMA_VALIDATOR = TOOLS_DIR / "validate.py"
DEFAULT_REGISTRY = BASE_DIR / "suite_registry.json"
SCHEMA_VALIDATOR = BASE_DIR / "validate.py"
DEFAULT_MODE = "SR"
MINIMUM_PYTHON = (3, 8)
MINIMUM_OUTPUT_FREE_BYTES = 10 * 1024 * 1024
Expand Down Expand Up @@ -1325,7 +1317,8 @@ def main():
json_dir = stage / "acs_jsons"
html_dir = stage / "html_detailed_summaries"
json_dir.mkdir(parents=True)
html_dir.mkdir(parents=True)
if "html" in outputs:
html_dir.mkdir(parents=True)
copy_run_configs(stage, args)

results = []
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions common/tools/validate.py → common/log_parser/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
sys.exit(2)

SCRIPT_DIR = Path(__file__).resolve().parent
sys.path.insert(0, str(SCRIPT_DIR))

from suite_registry import expand_selected_suites, load_registry

Expand Down
39 changes: 20 additions & 19 deletions docs/acs_schema_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ suite JSON files with the single SystemReady schema validator.

## Files and Prerequisites

The schema tools are kept together:
The schema tools are kept beside the parser so a copied `common/log_parser`
directory remains self-contained:

| File | Purpose |
|---|---|
| `common/tools/validate.py` | Validates merged or raw JSON and formats errors |
| `common/tools/acs-results-schema.json` | Draft 2020-12 merged and suite contracts |
| `common/tools/suite_registry.json` | Maps raw filenames and suites to schema definitions |
| `common/tools/suite_registry.py` | Shared registry lookup helpers |
| `common/log_parser/validate.py` | Validates merged or raw JSON and formats errors |
| `common/log_parser/acs-results-schema.json` | Draft 2020-12 merged and suite contracts |
| `common/log_parser/suite_registry.json` | Maps raw filenames and suites to schema definitions |
| `common/log_parser/suite_registry.py` | Shared registry lookup helpers |

Run commands in this guide from the repository root. Python 3 and the
`jsonschema` package are required:

```bash
python3 -m pip install -r common/log_parser/requirements.txt
common/tools/validate.py --help
common/log_parser/validate.py --help
```

Paths containing spaces must be quoted.
Expand Down Expand Up @@ -60,11 +61,11 @@ contract.
### Standard Command

```bash
common/tools/validate.py merged \
common/log_parser/validate.py merged \
"/path/to/acs_results/acs_summary/acs_jsons/merged_results.json"
```

The default schema is `common/tools/acs-results-schema.json`.
The default schema is `common/log_parser/acs-results-schema.json`.

Merged FWTS/SCT wrapper names are band-specific. SystemReady DT uses
`Suite_Name: EBBR-FWTS` and `Suite_Name: EBBR-SCT`; SystemReady SR uses
Expand All @@ -74,7 +75,7 @@ Merged FWTS/SCT wrapper names are band-specific. SystemReady DT uses
### Use a Different Schema

```bash
common/tools/validate.py merged \
common/log_parser/validate.py merged \
"/path/to/merged_results.json" \
--schema "/path/to/candidate-schema.json"
```
Expand All @@ -85,26 +86,26 @@ The complete error count is always retained. This option changes only how many
example locations are printed for each grouped issue:

```bash
common/tools/validate.py merged \
common/log_parser/validate.py merged \
"/path/to/merged_results.json" \
--max-paths 2
```

## Validate Raw Suite JSON

Raw validation uses `common/tools/suite_registry.json` to choose the schema
Raw validation uses `common/log_parser/suite_registry.json` to choose the schema
definition from each file's basename.

### One Suite

```bash
common/tools/validate.py raw "/path/to/acs_jsons/bsa.json"
common/log_parser/validate.py raw "/path/to/acs_jsons/bsa.json"
```

### Multiple Suites

```bash
common/tools/validate.py raw \
common/log_parser/validate.py raw \
"/path/to/acs_jsons/bsa.json" \
"/path/to/acs_jsons/fwts.json" \
"/path/to/acs_jsons/sct.json"
Expand All @@ -113,7 +114,7 @@ common/tools/validate.py raw \
### Discover Selected Suites in a Directory

```bash
common/tools/validate.py raw \
common/log_parser/validate.py raw \
--json-dir "/path/to/acs_jsons" \
--selected-suites BSA,FWTS,SCT
```
Expand All @@ -125,13 +126,13 @@ error.
List the accepted canonical names with:

```bash
common/tools/suite_registry.py list
common/log_parser/suite_registry.py list
```

### Validate Every JSON in a Directory

```bash
common/tools/validate.py raw "/path/to/acs_jsons/"*.json
common/log_parser/validate.py raw "/path/to/acs_jsons/"*.json
```

Only filenames registered as raw suite outputs are validated. Files such as
Expand Down Expand Up @@ -270,14 +271,14 @@ Use the exit code in automation; do not search terminal text for `PASS`.
When adding or renaming a suite output:

1. Define or update the suite contract in
`common/tools/acs-results-schema.json`.
`common/log_parser/acs-results-schema.json`.
2. Update the suite entry, output filename, and schema fragment in
`common/tools/suite_registry.json`.
`common/log_parser/suite_registry.json`.
3. Keep parser script paths in the registry relative to
`common/log_parser`.
4. Test the raw file with `validate.py raw`.
5. Test a complete merged artifact with `validate.py merged`.
6. Test the standalone package and the installed `log_parser/tools` layout.
6. Test the standalone package and the installed `log_parser` layout.

Do not add a second validator for a new suite. Extend the schema and registry so
the single validator handles it.
Loading
Loading