Test enable_steam_game_drive for duplicate paths. Distributions or GUI launchers may set the LD_LIBRARY_PATH environment variable to reference their own runtime library paths. Ensure that there will never be duplicates in that environment variable.
(self)
| 2321 | self.assertFalse(self.env["EXE"], "Expected EXE to be empty on empty string") |
| 2322 | |
| 2323 | def test_game_drive_libpath(self): |
| 2324 | """Test enable_steam_game_drive for duplicate paths. |
| 2325 | |
| 2326 | Distributions or GUI launchers may set the LD_LIBRARY_PATH environment |
| 2327 | variable to reference their own runtime library paths. Ensure that |
| 2328 | there will never be duplicates in that environment variable. |
| 2329 | """ |
| 2330 | args = None |
| 2331 | result_gamedrive = None |
| 2332 | Path(self.test_file + "/proton").touch() |
| 2333 | |
| 2334 | # Replicate main's execution and test up until enable_steam_game_drive |
| 2335 | with patch("sys.argv", ["", ""]), ThreadPoolExecutor() as thread_pool: |
| 2336 | os.environ["WINEPREFIX"] = self.test_file |
| 2337 | os.environ["PROTONPATH"] = self.test_file |
| 2338 | os.environ["GAMEID"] = self.test_file |
| 2339 | os.environ["STORE"] = self.test_file |
| 2340 | os.environ["RUNTIMEPATH"] = self.test_runtime_default[1] |
| 2341 | # Args |
| 2342 | args = __main__.parse_args() |
| 2343 | # Config |
| 2344 | result_env, result_dl = umu_run.check_env(self.env) |
| 2345 | umu_run.download_proton(result_env, thread_pool, download=result_dl) |
| 2346 | # Prefix |
| 2347 | umu_run.setup_pfx(Path(self.env["WINEPREFIX"])) |
| 2348 | # Env |
| 2349 | umu_run.set_env(self.env, args) |
| 2350 | |
| 2351 | if "LD_LIBRARY_PATH" in os.environ: |
| 2352 | os.environ.pop("LD_LIBRARY_PATH") |
| 2353 | |
| 2354 | # Mock Lutris's LD_LIBRARY_PATH |
| 2355 | paths = ( |
| 2356 | "/home/foo/.local/share/lutris/runtime/steam/i386/usr/lib:" |
| 2357 | "/usr/lib:" |
| 2358 | "/usr/lib32:" |
| 2359 | "/usr/lib64:" |
| 2360 | "/home/foo/.local/share/lutris/runtime/steam/amd64/lib:" |
| 2361 | "/home/foo/.local/share/lutris/runtime/steam/amd64/usr/lib:" |
| 2362 | "/home/foo/.local/share/lutris/runtime/Ubuntu-18.04-i686:" |
| 2363 | "/home/foo/.local/share/lutris/runtime/steam/i386/lib:" |
| 2364 | "/usr/lib/libfakeroot:" |
| 2365 | "/home/foo/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:" |
| 2366 | "/home/foo/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:" |
| 2367 | "/home/foo/.local/share/lutris/runtime/Ubuntu-18.04-x86_64:" |
| 2368 | "/home/foo/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:" |
| 2369 | "/home/foo/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu" |
| 2370 | ) |
| 2371 | os.environ["LD_LIBRARY_PATH"] = paths |
| 2372 | |
| 2373 | # Game drive |
| 2374 | result_gamedrive = umu_run.enable_steam_game_drive(self.env) |
| 2375 | |
| 2376 | for key, val in self.env.items(): |
| 2377 | os.environ[key] = val |
| 2378 | |
| 2379 | # Game drive |
| 2380 | self.assertTrue(result_gamedrive is self.env, "Expected the same reference") |