Noxime / steamworks-rs

Rust bindings to the SteamWorks SDK
Apache License 2.0
321 stars 110 forks source link

cargo test not working, possible race condition #122

Open Flaise opened 1 year ago

Flaise commented 1 year ago

With a fresh update of the master branch, I ran cargo test to make sure everything downloaded properly:

✔ ~/projects/steamworks-rs [master|✔ ] 
09:28 $ git rev-parse HEAD
ffd355e58fbbe43d0dc617004b17441ffac91ee7

✔ ~/projects/steamworks-rs [master|✔ ] 
09:28 $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:    18.04
Codename:   bionic

✔ ~/projects/steamworks-rs [master|✔ ] 
09:28 $ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.05s
     Running unittests src/lib.rs (target/debug/deps/steamworks-3e33e261a815adfd)

running 15 tests
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 480
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197984333817 [API loaded no]
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/home/flaise/projects/steamworks-rs/target/debug/deps/steamworks-3e33e261a815adfd` (signal: 11, SIGSEGV: invalid memory reference)

✘ ~/projects/steamworks-rs [master|✔ ] 
09:28 $ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.06s
     Running unittests src/lib.rs (target/debug/deps/steamworks-3e33e261a815adfd)

running 15 tests
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 480
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197984333817 [API loaded no]
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
Installing breakpad exception handler for appid(steamworks-3e33e261a815adfd)/version(1.0)/tid(13681)
test networking_types::tests::test_allocate_and_free_message ... ok
test networking_types::tests::test_network_identity_ip ... ok
test networking_types::tests::test_network_identity_steam_id ... ok
test networking_types::tests::test_new_ip ... ok
test networking_types::tests::test_set_ipv4 ... ok
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
assert_20230325093111_3.dmp[13692]: Uploading dump (out-of-process)
/tmp/dumps/assert_20230325093111_3.dmp
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
test networking_sockets::tests::test_create_listen_socket_ip ... ok
test networking_sockets::tests::test_socket_connection ... FAILED
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
assert_20230325093111_3.dmp[13692]: Finished uploading minidump (out-of-process): success = no
assert_20230325093111_3.dmp[13692]: error: libcurl.so: cannot open shared object file: No such file or directory
assert_20230325093111_3.dmp[13692]: file ''/tmp/dumps/assert_20230325093111_3.dmp'', upload no: ''libcurl.so: cannot open shared object file: No such file or directory''
CreateFn failed for SteamUser021 User
CreateFn failed for SteamUser021 User
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/home/flaise/projects/steamworks-rs/target/debug/deps/steamworks-3e33e261a815adfd` (signal: 11, SIGSEGV: invalid memory reference)

Notice that I ran the same command twice with different results, which makes it look like the tests may be interfering with each other. But that's weird because you're already using serial_test::serial. Also weird is that the actual game I'm making that uses steamworks-rs still works even when I updated to 0.10.0, the same commit I'm getting failing tests on.

Do you know what went wrong here?

LZQCN commented 3 months ago

Try this:

cargo test --lib -- --test-threads=1