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

[CR] Camp calorie test #68127

Merged
merged 8 commits into from
Oct 26, 2023
Merged

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented Sep 13, 2023

Summary

None

Purpose of change

Camps are woefully underserved by our test suite.

Describe the solution

Make tests for things that have caused issues in the past and could come up again (e.g. #50805)

Describe alternatives you've considered

Let someone else write the tests? Hasn't worked so far!

Testing

This runs and works locally, both as an individual test, running just those two tests(this one and EOC_transform_radius) together, and running the whole suite.

Additional context

Ran into some problems with test ordering, see comments.

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Player Faction Base / Camp All about the player faction base/camp/site astyled astyled PR, label is assigned by github actions labels Sep 13, 2023
data/mods/TEST_DATA/items.json Outdated Show resolved Hide resolved
data/mods/TEST_DATA/items.json Outdated Show resolved Hide resolved
@RenechCDDA
Copy link
Member Author

I cannot get the character to craft, and I do not know why. I haven't pushed these commits but I've tried:
Giving the items directly to their inventory
Giving them a debug backpack to make sure they have space
Checking they did in fact get the component items (they did)

Any help would be appreciated.

@RenechCDDA RenechCDDA marked this pull request as ready for review September 13, 2023 23:31
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Sep 14, 2023
@PatrikLundell
Copy link
Contributor

PatrikLundell commented Sep 14, 2023

I don't know anything about the testing stuff, so it might not be any help...

Edit: Replaced what was below with something that might be less incorrect.

My interpretation of the code is that it starts crafting and verified the in process craft is wielded. It then just advances the time, but doesn't make any call that would actually cause the crafting to finalize.

@RenechCDDA
Copy link
Member Author

I don't know anything about the testing stuff, so it might not be any help...

Edit: Replaced what was below with something that might be less incorrect.

My interpretation of the code is that it starts crafting and verified the in process craft is wielded. It then just advances the time, but doesn't make any call that would actually cause the crafting to finalize.

It actually did try to start the craft, it just repeatedly refused to acknowledge that the character had components on hand. It was very bizarre.

Regardless, I have abandoned the "actually craft it" approach in favor of just inserting the components into the item via code.

@RenechCDDA
Copy link
Member Author

Aaaand it's not playing well on CI. Worked fine on my machine!

This is going to be an annoying one, isn't it?

tests/faction_camp_test.cpp Outdated Show resolved Hide resolved
tests/faction_camp_test.cpp Outdated Show resolved Hide resolved
tests/faction_camp_test.cpp Outdated Show resolved Hide resolved
@RenechCDDA RenechCDDA marked this pull request as draft September 14, 2023 22:21
@RenechCDDA
Copy link
Member Author

RenechCDDA commented Sep 14, 2023

I assumed that the failure to place items into zone_loc was possibly due to it being unloaded (player character not necessarily in the same map, although weird that it works reliably on my machine). Setting the player's pos was supposed to resolve that, but clearly it hasn't.... I wonder if this a test ordering issue?

edit: ok yes, it does error out on my machine when I run the full test suite. So, most likely an ordering issue. Drat

@ehughsbaird
Copy link
Contributor

With #68154 figured out, it's a conflict with the EOC_transform_radius test. tests/cata_test "EOC_transform_radius,camp_calorie_counting" will consistently reproduce it.

@RenechCDDA
Copy link
Member Author

Looks like it specifically places the player out of bounds during that test, yeah. I am open to suggestions on how to resolve this that isn't "Just run the faction camp test first".

@ehughsbaird
Copy link
Contributor

ehughsbaird commented Sep 15, 2023

If that's what's happening, that test should probably place the player back in bounds (do this), or this test should place the player inbounds first (leaving that test to potentially break other tests).

@RenechCDDA
Copy link
Member Author

That does sound like a fine solution when I think about it hah. I'll poke it sometime today.

@RenechCDDA RenechCDDA marked this pull request as ready for review September 16, 2023 02:05
@RenechCDDA
Copy link
Member Author

Ok so this runs and works locally, both as an individual test, running just those two tests together, and running the whole suite (sans the expected translation failures).

But I would appreciate a second look so it doesn't look like I'm doing something really nuts.

tests/eoc_test.cpp Outdated Show resolved Hide resolved
tests/eoc_test.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 16, 2023
tests/eoc_test.cpp Outdated Show resolved Hide resolved
@RenechCDDA
Copy link
Member Author

OK, so now it consistently passes on windows and consistently fails on... whatever the GCC 9, Curses, LTO step runs.

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Oct 17, 2023
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Oct 21, 2023
tests/eoc_test.cpp Outdated Show resolved Hide resolved
@kevingranade kevingranade merged commit 614dd41 into CleverRaven:master Oct 26, 2023
@RenechCDDA RenechCDDA deleted the faction_camp_tests branch October 26, 2023 13:58
Maleclypse pushed a commit to Maleclypse/Cataclysm-DDA that referenced this pull request Nov 16, 2023
* Camp calorie test

* Pare it down and just access the item's components directly
---------
Co-authored-by: ehughsbaird <44244083+ehughsbaird@users.noreply.github.com>
Co-authored-by: David Seguin <davidseguin@live.ca>
Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants