Skip to content

Commit

Permalink
Allow to add an mandatory option to the generated MC tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Aug 28, 2024
1 parent 8d0b66f commit 0c55c35
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
22 changes: 16 additions & 6 deletions suite/auto-sync/src/autosync/MCUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import argparse
import logging as log
import json
import re
import sys
import subprocess as sp
Expand All @@ -13,10 +14,6 @@
from autosync.Targets import TARGETS_LLVM_NAMING
from autosync.Helper import convert_loglevel, get_path

# mattr flags which have to be added to all llvm-mc commands
# before executing them.
ARCH_MATTR = {"AArch64": "+all"}


class LLVM_MC_Command:
def __init__(self, cmd_line: str, mattr: str):
Expand Down Expand Up @@ -245,7 +242,20 @@ def __init__(
self.included = included if included else list()
self.test_files: list[TestFile] = list()
self.unified_test_cases = unified_test_cases
self.mattr: str = ARCH_MATTR[self.arch] if self.arch in ARCH_MATTR else ""
with open(get_path("{MCUPDATER_CONFIG_FILE}")) as f:
self.conf = json.loads(f.read())
# Additional mattr passed to llvm-mc
self.mattr: str = (
",".join(self.conf["additional_mattr"][self.arch])
if self.arch in self.conf["additional_mattr"]
else ""
)
# A list of options which are always added.
self.mandatory_options: str = (
self.conf["mandatory_options"][self.arch]
if self.arch in self.conf["mandatory_options"]
else list()
)
self.multi_mode = multi_mode

def check_prerequisites(self, paths):
Expand Down Expand Up @@ -325,7 +335,7 @@ def build_test_files(self, mc_cmds: list[LLVM_MC_Command]) -> list[TestFile]:
TestFile(
self.arch,
mcc.file,
mcc.get_opts_list(),
mcc.get_opts_list() + self.mandatory_options,
mcc,
self.unified_test_cases,
)
Expand Down
10 changes: 10 additions & 0 deletions suite/auto-sync/src/autosync/mcupdater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"additional_mattr":
{
"AArch64": [ "+all" ]
},
"mandatory_options":
{
"SystemZ": [ "CS_MODE_BIG_ENDIAN" ]
}
}
1 change: 1 addition & 0 deletions suite/auto-sync/src/autosync/path_vars.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"{DIFFER_TEST_NEW_SRC_DIR}": "{DIFFER_TEST_DIR}/new_src/",
"{DIFFER_TEST_PERSISTENCE_FILE}": "{DIFFER_TEST_DIR}/test_saved_patches.json",
"{AUTO_SYNC_TEST_DIR}": "{AUTO_SYNC_SRC}/Tests/",
"{MCUPDATER_CONFIG_FILE}": "{AUTO_SYNC_SRC}/mcupdater.json",
"{MCUPDATER_TEST_DIR}": "{AUTO_SYNC_TEST_DIR}/MCUpdaterTests/",
"{MCUPDATER_TEST_DIR_EXPECTED}": "{AUTO_SYNC_TEST_DIR}/MCUpdaterTests/expected",
"{MCUPDATER_OUT_DIR}": "{BUILD_DIR}/mc_out/",
Expand Down

0 comments on commit 0c55c35

Please sign in to comment.