mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
cleanup (#764)
This commit is contained in:
1 parent
4163b31b02
commit
83ec5708ed
852 files changed
+4844
-46144
No files matched your search
@@ -3,7 +3,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Exercise the real cache with Vulkan lifetime callbacks, without an Android surface or GPU. */
|
||||
#define VK_PRESENT_H
|
||||
const char *vkp_gpu_name(void) { return "cache test"; }
|
||||
void droiddeck_log(const char *tag, const char *fmt, ...) { (void)tag; (void)fmt; }
|
||||
@@ -61,7 +60,6 @@ int main(int argc, char **argv) {
|
||||
assert(scene_ensure(source, 1280, 720) == 0);
|
||||
VkImageView original = bound_view;
|
||||
if (!strcmp(argv[1], "recycled")) {
|
||||
/* The owner destroys the image, then Vulkan reuses its handle at the same size. */
|
||||
vkp_effects_forget_image(source);
|
||||
assert(freed_sets == 1 && freed_views == 1);
|
||||
assert(scene_ensure(source, 1280, 720) == 0);
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/* Host test for sysv.c: IPC_STAT's sem_otime turns non-zero with the first semop, which the usual
|
||||
* race-free init (and SteamVR's web helper) waits for. Linked with sysv.c, whose semget/semop/semctl
|
||||
* replace libc's. */
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <sys/ipc.h>
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Drives Java_com_termux_terminal_JNI_createSubprocess against a mock JNIEnv that tracks local
|
||||
// references the way ART does, so the JNI hygiene of app/src/main/cpp/termux/termux.c can be
|
||||
// checked on the host. Built and run by tools/tests/test_termux_jni.py.
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -26,7 +23,6 @@ static jsize mock_array_length(JNIEnv* TERMUX_UNUSED(env), jarray array)
|
||||
static jobject mock_get_element(JNIEnv* TERMUX_UNUSED(env), jobjectArray TERMUX_UNUSED(array), jsize TERMUX_UNUSED(index))
|
||||
{
|
||||
if (++live_refs > peak_refs) peak_refs = live_refs;
|
||||
// ART aborts the process here: "local reference table overflow (max=512)".
|
||||
if (live_refs > LOCAL_REF_LIMIT) overflowed = 1;
|
||||
return (jobject) malloc(1);
|
||||
}
|
||||
@@ -53,7 +49,6 @@ static void mock_release_utf(JNIEnv* TERMUX_UNUSED(env), jstring string, const c
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(pinned) / sizeof(pinned[0]); i++) {
|
||||
if (pinned[i].owner != NULL && pinned[i].chars == chars) {
|
||||
// Releasing chars against some other string is a JNI contract violation.
|
||||
if (pinned[i].owner != string) mismatched_releases++;
|
||||
free(pinned[i].chars);
|
||||
pinned[i].owner = NULL;
|
||||
@@ -83,7 +78,6 @@ int main(int argc, char** argv)
|
||||
jsize arg_count = atoi(argv[1]);
|
||||
jsize env_count = atoi(argv[2]);
|
||||
|
||||
// The struct is JNINativeInterface in the NDK's header and JNINativeInterface_ in the JDK's.
|
||||
__typeof__(**(JNIEnv*) 0) table = {
|
||||
.GetArrayLength = mock_array_length,
|
||||
.GetObjectArrayElement = mock_get_element,
|
||||
@@ -97,7 +91,6 @@ int main(int argc, char** argv)
|
||||
};
|
||||
const __typeof__(table)* env = &table;
|
||||
|
||||
// Arrays are modelled as their length; the caller's own references are not counted.
|
||||
jsize args = arg_count, envs = env_count;
|
||||
jint pid_slot[1] = {0};
|
||||
jstring cmd = (jstring) "cmd", cwd = (jstring) "cwd";
|
||||
|
||||
@@ -46,7 +46,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
"""
|
||||
|
||||
# Shell builtins only: anything it ran would be an x86 program, handed back to it.
|
||||
HANDLER = "#!/bin/sh\nprintf '%s\\n' \"$@\" > \"$HANDLER_LOG\"\nexit 7\n"
|
||||
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ class CardboardParamsTest(unittest.TestCase):
|
||||
|
||||
@staticmethod
|
||||
def _env(folder):
|
||||
# cardboard.h includes <vulkan/vulkan.h>; the host test only needs the types, so a stub
|
||||
# header stands in when the Vulkan SDK is not installed.
|
||||
import os
|
||||
stub = Path(folder) / 'vulkan'
|
||||
stub.mkdir(exist_ok=True)
|
||||
@@ -50,7 +48,6 @@ class CardboardShaderTest(unittest.TestCase):
|
||||
'cardboard_frag.h is stale: regenerate it from cardboard.frag (see cardboard.c)')
|
||||
|
||||
def test_push_constants_fit_the_guaranteed_range(self):
|
||||
# 7 vec4 = 112 bytes in the shader; Vulkan guarantees 128.
|
||||
glsl = (SRC / 'cardboard.frag').read_text()
|
||||
block = glsl[glsl.index('uniform PC {'):glsl.index('} pc;')]
|
||||
self.assertLessEqual(16 * len(re.findall(r'\bvec4\b', block)), 128)
|
||||
|
||||
@@ -13,8 +13,6 @@ class DesktopRemovalInventoryTest(unittest.TestCase):
|
||||
self.assertIn('usr/bin/lxqt-session', paths)
|
||||
self.assertIn('usr/bin/labwc', paths)
|
||||
self.assertIn('usr/local/bin/steamdeck-desktop', paths)
|
||||
# The runtime pacman database did not protect libseat on the Thor. Removing it
|
||||
# made gamescope and every Steam/native session exit 127 after desktop cleanup.
|
||||
self.assertNotIn('usr/lib/libseat.so.1', paths)
|
||||
self.assertNotIn('usr/lib/libseat.so', paths)
|
||||
self.assertFalse(any(p.startswith('usr/lib/libSDL2') for p in paths))
|
||||
|
||||
@@ -21,7 +21,6 @@ FAKE = r"""
|
||||
|
||||
int real_opendirs;
|
||||
|
||||
/* COARSE=1: directory stats that never change, like NTFS's whole-second times and fixed size. */
|
||||
static void coarse(const char *path, struct stat *st) {
|
||||
if (getenv("COARSE") && strstr(path, "/fuse/") && S_ISDIR(st->st_mode)) {
|
||||
st->st_mtim = st->st_ctim = (struct timespec){1, 0};
|
||||
@@ -70,7 +69,6 @@ int statfs(const char *path, struct statfs *out) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* FASTPATH=1: open directories the way the fast-path preload does, through fdopendir. */
|
||||
DIR *opendir(const char *path) {
|
||||
static DIR *(*next)(const char *);
|
||||
if (!next) next = dlsym(RTLD_NEXT, "opendir");
|
||||
|
||||
@@ -28,8 +28,6 @@ def load(name):
|
||||
ctl = load("droiddeckctl")
|
||||
scenario = load("droiddeck-scenario")
|
||||
|
||||
# A stand-in for adb: answers the provider's content calls from a JSON config (a list answers
|
||||
# successive calls), records every invocation, and fakes the few shell commands droiddeckctl uses.
|
||||
FAKE_ADB = textwrap.dedent('''\
|
||||
#!/usr/bin/env python3
|
||||
import base64, json, os, sys
|
||||
@@ -136,7 +134,6 @@ class DroiddeckctlTest(FakeAdbTest):
|
||||
"launch": {"ok": True, "command": "launch", "appId": "489830"},
|
||||
"state": [state(focused=769, focusable=[769]), state(focused=489830, focusable=[769])],
|
||||
})
|
||||
# Focus alone is not enough: the game must also be in the list Steam orders from.
|
||||
code, out = self.run_ctl("launch", "489830", "--wait", "--timeout", "1")
|
||||
self.assertEqual(5, code)
|
||||
self.assertEqual("TIMEOUT", out["error"]["code"])
|
||||
@@ -333,7 +330,7 @@ class ScenarioTest(FakeAdbTest):
|
||||
"steps": [["state"], {"assert": "session.focus.focusedApp", "equals": 489830}]})
|
||||
code, report = self.run_scenario(path)
|
||||
self.assertEqual(1, code)
|
||||
self.assertEqual(1, len(report["runs"])) # stops at the first failure without --keep-going
|
||||
self.assertEqual(1, len(report["runs"]))
|
||||
self.assertIn("is 769", report["runs"][0]["error"])
|
||||
evidence = json.loads((Path(report["runs"][0]["folder"]) / "evidence.json").read_text())
|
||||
self.assertEqual(769, evidence["focus"]["focusedApp"])
|
||||
|
||||
@@ -29,7 +29,6 @@ class EffectsSourceCacheTest(unittest.TestCase):
|
||||
cls.temp = tempfile.TemporaryDirectory(prefix='droiddeck-effects-cache-')
|
||||
cls.addClassCleanup(cls.temp.cleanup)
|
||||
folder = Path(cls.temp.name)
|
||||
# Copy only Vulkan headers so Android's libc headers cannot shadow the host's libc.
|
||||
shutil.copytree(headers, folder / 'include/vulkan', ignore=shutil.ignore_patterns('*.hpp'))
|
||||
if (headers.parent / 'vk_video').is_dir():
|
||||
shutil.copytree(headers.parent / 'vk_video', folder / 'include/vk_video')
|
||||
|
||||
@@ -341,8 +341,6 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
self.assertIn("GE-Proton11-7", [entry["name"] for entry in COMPAT["tool_catalog"](str(home), None)])
|
||||
|
||||
def test_droiddeck_proton_is_adopted_and_labelled_like_any_other_extra(self):
|
||||
# Its folder has a space ("DroidDeck-Proton 11-7.5") and its internal name starts with
|
||||
# "DroidDeck-Proton-", which lower-cases to our own tools' prefix: neither may matter.
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
home = Path(tmp)
|
||||
(home / "label").write_text("Compatible\n")
|
||||
@@ -370,15 +368,12 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
config.write_text(config_text([("0", COMPAT["TOOL"]), ("42", "DroidDeck-Proton-11-7.5")]))
|
||||
COMPAT["register_default"](str(config), ["42", "43"], protect=protect)
|
||||
self.assertEqual(mapping_of(config.read_text()), {"0": COMPAT["TOOL"], "42": "DroidDeck-Proton-11-7.5", "43": COMPAT["TOOL"]})
|
||||
# Once removed it is no longer runnable, and its games go back to the default.
|
||||
changes, _ = COMPAT["plan_mapping"]({"0": COMPAT["TOOL"], "42": "DroidDeck-Proton-11-7.5"}, ["42"], [COMPAT["TOOL"]], COMPAT["TOOL"], {})
|
||||
self.assertEqual(changes, {"42": COMPAT["TOOL"]})
|
||||
|
||||
def test_both_proton_wrappers_call_environment_launcher(self):
|
||||
for script in (COMPAT["LAUNCHER_SH"], COMPAT["EXTRA_WRAPPER_SH"] % "proton"):
|
||||
subprocess.run(["bash", "-n"], input=script, text=True, check=True)
|
||||
# Started through bl_run, which execs it - or, for a store game with cloud saves, waits
|
||||
# for it so droiddeck-store-launch --exited can follow (test_store_launch.CloudHooks).
|
||||
self.assertIn('bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env', script)
|
||||
|
||||
def test_wrappers_preload_the_session_library_before_the_input_shim(self):
|
||||
@@ -564,8 +559,6 @@ class DirectAudioPrefixTest(unittest.TestCase):
|
||||
wine = self.tool / "files/bin-arm64/wine"
|
||||
wine.write_text("#!/bin/sh\necho wine-11.0-4c8f2e1 '(Staging)'\n")
|
||||
wine.chmod(0o755)
|
||||
# Proton's own winepulse.so names the audio interface: the classic table never imports
|
||||
# PsCreateSystemThread, the system-thread one (Proton-CachyOS) always does.
|
||||
(self.tool / "files/lib/wine/aarch64-unix").mkdir(parents=True)
|
||||
self.winepulse = self.tool / "files/lib/wine/aarch64-unix/winepulse.so"
|
||||
self.winepulse.write_bytes(b"\x7fELF classic wine 11 pulse driver")
|
||||
@@ -607,8 +600,6 @@ class DirectAudioPrefixTest(unittest.TestCase):
|
||||
result = self.run_setup()
|
||||
self.assertIn("DirectAudio selected", result.stderr)
|
||||
self.assertIn("WINEDLLPATH=%s/lib/wine" % self.audio, result.stdout)
|
||||
# Proton-CachyOS's mmdevapi takes the driver list from this variable, and its launcher
|
||||
# pre-sets it to pulse,alsa unless it is already set.
|
||||
self.assertIn("WINE_AUDIO_DRIVER=directaudio,pulse\n", result.stdout)
|
||||
self.assertEqual(self.link("system32"), str(self.audio / "lib/wine/aarch64-windows/winedirectaudio.drv"))
|
||||
self.assertEqual(self.link("syswow64"), str(self.audio / "lib/wine/i386-windows/winedirectaudio.drv"))
|
||||
@@ -701,16 +692,11 @@ class StartWithoutSteamTest(unittest.TestCase):
|
||||
game = [str(ge), "waitforexitandrun", "/games/Game.exe", "-windowed"]
|
||||
self.assertEqual(start(game, {}, "3384071994"), (game, {}))
|
||||
on = {"DROIDDECK_NO_STEAM": "1"}
|
||||
# An added game (a shortcut id) has no Steam fixes: UMU_ID 0. The command is unchanged.
|
||||
self.assertEqual(start(game, on, "3384071994"), (game, dict(on, UMU_ID="0")))
|
||||
# A Steam game keeps its protonfixes under its own id.
|
||||
self.assertEqual(start(game, on, "570940")[1]["UMU_ID"], "570940")
|
||||
# A UMU_ID the user set wins.
|
||||
self.assertEqual(start(game, dict(on, UMU_ID="umu-1"), "570940")[1]["UMU_ID"], "umu-1")
|
||||
# Valve's Proton has no umu launch: the game runs straight in the prefix.
|
||||
plain = [str(valve)] + game[1:]
|
||||
self.assertEqual(start(plain, on, "570940"), ([str(valve), "runinprefix", "/games/Game.exe", "-windowed"], on))
|
||||
# Only a game launch: the client's own runs and other verbs are left alone.
|
||||
for other in ([str(ge), "run", "/x.exe"], [str(ge), "waitforexitandrun"], [str(valve), "getcompatpath", "/x"]):
|
||||
self.assertEqual(start(other, on, "570940"), (other, on))
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class LauncherCoresTest(unittest.TestCase):
|
||||
self.proc = self.root / 'proc'
|
||||
self.proc.mkdir()
|
||||
cpufreq = self.root / 'cpu'
|
||||
for cpu in ALL: # 0-5 one cluster, 6-7 the fast one
|
||||
for cpu in ALL:
|
||||
(cpufreq / f'cpu{cpu}/cpufreq').mkdir(parents=True)
|
||||
(cpufreq / f'cpu{cpu}/cpufreq/cpuinfo_max_freq').write_text('3532800\n' if cpu < 6 else '4320000\n')
|
||||
self.cores = FakeCores()
|
||||
@@ -118,7 +118,7 @@ class LauncherCoresTest(unittest.TestCase):
|
||||
self.process(100, LAUNCHER)
|
||||
self.process(200, HELPER)
|
||||
self.process(9, '/root/.local/share/Steam/steamrtarm64/steam')
|
||||
self.governor.tick() # no focus file yet
|
||||
self.governor.tick()
|
||||
self.focus_on(9, app=769)
|
||||
self.governor.tick()
|
||||
self.focus_on(100)
|
||||
@@ -141,7 +141,6 @@ class LauncherCoresTest(unittest.TestCase):
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
# A new thread, and a new helper process the held one started: both born held.
|
||||
self.thread(200, 203, {5}, NICE)
|
||||
self.process(500, HELPER, (501,), cpus={5}, nice=NICE)
|
||||
self.now += 10
|
||||
@@ -156,16 +155,16 @@ class LauncherCoresTest(unittest.TestCase):
|
||||
self.process(400, GAME)
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
self.cores.state[201] = (ALL, -5) # the program raised a thread's priority itself
|
||||
self.cores.state[201] = (ALL, -5)
|
||||
self.now += 5
|
||||
self.governor.tick()
|
||||
self.assertFalse(self.held(201)) # not looked at again before the rescan
|
||||
self.assertFalse(self.held(201))
|
||||
self.now += 5
|
||||
self.governor.tick()
|
||||
self.assertTrue(self.held(201))
|
||||
self.focus_on(200)
|
||||
self.governor.tick()
|
||||
self.assertEqual((ALL, 0), self.cores.state[201]) # its first state, not the program's
|
||||
self.assertEqual((ALL, 0), self.cores.state[201])
|
||||
|
||||
def test_a_steady_hold_is_not_rewritten(self):
|
||||
self.process(200, HELPER, (201,))
|
||||
@@ -182,7 +181,7 @@ class LauncherCoresTest(unittest.TestCase):
|
||||
self.process(200, HELPER, (201,))
|
||||
self.process(300, HELPER)
|
||||
self.process(400, GAME)
|
||||
del self.cores.state[201] # ended between the listing and the call
|
||||
del self.cores.state[201]
|
||||
self.focus_on(400)
|
||||
self.governor.tick()
|
||||
self.assertNotIn(201, self.holder.held[200])
|
||||
|
||||
@@ -80,7 +80,7 @@ class SleepHandshakeTest(unittest.TestCase):
|
||||
token = self.suspend()
|
||||
self.assertTrue(self.preparing())
|
||||
self.state(token, "paused")
|
||||
self.state("0" * 32, "awake") # stale session acknowledgments cannot wake this one
|
||||
self.state("0" * 32, "awake")
|
||||
time.sleep(0.1)
|
||||
self.assertTrue(self.preparing())
|
||||
self.state(token, "awake")
|
||||
|
||||
@@ -120,9 +120,6 @@ class LayoutTest(unittest.TestCase):
|
||||
self.assertEqual(inst.included_components, {"Up", "Wide"})
|
||||
|
||||
def test_a_duplicate_onto_the_file_itself_is_skipped(self):
|
||||
# The .NET host packages (dotnet-host-*-win-x86.msi) duplicate dotnet.exe into its own
|
||||
# folder under its own name; copying it onto itself raised SameFileError and stopped every
|
||||
# .NET Core / Desktop runtime install.
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
src = Path(tmp) / "cab" / "dotnet.exe"
|
||||
src.parent.mkdir()
|
||||
@@ -269,13 +266,11 @@ class RegistryApplyTest(unittest.TestCase):
|
||||
text = (self.pfx / "system.reg").read_text()
|
||||
self.assertIn('"Version"="4.0"', text)
|
||||
self.assertIn('"Kept"="mine"', text)
|
||||
# Through the Wow6432Node\Classes link into the shared Classes\Wow6432Node key, never under the link.
|
||||
self.assertIn('[Software\\\\Classes\\\\Wow6432Node\\\\CLSID\\\\{X}]', text)
|
||||
self.assertNotIn('[Software\\\\Wow6432Node\\\\Classes\\\\CLSID', text)
|
||||
self.assertIn('"PATH"=str(2):"C:\\\\PhysX;%SystemRoot%\\\\system32;%SystemRoot%"', text)
|
||||
self.assertNotIn("[System\\\\CurrentControlSet\\\\", text)
|
||||
self.assertIn('"Opt"=dword:00000002', (self.pfx / "user.reg").read_text())
|
||||
# The prefix's own spelling of Program Files (x86) is kept.
|
||||
self.assertTrue((self.pfx / "drive_c/program files (x86)/Microsoft XNA/xna.dll").is_file())
|
||||
self.assertFalse((self.pfx / "drive_c/Program Files (x86)").exists())
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ class NetworkObjectsTest(unittest.TestCase):
|
||||
self.assertTrue(secured["RsnFlags"].unpack() & 0x100)
|
||||
self.assertTrue(secured["RsnFlags"].unpack() & 0x400)
|
||||
self.assertEqual(found[nm.ap_path(other["bssid"])][nm.NAME + ".AccessPoint"]["Flags"].unpack(), 0)
|
||||
# Keep nearby-network discovery while a cellular connection provides the default route.
|
||||
cellular = nm.objects(dict(CELLULAR, accessPoints=[other]))
|
||||
self.assertIn(nm.ap_path(other["bssid"]), cellular)
|
||||
self.assertEqual(cellular[nm.ROOT + "/Devices/Wifi"][nm.NAME + ".Device.Wireless"]["ActiveAccessPoint"].unpack(), "/")
|
||||
@@ -131,7 +130,6 @@ class NetworkBusTest(unittest.TestCase):
|
||||
self.write(WIFI)
|
||||
self.bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
|
||||
env = dict(os.environ, DBUS_SYSTEM_BUS_ADDRESS=os.environ["DBUS_SESSION_BUS_ADDRESS"])
|
||||
# Use the production service and only redirect its input file for the fixture.
|
||||
launch = "import runpy,sys; from pathlib import Path; n=runpy.run_path(sys.argv[1]); g=n['main'].__globals__; g['SNAPSHOT']=Path(sys.argv[2]); g['SCAN_REQUEST']=Path(sys.argv[2]).with_suffix('.request'); n['main']()"
|
||||
self.process = subprocess.Popen([sys.executable, "-c", launch, str(SCRIPT), str(self.snapshot)], env=env,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
@@ -217,7 +215,6 @@ class NetworkBusTest(unittest.TestCase):
|
||||
self.assertTrue(any(interface == nm.OBJECT_MANAGER and member == "InterfacesRemoved" and args[0] == nm.AP
|
||||
for _, interface, member, args in signals))
|
||||
self.assertTrue(any(member == "AccessPointAdded" for _, _, member, _ in signals))
|
||||
# A missing/invalid snapshot is a transient input error, never a fake Ethernet handover.
|
||||
self.snapshot.write_text("{")
|
||||
time.sleep(1.2)
|
||||
self.assertEqual(self.prop(nm.ROOT, nm.NAME, "PrimaryConnectionType"), "802-11-wireless")
|
||||
@@ -250,8 +247,6 @@ class NetworkBusTest(unittest.TestCase):
|
||||
from gi.repository import NM
|
||||
except ValueError:
|
||||
self.skipTest("requires gir1.2-nm-1.0")
|
||||
# libnm is a real consumer of the same API Steam reads. It caches objects by path,
|
||||
# so the handover must replace the Wi-Fi device with a modem rather than mutate its type.
|
||||
previous = os.environ.get("DBUS_SYSTEM_BUS_ADDRESS")
|
||||
os.environ["DBUS_SYSTEM_BUS_ADDRESS"] = os.environ["DBUS_SESSION_BUS_ADDRESS"]
|
||||
try:
|
||||
|
||||
@@ -89,7 +89,6 @@ class ProtonExtraTest(unittest.TestCase):
|
||||
steam = Path(tmp) / "Steam"
|
||||
adopted = []
|
||||
real = subprocess.call
|
||||
# tar runs for real; steam-compatibility (the adoption step) is only recorded.
|
||||
fake = lambda args, **kw: adopted.append(args) or 0 if args[0] == "steam-compatibility" else real(args, **kw)
|
||||
with mock.patch.object(GLOBALS["subprocess"], "call", fake), contextlib.redirect_stdout(io.StringIO()) as said:
|
||||
with mock.patch.object(GLOBALS["sys"], "argv", ["droiddeck-proton-extra", str(steam), str(tarball)]):
|
||||
@@ -98,7 +97,6 @@ class ProtonExtraTest(unittest.TestCase):
|
||||
self.assertEqual(sorted(os.listdir(tools)), [".droiddeck-download", "DroidDeck-Proton 11-7.5"])
|
||||
self.assertTrue((tools / "DroidDeck-Proton 11-7.5" / "toolmanifest.vdf").is_file())
|
||||
self.assertEqual(adopted, [["steam-compatibility", str(steam)]])
|
||||
# The app reads the folder from this line, space and all.
|
||||
self.assertIn("droiddeck-proton-extra: installed DroidDeck-Proton 11-7.5\n", said.getvalue())
|
||||
self.assertEqual(EXTRA["installed"](str(tools)), ["DroidDeck-Proton 11-7.5"])
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ GAME_SCRIPT = r'''"InstallScript"
|
||||
}
|
||||
'''
|
||||
|
||||
# Red Dead Redemption 2's own script: Proton needs Khronos' vulkan-1.dll for it, which only the
|
||||
# Vulkan runtime installer puts in the prefix.
|
||||
VULKAN_SCRIPT = r'''"InstallScript"
|
||||
{
|
||||
"Run Process"
|
||||
@@ -148,7 +146,6 @@ class SeedRedistsTest(unittest.TestCase):
|
||||
self.assertIn('"Other"=dword:00000001', reg)
|
||||
self.assertNotIn("Vulkan111080", (self.reg.parent / ".droiddeck-redists").read_text())
|
||||
self.assertEqual(int(self.reg.stat().st_mtime), 1_000_000_000)
|
||||
# The client writes the marker itself once the installer has run; that one is left alone.
|
||||
with self.reg.open("a") as out:
|
||||
out.write('\n[Software\\\\Valve\\\\Steam\\\\Apps\\\\1174180] 1791730000\n"Vulkan111080"=dword:00000001\n')
|
||||
self.run_seed()
|
||||
|
||||
@@ -53,8 +53,6 @@ class SessionGuestCommandTest(unittest.TestCase):
|
||||
def test_child_receives_its_package_socket_after_environment_is_cleared(self):
|
||||
for package in PACKAGES:
|
||||
with self.subTest(package=package):
|
||||
# env with no command prints the environment it would pass to the
|
||||
# session. A misplaced assignment fails at exec, before it runs.
|
||||
result = subprocess.run(
|
||||
guest_prefix(package), capture_output=True, text=True, check=True,
|
||||
timeout=5, env={"DROIDDECK_BWRAP_SOCKET": "wrong.bwrap", "STALE_HOST": "1"})
|
||||
|
||||
@@ -12,7 +12,7 @@ SESSION = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/d
|
||||
STEAM = ["mangohud.Ab3dE6gH", ".com.valvesoftware.Steam.x1Y2z3/", "steam_chrome_shmem_uid10480_0", "steamADfAnd/"]
|
||||
CHROMIUM = ["scoped_dir3yu9Xt/SingletonSocket"]
|
||||
APPIMAGE = ["droiddeck-appimage.19PoOD"]
|
||||
BUS = ["dbus-1zWfOP1IaR="] # = a socket
|
||||
BUS = ["dbus-1zWfOP1IaR="]
|
||||
KDE = ["plasma-csd-generator.BVWIWA/"]
|
||||
STALE = STEAM + CHROMIUM + APPIMAGE + BUS + KDE
|
||||
KEPT = ["droiddeck-mangohud.conf", ".X11-unix/", "steamworks", "steamABCDEF/inside", "notes.txt",
|
||||
|
||||
@@ -107,7 +107,7 @@ class DesktopSteamLaunchTest(unittest.TestCase):
|
||||
|
||||
def test_cef_software_is_scoped_to_the_kde_client(self):
|
||||
source = (BIN / 'droiddeck-session').read_text()
|
||||
setup = source[source.index(' _bl_ui=(-gamepadui)'):source.index(' # Deck mode, always')]
|
||||
setup = source[source.index(' _bl_ui=(-gamepadui)'):source.index(' if [ "${BL_STEAM_UI:-}" != desktop ]; then')]
|
||||
for desktop, ui, software in [('1', 'desktop', True), ('1', 'bigpicture', False), ('', 'desktop', False)]:
|
||||
with self.subTest(desktop=desktop, ui=ui):
|
||||
env = dict(self.env, BL_DESKTOP=desktop, BL_STEAM_UI=ui)
|
||||
|
||||
@@ -25,7 +25,6 @@ class SteamInstallTest(unittest.TestCase):
|
||||
self.requests = self.root / 'requests'
|
||||
self.bin = self.root / 'bin'
|
||||
self.bin.mkdir()
|
||||
# Only the network is faked: exercise real manifest parsing, checksums and zip extraction.
|
||||
curl = self.bin / 'curl'
|
||||
curl.write_text('''#!/bin/bash
|
||||
set -eu
|
||||
@@ -33,7 +32,6 @@ printf '%s\\n' "$2" >> "$TEST_REQUESTS"
|
||||
cp "$TEST_CDN/${2##*/}" "$4"
|
||||
''')
|
||||
curl.chmod(0o755)
|
||||
# macOS has shasum; the guest and Linux CI have sha256sum.
|
||||
if shutil.which('sha256sum') is None:
|
||||
sha = self.bin / 'sha256sum'
|
||||
sha.write_text('#!/bin/bash\nexec shasum -a 256 "$@"\n')
|
||||
@@ -78,7 +76,6 @@ cp "$TEST_CDN/${2##*/}" "$4"
|
||||
self.assert_installed()
|
||||
|
||||
def test_an_install_from_another_branch_is_left_for_steam_to_move(self):
|
||||
# An older app could install publicbeta; droiddeck-session moves the client at its start.
|
||||
self.assert_installed()
|
||||
requests = self.requests.read_text()
|
||||
(self.steam / 'package/beta').write_text('publicbeta\n')
|
||||
|
||||
@@ -37,7 +37,6 @@ def value(text, *path):
|
||||
STEAM = ('Registry', 'HKCU', 'Software', 'Valve', 'Steam', 'language')
|
||||
GLOBAL = ('Registry', 'HKCU', 'Software', 'Valve', 'Steamsteamglobal', 'language')
|
||||
|
||||
# As the client leaves it on a device (trimmed): both keys, other values beside them, and HKLM.
|
||||
CLIENT = '''"Registry"
|
||||
{
|
||||
"HKLM"
|
||||
|
||||
@@ -172,7 +172,6 @@ class ShortcutsTest(unittest.TestCase):
|
||||
self.assertEqual('Example: Renamed', entry['AppName'])
|
||||
self.assertEqual('"%s/data"' % GUEST, entry['StartDir'])
|
||||
self.assertEqual('-dx11', entry['LaunchOptions'])
|
||||
# One shortcut, the same appid.
|
||||
self.assertEqual([APPID], list(self.run_writer(game)))
|
||||
|
||||
def test_a_target_chosen_in_the_app_updates_the_same_shortcut(self):
|
||||
|
||||
@@ -56,7 +56,6 @@ class Detection(unittest.TestCase):
|
||||
def test_anything_else_is_left_alone(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root)
|
||||
# The exe of a store game is one too (a GOG game without a launcher); a stray file is not.
|
||||
self.assertEqual(folder, store.find_store_game([str(folder / 'Metalstorm.exe')])[0])
|
||||
self.assertIsNone(store.find_store_game([str(Path(root) / 'elsewhere/readme.txt')]))
|
||||
(folder / '.droiddeck-store.json').unlink()
|
||||
@@ -65,7 +64,6 @@ class Detection(unittest.TestCase):
|
||||
def test_only_epic_asks_for_a_code(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog')
|
||||
# Cloud saves off: GOG still prepares achievements, never an Epic exchange code.
|
||||
sc = json.loads((folder / '.droiddeck-store.json').read_text()); sc['cloud'] = False
|
||||
(folder / '.droiddeck-store.json').write_text(json.dumps(sc))
|
||||
os.environ['BL_LAUNCH_DIR'] = str(Path(root) / 'session')
|
||||
@@ -136,7 +134,6 @@ class Prefix(unittest.TestCase):
|
||||
text = self.reg.read_text()
|
||||
self.assertIn('[Software\\\\Wine\\\\WineBrowser] ', text)
|
||||
self.assertIn('"Browsers"="/usr/local/bin/droiddeck-open-url,xdg-open"', text)
|
||||
# A second launch adds nothing: the last word already says so.
|
||||
store.provision_prefix(str(self.compat))
|
||||
self.assertEqual(text, self.reg.read_text())
|
||||
|
||||
@@ -158,7 +155,6 @@ class Choices(unittest.TestCase):
|
||||
folder = game(root)
|
||||
sidecar = json.loads((folder / '.droiddeck-store.json').read_text())
|
||||
self.assertEqual({'eos': True, 'offline': False}, store.options(sidecar))
|
||||
# An earlier build's overlay field is read past.
|
||||
self.assertEqual({'eos': True, 'offline': False}, store.options({'epic': {'v': 2, 'overlay': True}}))
|
||||
sidecar['epic'] = {'eos': True, 'offline': True}
|
||||
sidecar['cloud'] = False
|
||||
@@ -175,7 +171,6 @@ class Choices(unittest.TestCase):
|
||||
finally:
|
||||
del os.environ['BL_LAUNCH_DIR']
|
||||
del os.environ['STEAM_COMPAT_DATA_PATH']
|
||||
# Offline: no request was made and no code is left; the old overlay pointer is gone.
|
||||
self.assertFalse((Path(root) / 'session/stores/req').exists())
|
||||
self.assertFalse((folder / '.droiddeck-epic-code').exists())
|
||||
text = reg.read_text()
|
||||
@@ -200,7 +195,6 @@ class Browser(unittest.TestCase):
|
||||
|
||||
class ExeTarget(unittest.TestCase):
|
||||
def test_a_game_started_by_its_exe_is_found_from_a_subfolder(self):
|
||||
# Most GOG games have no launcher .bat: Steam runs the exe, which may sit in a subfolder.
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = game(root, store_id='gog', ident='1207664643')
|
||||
(folder / 'bin/x64').mkdir(parents=True)
|
||||
@@ -222,7 +216,6 @@ class CloudHooks(unittest.TestCase):
|
||||
original = store.ask
|
||||
asked = []
|
||||
store.ask = lambda channel, request, timeout=5.0: asked.append((request, timeout)) or {'ok': True, 'files': 2, 'reason': 'ok'}
|
||||
# 10: the launcher waits for Proton and calls --exited afterwards.
|
||||
self.assertEqual(store.STORE_GAME, store.main([bat]))
|
||||
self.assertEqual(0, store.main(['--exited', bat]))
|
||||
finally:
|
||||
@@ -309,7 +302,6 @@ class GogAchievements(unittest.TestCase):
|
||||
self.assertTrue((data / 'pfx/.droiddeck-comet-service').is_file())
|
||||
self.assertEqual('ready', store.provision_galaxy(str(data), str(proton)))
|
||||
self.assertEqual(1, len(seen))
|
||||
# A recreated prefix must be provisioned again, even with the same Proton.
|
||||
__import__('shutil').rmtree(data / 'pfx')
|
||||
self.assertEqual('ready', store.provision_galaxy(str(data), str(proton)))
|
||||
self.assertEqual(2, len(seen))
|
||||
|
||||
@@ -59,8 +59,6 @@ class TermuxJniTest(unittest.TestCase):
|
||||
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):
|
||||
# 300 + 300 is under 512 for each loop on its own but over it together, as the issue says:
|
||||
# ART aborts with "local reference table overflow (max=512)".
|
||||
stats = self.run_harness(300, 300)
|
||||
self.assertEqual(stats["overflowed"], 0, stats)
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class WinComponentsTest(unittest.TestCase):
|
||||
self.pick("vc")
|
||||
self.apply()
|
||||
self.assertEqual(installer.read_bytes(), b"ours")
|
||||
self.apply() # a second launch keeps the first backup, not ours
|
||||
self.apply()
|
||||
self.pick()
|
||||
names, notes = self.apply()
|
||||
self.assertEqual(installer.read_bytes(), b"from a real installer")
|
||||
|
||||
@@ -47,7 +47,6 @@ static uint64_t sum(const unsigned char *p, size_t n) {
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Rewrites its pages with a round number and checks every page it wrote last round. */
|
||||
static void *writer(void *arg) {
|
||||
unsigned char *mine = shared + (size_t)(uintptr_t)arg * (size / 4);
|
||||
for (unsigned char round = 1; !stop; round++) {
|
||||
@@ -78,7 +77,6 @@ int main(int argc, char **argv) {
|
||||
sigaction(SIGURG, NULL, &sa);
|
||||
printf("handler %d\n", (sa.sa_flags & SA_SIGINFO) ? 1 : 0);
|
||||
if (argc > 4) {
|
||||
/* Read-only memory the process never pages out itself, swapped as the kernel would. */
|
||||
unsigned char *ro = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
memset(ro, 0x5a, size);
|
||||
mprotect(ro, size, PROT_READ);
|
||||
|
||||
Reference in new issue
Block a user