mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-17 14:00:25 +02:00
android_asm_convert.py renamed identifiers in every directive's operands,
string data included: a string starting with "_" was taken for a quoted
symbol and lost the "_", and one with \" in it was split wrongly, so a
"_" starting a word in it was dropped too. 26 of the guest's objects had
strings or tables cut short. Among them Opus's pulse cache (cache_bits50,
one byte short from entry 338): its encoder picked more pulses than its
tables hold for some bands and crashed (the Steam Frame's crashes in
online games, with push to talk). Also musl's wide character tables,
map sharing's hashed names ("_%s"), the "_lan_" menu check, libtiff's
and the sound code's tables.
.ascii, .asciz and .string are now passed on unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
944 B
Python
33 lines
944 B
Python
"""Tests of tools/android_asm_convert.py, the Mach-O to ELF assembly
|
|
conversion of the Android build's guest code."""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
|
from android_asm_convert import Converter # noqa: E402
|
|
|
|
|
|
def convert(*lines):
|
|
return Converter(list(lines)).run().split("\n")
|
|
|
|
|
|
def test_symbols_lose_their_underscore():
|
|
out = convert("_main:", "\tbl\t_foo", "\t.long\t_bar")
|
|
assert out[:3] == ["main:", "\tbl foo", "\t.long bar"]
|
|
|
|
|
|
def test_strings_are_kept():
|
|
# (a string starting with "_", or one with \" in it, lost a "_": Opus's
|
|
# pulse cache was one byte short, and its encoder crashed)
|
|
out = convert(
|
|
'\t.asciz\t"_lan_"',
|
|
'\t.ascii\t"\\"$&\'\\0063_\\206"',
|
|
'\t.string\t"l_.str _foo"',
|
|
)
|
|
assert out[:3] == [
|
|
'\t.asciz "_lan_"',
|
|
'\t.ascii "\\"$&\'\\0063_\\206"',
|
|
'\t.string "l_.str _foo"',
|
|
]
|