Skip to content

Commit

Permalink
fix: set STORE in config usage (#255)
Browse files Browse the repository at this point in the history
* umu_run: fix STORE not being set in config usage

* umu_test: remove assertion for STORE in winetricks test

- The winetricks usage and the automatic application of fixes via the protonfixes module are mutually exclusive. Therefore, it is fine to remove the assertion for the STORE environment variable in this specific unit test

* umu_test_plugins: add assertion for STORE

* tests: bump umu proton version

* umu_test_plugins: fix test

* tests: fix typo

* tests: add gog store in config

* tests: fix exit 1 code

* tests: update comment
  • Loading branch information
R1kaB3rN authored Oct 25, 2024
1 parent 6e8e53c commit 785bcce
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
14 changes: 8 additions & 6 deletions tests/test_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ python --version
tmp=$(mktemp)
mkdir -p "$HOME/.local/share/Steam/compatibilitytools.d"
mkdir -p "$HOME/Games/umu/umu-0"
curl -LJO "https://github.com/Open-Wine-Components/umu-proton/releases/download/UMU-Proton-9.0-3/UMU-Proton-9.0-3.tar.gz"
tar xaf UMU-Proton-9.0-3.tar.gz
mv UMU-Proton-9.0-3 "$HOME/.local/share/Steam/compatibilitytools.d"
curl -LJO "https://github.com/Open-Wine-Components/umu-proton/releases/download/UMU-Proton-9.0-3.2/UMU-Proton-9.0-3.2.tar.gz"
tar xaf UMU-Proton-9.0-3.2.tar.gz
mv UMU-Proton-9.0-3.2 "$HOME/.local/share/Steam/compatibilitytools.d"

echo "[umu]
proton = '~/.local/share/Steam/compatibilitytools.d/UMU-Proton-9.0-3'
game_id = 'umu-0'
proton = '~/.local/share/Steam/compatibilitytools.d/UMU-Proton-9.0-3.2'
game_id = 'umu-1141086411'
prefix = '~/Games/umu/umu-0'
exe = '~/Games/umu/umu-0/drive_c/windows/syswow64/wineboot.exe'
launch_args = ['-u']
store = 'gog'
" >> "$tmp"


UMU_LOG=debug GAMEID=umu-0 "$PWD/.venv/bin/python" "$HOME/.local/bin/umu-run" --config "$tmp"
UMU_LOG=debug GAMEID=umu-1141086411 STORE=gog "$PWD/.venv/bin/python" "$HOME/.local/bin/umu-run" --config "$tmp" 2> /tmp/umu-log.txt && grep -E "INFO: Non-steam game Silent Hill 4: The Room \(umu-1141086411\)" /tmp/umu-log.txt
# Run the 'game' using UMU-Proton9.0-3.2 and ensure the protonfixes module finds its fix in umu-database.csv
4 changes: 2 additions & 2 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ def set_env(
env["EXE"] = args[0] # type: ignore
env["STEAM_COMPAT_INSTALL_PATH"] = ""
log.warning("Executable not found: %s", env["EXE"])
env["STORE"] = os.environ.get("STORE", "")
else: # Configuration file usage
exe: Path = Path(env["EXE"]).expanduser()
env["EXE"] = str(exe)
env["STEAM_COMPAT_INSTALL_PATH"] = str(exe.parent)

env["STORE"] = os.environ.get("STORE") or ""
env["STORE"] = env.get("STORE", "")

# UMU_ID
env["UMU_ID"] = env["GAMEID"]
Expand Down
4 changes: 0 additions & 4 deletions umu/umu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,6 @@ def test_set_env_winetricks(self):
os.environ["WINEPREFIX"] = self.test_file
os.environ["PROTONPATH"] = test_dir.as_posix()
os.environ["GAMEID"] = test_str
os.environ["STORE"] = test_str
os.environ["PROTON_VERB"] = proton_verb
# Args
result = umu_run.parse_args()
Expand Down Expand Up @@ -1963,9 +1962,6 @@ def test_set_env_winetricks(self):
Path(path_exe).parent.as_posix(),
"Expected STEAM_COMPAT_INSTALL_PATH to be set",
)
self.assertEqual(
self.env["STORE"], test_str, "Expected STORE to be set"
)
self.assertEqual(
self.env["PROTONPATH"],
Path(path_exe).parent.parent.as_posix(),
Expand Down
7 changes: 7 additions & 0 deletions umu/umu_test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,15 @@ def test_set_env_toml_paths(self):
def test_set_env_toml_opts(self):
"""Test set_env_toml when passed a string as a launch argument."""
test_toml = "foo.toml"
test_store = "gog"
toml_str = f"""
[umu]
prefix = "{self.test_file}"
proton = "{self.test_file}"
game_id = "{self.test_file}"
launch_args = "{self.test_file} {self.test_file}"
exe = "{self.test_exe}"
store = "{test_store}"
"""
toml_path = self.test_file + "/" + test_toml
result = None
Expand Down Expand Up @@ -708,6 +710,11 @@ def test_set_env_toml_opts(self):
self.assertEqual(
self.env["GAMEID"], self.test_file, "Expected GAMEID to be set"
)
self.assertEqual(
self.env["STORE"],
"gog",
f"Expected STORE to be '{test_store}'",
)

def test_set_env_toml(self):
"""Test set_env_toml."""
Expand Down

0 comments on commit 785bcce

Please sign in to comment.