krypt0nn / wincompatlib

Set of interfaces to run windows applications on unix-like systems using Wine written on :crab: Rust
MIT License
9 stars 4 forks source link

Unit tests - failing. #2

Open shymega opened 1 month ago

shymega commented 1 month ago

I've been trying to get started with this library for my Proton helper (DeckCheatz), and started off using the Proton unit test as a derivation for prototyping DeckCheatz.

However, it did not start Notepad.

I then went to this repo, to make sure the unit tests worked in the original. They do not. I get the following trace:

cargo test --features=all
   Compiling wincompatlib v0.7.4 (/home/dzr/projects/git.shymega.org.uk/DeckCheatz/wincompatlib)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 1.41s
     Running unittests src/lib.rs (target/debug/deps/wincompatlib-74a348e3abb8f3a2)

running 8 tests
test tests::dxvk::apply_dxvk ... FAILED
test tests::proton::create_prefix ... FAILED
test tests::fonts::install_all_fonts ... FAILED
test tests::proton::proton_version ... FAILED
test tests::proton::run_and_kill_notepad ... FAILED
test tests::wine::create_prefix ... FAILED
test tests::wine::run_and_kill_notepad ... FAILED
test tests::wine::wine_version ... FAILED

failures:

---- tests::dxvk::apply_dxvk stdout ----
Error: No such file or directory (os error 2)

---- tests::proton::create_prefix stdout ----
thread 'tests::proton::create_prefix' panicked at src/tests/proton.rs:63:5:
assertion failed: wine_prefix.join("drive_c/windows/system32/drivers").exists()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- tests::fonts::install_all_fonts stdout ----
Error: No such file or directory (os error 2)

---- tests::proton::proton_version stdout ----
thread 'tests::proton::proton_version' panicked at src/tests/proton.rs:49:5:
assertion `left == right` failed
  left: ""
 right: "wine-7.0 (Staging)\n"

---- tests::proton::run_and_kill_notepad stdout ----
thread 'tests::proton::run_and_kill_notepad' panicked at src/tests/proton.rs:92:5:
assertion failed: notepad.wait_with_output()?.status.success()

---- tests::wine::create_prefix stdout ----
thread 'tests::wine::create_prefix' panicked at src/tests/wine.rs:65:5:
assertion failed: get_prefix_dir().join("drive_c/windows/system32/drivers").exists()

---- tests::wine::run_and_kill_notepad stdout ----
thread 'tests::wine::run_and_kill_notepad' panicked at src/tests/wine.rs:91:5:
assertion failed: notepad.wait_with_output()?.status.success()

---- tests::wine::wine_version stdout ----
thread 'tests::wine::wine_version' panicked at src/tests/wine.rs:52:5:
assertion `left == right` failed
  left: ""
 right: "wine-5.12-15713-ga2b2801a91f (Staging)\n"

failures:
    tests::dxvk::apply_dxvk
    tests::fonts::install_all_fonts
    tests::proton::create_prefix
    tests::proton::proton_version
    tests::proton::run_and_kill_notepad
    tests::wine::create_prefix
    tests::wine::run_and_kill_notepad
    tests::wine::wine_version

test result: FAILED. 0 passed; 8 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.37s

error: test failed, to rerun pass `--lib`

Is the crate due for a update? It's perfect for my needs, and I'd love to help out.

krypt0nn commented 1 month ago

Will try to check this out today.

krypt0nn commented 1 month ago

Was trying to debug the tests but my impressive nixos setup doesn't let me to do this on the laptop due to some distro's quirks. If you can do this yourself - will be nice to get a PR (though I won't be able to test it myself), otherwise you need to wait until I come back home around August 1st.

Code didn't change for all this time and tested wine/proton/dxvk versions are hard-coded, so I doubt something could break. I don't deny it, anything could happen for sure, I just doubt.

UPD: if you ran the tests just once - I recommend running them again (and maybe again-again, you got it) because although I've tried to make tests run in the correct order sometimes DXVK applying could be tested before prefix creation, and so on, which indeed would cause it to fail.

shymega commented 1 month ago

Hey, I use NixOS too! I wrote a Flake using devenv and flake-parts for this repository, which I use if you want to see.

I don't think it's a download error, but I'm having issues with the same API calls in the test on my DeckCheatz branch.

I can wait for you to get back, I'm doing many things at the moment. But wincompatlib has saved me a lot of time for my Steam Play tool. Maybe we could discuss the project further over email? I found the docs a bit lacking - which is understandable, as it's a one-person project, I think?

krypt0nn commented 1 month ago

If you're on nixos too - make sure to use a FHS (I personally use steam-run on my desktop). Without that wine can't run, so obviously the lib will not work.

And about the docs - I thought there's enough of them. Perhaps you're looking at the project's readme which is intended to cover only basic features to bait a person to use the library. The docs themselves, as with all the rust projects, are automatically parsed and hosted by the docs.rs website.

shymega commented 1 month ago

If you're on nixos too - make sure to use a FHS (I personally use steam-run on my desktop). Without that wine can't run, so obviously the lib will not work.

I've just refactored your Flake to create an FHSUserEnv for the devShell. I'll open a PR in a sec.

And about the docs - I thought there's enough of them. Perhaps you're looking at the project's readme which is intended to cover only basic features to bait a person to use the library. The docs themselves, as with all the rust projects, are automatically parsed and hosted by the docs.rs website.

Yeah, I was thinking of the README. Some examples on the Proton side of things would be handy. I may be able to open a PR for more docs.

Would you be able to enable Discussions on this repository? I feel like my questions for the usage of my Steam Play tool on the Proton side of things do not belong as a bug report.

krypt0nn commented 1 month ago

I don't feel it right to use github for discussing projects and either telegram or discord would be better at least because I don't have a habit of reading github issues, but I can enable discussions if it's needed.

Was your problem solved by the PR?

shymega commented 1 month ago

Sure, Telegram or Discord works. I'm '@shymega' on both.

The PR didn't solve it, but I'm going to try in a FHS-compliant container shortly.

krypt0nn commented 1 month ago

Was able to run the tests today. With slightly changed version of your FHS integration I was able to pass 50% of tests, failed ones are run notepad, install fonts and dxvk - all of them require to launch some binary. Moreover rust-analyzer stopped working because your FHS doesn't provide cc binary, and I suppose some others as well. Anyway your problem was with lack of FHS and it's 99.9% is not related to this library.

shymega commented 1 month ago

Righto. I'm having a look at your Flake now. What I need to achieve - ideally - is using Proton located in steamapps, launch say, notepad.exe in a Proton prefix steamapps/compatdata/$ID, or initialise the prefix. That sort of thing.