mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-11 19:11:08 +00:00
* chore(i18n): translate every missing string in all locales Adds the 87 strings the bottom-screen Dashboard and in-game stats pages introduced to all 32 locales, plus the 51 older settings strings Japanese and the 50 Chinese locales were still missing. Every locale now has all 3456 translatable strings with the same placeholders as English. Also translates 36 entries that were still English where the language does not use the English word, and makes es-419 touch_app_id use the same %1$s placeholder as English. * chore(patches): drop comments from the lines downstream patches add Removes comment lines and trailing comments from lines our patches add, with hunk headers recounted. Lines that a later patch uses as context and the upstream backport 0123 are left as they are. The gamescope, FEX, proot and xodus series still apply to their pinned sources, and the patched trees differ only in those comments. test_hud_frames now finds the HUD writer by its first declaration. * docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix These were credited only in source headers and NOTICE files. * chore: remove source comments and unused functions Removes explanatory comments from first-party Kotlin, Java, C, C++, Rust, TypeScript, Python, shell, Gradle, CMake and workflow files. License and attribution headers stay, and vendored third-party trees, generated files and license files are untouched. A shellcheck directive is kept, and udevmon's fallthrough comments became fallthrough attributes. Syntax trees and token streams match the previous sources apart from the comments and Python docstrings. Module docstrings that argparse prints are kept, and device-smoke.sh prints the same --help text from a heredoc. Also removes 37 functions and 4 fields that nothing referenced. * chore: remove comments from the Syncthing integration and the latest main sources * docs: credit Syncthing and the syncthing-android fork * chore(i18n): translate the Syncthing strings in all locales The 107 strings the Syncthing integration added are now in all 32 locales. sync_web_path_locked names the Syncthing tab by its label. * docs: credit @xXJSONDeruloXx for the HUD metric readers The CPU, GPU load, thermal and battery readers come from their PerformanceHudView pull requests #777, #877, #991, #1406 and #1573. The FusionHUD credit line is unchanged. * docs: credit the HUD metric readers to @xXJSONDeruloXx's work
76 lines
2.8 KiB
Python
76 lines
2.8 KiB
Python
import glob
|
|
import os
|
|
from pathlib import Path
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
TESTS = Path(__file__).resolve().parent
|
|
TERMUX_DIR = TESTS.parents[1] / "app/src/main/cpp/termux"
|
|
|
|
|
|
def jni_include_dir():
|
|
candidates = [os.environ.get("JNI_INCLUDE")]
|
|
java_home = os.environ.get("JAVA_HOME")
|
|
if java_home:
|
|
candidates.append(os.path.join(java_home, "include"))
|
|
candidates += glob.glob("/usr/lib/jvm/*/include")
|
|
for var in ("ANDROID_NDK_LATEST_HOME", "ANDROID_NDK_HOME", "ANDROID_NDK_ROOT", "ANDROID_NDK"):
|
|
ndk = os.environ.get(var)
|
|
if ndk:
|
|
candidates += glob.glob(os.path.join(ndk, "toolchains/llvm/prebuilt/*/sysroot/usr/include"))
|
|
for candidate in candidates:
|
|
if candidate and os.path.isfile(os.path.join(candidate, "jni.h")):
|
|
return candidate
|
|
return None
|
|
|
|
|
|
def include_flags():
|
|
base = jni_include_dir()
|
|
flags = ["-I", base]
|
|
for sub in glob.glob(os.path.join(base, "*")):
|
|
if os.path.isfile(os.path.join(sub, "jni_md.h")):
|
|
flags += ["-I", sub]
|
|
return flags
|
|
|
|
|
|
@unittest.skipUnless(shutil.which("cc"), "needs a C compiler")
|
|
@unittest.skipUnless(jni_include_dir(), "needs jni.h (set JNI_INCLUDE, JAVA_HOME or ANDROID_NDK_HOME)")
|
|
class TermuxJniTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.tmp = tempfile.TemporaryDirectory()
|
|
cls.addClassCleanup(cls.tmp.cleanup)
|
|
cls.binary = os.path.join(cls.tmp.name, "termux_jni_harness")
|
|
subprocess.run(
|
|
["cc", "-std=gnu11", "-D_GNU_SOURCE", "-Wall", *include_flags(), "-I", str(TERMUX_DIR),
|
|
str(TESTS / "termux_jni_harness.c"), "-o", cls.binary],
|
|
check=True, capture_output=True, text=True)
|
|
|
|
def run_harness(self, args, envs):
|
|
result = subprocess.run([self.binary, str(args), str(envs)],
|
|
capture_output=True, text=True, timeout=30)
|
|
self.assertEqual(result.returncode, 0, result.stderr)
|
|
line = next(l for l in result.stdout.splitlines() if l.startswith("peak_refs="))
|
|
return {key: int(value) for key, value in re.findall(r"(\w+)=(\d+)", line)}
|
|
|
|
def test_a_long_argv_and_environment_stay_under_the_local_reference_limit(self):
|
|
stats = self.run_harness(300, 300)
|
|
self.assertEqual(stats["overflowed"], 0, stats)
|
|
|
|
def test_every_element_reference_is_released(self):
|
|
stats = self.run_harness(8, 8)
|
|
self.assertEqual(stats["live_refs"], 0, stats)
|
|
self.assertLessEqual(stats["peak_refs"], 1, stats)
|
|
|
|
def test_utf_chars_are_released_against_the_string_they_came_from(self):
|
|
stats = self.run_harness(1, 1)
|
|
self.assertEqual(stats["mismatched_releases"], 0, stats)
|
|
self.assertEqual(stats["unreleased_chars"], 0, stats)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|