Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: guy != nullptr randomly failing #73352

Open
NetSysFire opened this issue Apr 28, 2024 · 3 comments
Open

Tests: guy != nullptr randomly failing #73352

NetSysFire opened this issue Apr 28, 2024 · 3 comments
Labels
<Bug> This needs to be fixed [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Help Wanted Not particularly urgent or easy (see Good First Issue for this), but help is appreciated with this!

Comments

@NetSysFire
Copy link
Member

NetSysFire commented Apr 28, 2024

Describe the bug

In all listed cases are also some armor display tests failing and this may be related.
This specific random failure appears to be comparatively rare.

Unfortunately I lack the privileges in this repo to search through all workflow logs but I feel like I have seen this before. Can't prove it with additional links though.

Attach save file

Steps to reproduce

  1. Run tests.
  2. Win the rng lottery.
  3. Witness above failure.

Expected behavior

guy != nullptr

Screenshots

No response

Versions and configuration

n/a

Additional context

No response

@NetSysFire NetSysFire added <Bug> This needs to be fixed Code: Tests Measurement, self-control, statistics, balancing. labels Apr 28, 2024
@osuphobia
Copy link
Contributor

@osuphobia
Copy link
Contributor

osuphobia commented Apr 28, 2024

Ahh, a possibility struck me.

/* Test setup. Player should always be at top-left.
*
* U is the player, V is vehicle, # is wall, R is rubble & acid with NPC on it,
* A is acid with NPC on it, W/M is vehicle & acid with (follower/non-follower) NPC on it,
* B/C is acid with (follower/non-follower) NPC on it.
*/
static constexpr int height = 5, width = 17;
// NOLINTNEXTLINE(cata-use-mdarray,modernize-avoid-c-arrays)
static constexpr char setup[height][width + 1] = {
"U ###############",
"V #R#AAA#W# # #C#",
" #A#A#A# #M#B# #",
" ###AAA#########",
" ##### ",
};

The test case check_npc_movement is checking if NPC escapes from dangerous terrains.
W/M is vehicle & acid with (follower/non-follower) NPC on it suggests that you need NPC to spawn in a car.
shared_ptr_fast<npc> guy = make_shared_fast<npc>();
do {
guy->normalize();
guy->randomize();
// Repeat until we get an NPC vulnerable to acid
} while( guy->is_immune_field( fd_acid ) );
guy->spawn_at_precise( tripoint_abs_ms( get_map().getabs( p ) ) );

And it's repeating randomization to get a character vulnerable to acid.
If i guess it right, it is a randomized character that is too big/tall to stay in the car?

@NetSysFire NetSysFire added [C++] Changes (can be) made in C++. Previously named `Code` Help Wanted Not particularly urgent or easy (see Good First Issue for this), but help is appreciated with this! labels May 2, 2024
@NetSysFire
Copy link
Member Author

CC @Qrox, since you appear to have added this back in #25297 and may know whats going on here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Help Wanted Not particularly urgent or easy (see Good First Issue for this), but help is appreciated with this!
Projects
None yet
Development

No branches or pull requests

2 participants