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

Fix #102, clean up sc_loads_test #103

Merged
merged 1 commit into from
Oct 10, 2023
Merged

Conversation

jphickey
Copy link
Contributor

Checklist (Please check before submitting)

Describe the contribution
Significant buffer management issues existed in many/all of these test cases and was causing stack corruption. Rewriting the test cases to better follow current recommended practices, and reduce repetition.

Fixes #102

Testing performed
Build and run sc_loads_test, confirm coverage is maintained

Expected behavior changes
No more stack overflow/smashing.

System(s) tested on
Debian

Additional context
Test case code reduced by about 40%, should be much easier to maintain going forward.

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

@skliper
Copy link
Contributor

skliper commented Sep 15, 2023

@jphickey - I already fixed all of this with #98. Whatever this commit is on doesn't seem in sync w/ main.

See my comment: #102 (comment)

Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a backwards step from #98 since it reintroduces local tables instead of initializing them in setup.

@jphickey
Copy link
Contributor Author

@jphickey - I already fixed all of this with #98. Whatever this commit is on doesn't seem in sync w/ main.

See my comment: #102 (comment)

Yep, I noticed that! You had already fixed the bulk of what I had noticed when trying to run this test - buffer overruns galore. I rebased my change.

My change is still worthwhile to consolidate a lot of the repeated logic and use more of the modern test macros - e.g. I also got rid of all remaining "UtAssert_True" checks in favor of the more targeted version.

@jphickey
Copy link
Contributor Author

I see that you instantiated the UT tables in unit-test/utilities/sc_test_utils.c ... I will update this to use those tables rather than an instance in the loads test file.

@skliper
Copy link
Contributor

skliper commented Sep 15, 2023

Your change now deviates from the pattern I employed for the rest of the SC tests, with the tables defined and initialized in the setup. I hadn't fixed the UtAssert_Trues which would be a good fix but I'd suggest sticking with the pattern established in #98 for the tables. After that, I had also consolidated some logic to avoid repeats... really hard to tell based on how this commit was done what's better vs just different since your change wasn't based off main to begin with. I'm not sure a step backwards from consistency employed for the other tests is helpful.

@jphickey
Copy link
Contributor Author

@skliper - not intending to take a "step backwards" -- I like the pattern there in #98 and will use it, its just that I was basing this off equuleus-rc1 tag that didn't have that rework yet (because this tag is what the stakeholder is using). Which is unfortunate - #98 (comment)

I will update this to use the shared table instances. That will cut down on repetition even more. I just wish we had merged that when you first put in the PR. Would have saved some duplicate work.

@jphickey jphickey marked this pull request as draft September 15, 2023 12:59
@jphickey jphickey removed the request for review from skliper September 15, 2023 13:00
@jphickey jphickey marked this pull request as ready for review September 20, 2023 19:08
@jphickey
Copy link
Contributor Author

@skliper -- What's left in here is basically consolidation of repeated code during init of the ATS/RTS tables. Should make the test cases easier to maintain going forward.

unit-test/sc_loads_tests.c Outdated Show resolved Hide resolved
@skliper
Copy link
Contributor

skliper commented Sep 21, 2023

@jphickey - great to see the UtAssert_True's go away also! Maybe that API could be deprecated some day.

@dzbaker
Copy link
Contributor

dzbaker commented Sep 21, 2023

CCB 21 September 2023: Provisionally approved pending re-review by @skliper.

@skliper
Copy link
Contributor

skliper commented Sep 21, 2023

@dzbaker - review is pending response to my previous comment

Major buffer overrun issues were already fixed, but this further cleans
up the test cases to avoid repetition and better follow current
recommended practices.
@jphickey
Copy link
Contributor Author

jphickey commented Oct 9, 2023

Updated based on @skliper review comment and rebased to resolve merge conflict. Should be good to go now.

Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great set of updates!

@dzbaker dzbaker merged commit 7587a8c into nasa:main Oct 10, 2023
17 checks passed
@jphickey jphickey deleted the fix-102-loads-test branch October 26, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stack smashing in AtsEntryOverflow test
3 participants