Skip to content

Commit

Permalink
Fix: Skip tests which test for symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Aug 28, 2024
1 parent 0c55c35 commit 263f8bd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions suite/auto-sync/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ src/autosync/Tests/MCUpdaterTests/Disassembler/ARCH/Output
src/autosync/lit_config/test_dir_*
src/autosync/lit_config/.lit_test_times.txt
src/autosync/Tests/MCUpdaterTests/test_output
src/autosync/Tests/MCUpdaterTests/ARCH/Output
7 changes: 6 additions & 1 deletion suite/auto-sync/src/autosync/MCUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def init_tests(self, unified_test_cases: bool):
log.debug(f"llvm-mc result: {mc_output}")
text_section = 0 # Counts the .text sections
asm_pat = f"(?P<asm_text>.+)"
enc_pat = r"(\[?(?P<enc_bytes>((0x[a-fA-F0-9]{1,2}[, ]{0,2}))+)[^, ]?\]?)"
enc_pat = r"(\[?(?P<full_enc_string>(?P<enc_bytes>((0x[a-fA-F0-9]{1,2}[, ]{0,2}))+)[^, ]?)\]?)"
for line in mc_output.stdout.splitlines():
line = line.decode("utf8")
if ".text" in line:
Expand All @@ -153,6 +153,11 @@ def init_tests(self, unified_test_cases: bool):
)
if not match:
continue
full_enc_string = match.group("full_enc_string")
if re.search(r",\s?A$", full_enc_string):
# The encoding string contains symbol information of the form:
# [0xc0,0xe0,A ,A,A,A]. We ignore these for now.
continue
enc_bytes = match.group("enc_bytes").strip()
asm_text = match.group("asm_text").strip()
asm_text = re.sub(r"\t+", " ", asm_text)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# RUN: llvm-mc -triple s390x-unknown-unknown -mcpu=z13 --show-encoding %s | FileCheck %s

# RUN: llvm-mc -triple s390x-unknown-unknown -mcpu=z13 -filetype=obj %s | \
# RUN: llvm-readobj -r - | FileCheck %s -check-prefix=CHECK-REL

# RUN: llvm-mc -triple s390x-unknown-unknown -mcpu=z13 -filetype=obj %s | \
# RUN: llvm-objdump -d - | FileCheck %s -check-prefix=CHECK-DIS

# CHECK: larl %r14, target # encoding: [0xc0,0xe0,A,A,A,A]
# CHECK-NEXT: # fixup A - offset: 2, value: target+2, kind: FK_390_PC32DBL
# CHECK-REL: 0x{{[0-9A-F]*2}} R_390_PC32DBL target 0x2
.align 16
larl %r14, target

# CHECK: larl %r14, target@GOT # encoding: [0xc0,0xe0,A,A,A,A]
# CHECK-NEXT: # fixup A - offset: 2, value: target@GOT+2, kind: FK_390_PC32DBL
# CHECK-REL: 0x{{[0-9A-F]*2}} R_390_GOTENT target 0x2
.align 16
larl %r14, target@got
25 changes: 25 additions & 0 deletions suite/auto-sync/src/autosync/Tests/test_mcupdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,31 @@ def multi_mode_separated_test_cases(self):
],
)

def test_no_symbol_tests(self):
with self.mutex:
out_dir = Path(get_path("{MCUPDATER_TEST_OUT_DIR}").joinpath("no_symbol"))
if not out_dir.exists():
out_dir.mkdir(parents=True)
for file in out_dir.iterdir():
logging.debug(f"Delete old file: {file}")
os.remove(file)
test_only_overwrite_path_var(
"{MCUPDATER_OUT_DIR}",
out_dir,
)
self.updater = MCUpdater(
"ARCH",
get_path("{MCUPDATER_TEST_DIR}"),
[],
[],
False,
)
self.updater.gen_all()
self.assertFalse(
out_dir.joinpath("test_no_symbol.s.txt.yaml").exists(),
"File should not exist",
)

def compare_files(self, out_dir: Path, filenames: list[str]) -> bool:
if not out_dir.is_dir():
logging.error(f"{out_dir} is not a directory.")
Expand Down

0 comments on commit 263f8bd

Please sign in to comment.