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 9043867
Show file tree
Hide file tree
Showing 4 changed files with 73 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
8 changes: 7 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,12 @@ def init_tests(self, unified_test_cases: bool):
)
if not match:
continue
full_enc_string = match.group("full_enc_string")
if not re.search(r"0x[a-fA-F0-9]{1,2}$", full_enc_string[:-1]):
log.debug(f"Ignore because symbol injection is needed: {line}")
# The encoding string contains symbol information of the form:
# [0xc0,0xe0,A,A,A... or similar. 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,41 @@
# 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

# CHECK: vl %v0, src(%r1) # encoding: [0xe7,0x00,0b0001AAAA,A,0x00,0x06]
# CHECK-NEXT: # fixup A - offset: 2, value: src, kind: FK_390_U12Imm
# CHECK-REL: 0x{{[0-9A-F]*2}} R_390_12 src 0x0
.align 16
vl %v0, src(%r1)


# CHECK: .insn ss,238594023227392,dst(%r2,%r1),src,%r3 # encoding: [0xd9,0x23,0b0001AAAA,A,0b0000BBBB,B]
# CHECK-NEXT: # fixup A - offset: 2, value: dst, kind: FK_390_U12Imm
# CHECK-NEXT: # fixup B - offset: 4, value: src, kind: FK_390_U12Imm
# CHECK-REL: 0x{{[0-9A-F]*2}} R_390_12 dst 0x0
# CHECK-REL: 0x{{[0-9A-F]*4}} R_390_12 src 0x0
.align 16
.insn ss,0xd90000000000,dst(%r2,%r1),src,%r3 # mvck

##S8
# CHECK: asi 0(%r1), src # encoding: [0xeb,A,0x10,0x00,0x00,0x6a]
# CHECK-NEXT: # fixup A - offset: 1, value: src, kind: FK_390_S8Imm
# CHECK-REL: 0x{{[0-9A-F]+}} R_390_8 src 0x0
.align 16
asi 0(%r1),src
24 changes: 24 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,30 @@ def multi_mode_separated_test_cases(self):
],
)

def test_no_symbol_tests(self):
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 9043867

Please sign in to comment.