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

ON-15724: improve unit test consistency #20

Merged
merged 6 commits into from
May 31, 2024

Conversation

jfeather-amd
Copy link
Contributor

These changes improve the consistency of the unit tests, mainly those under the test_jenkins target.

The only test that still fails after this patchset is zftimestamping, but this appears to be fixed by #15. For now, I will keep these tests as part of the test_jenkins target until I'm more satisfied that these fixes work after getting more test exposure over time.

Testing Done

Repeated lots of iterations of make test and make test_jenkins to observe behaviour over time. Previously, the failing testscripts would fail every 10 or so runs of make test_jenkins but I have not observed a single failure in quite a lot of runs. This is a very hand-wavy testing done section, which is why I would like to observe these changes over time before committing to saying that these are fine.

@jfeather-amd jfeather-amd requested a review from a team as a code owner May 31, 2024 11:01
@jfeather-amd
Copy link
Contributor Author

Looks like zfstackdump is perhaps a github setup issue, so I'll look into what causes that.

Copy link
Contributor

@tcrawley-xilinx tcrawley-xilinx left a comment

Choose a reason for hiding this comment

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

Looks good! (except for the zfstackdump failure, which I think might be a ubuntu vs RHEL compat thing)

I think it would be good to verify it works in a jenkins pipeline before you merge.

In zfbonding_lacp, the interfaces known to zf emu are sometimes
reset by zeroing a large block of memory. This would also zero
the cplane mibs dimensions, including hwport_max. As a result,
subsequent tests would fail as no hardware ports existed.
Adding the testjenkins target meant that some tests were not given
the correct environments, and would therefore always fail. In this
change, zfstackdump is moved to its original test group as it was
not observed to fail. The remaining test, zftimestamping, came
from the testloop target, so the testjenkins target now takes
the environment from testloop to run this test.
Previously, all test scripts returned 0 regardless of the results as
many executables were run per script. This change exits with the
last failure code (or 0), and also makes sure the test target is
provided as an environment variable to be logged.
The pretest.sh script was supposed to be run before each test, but in
reality would only run once before kicking off a bunch of tests. For
example, `make test` would only run this script at the very start and
only a single time. By merging pretest.sh into netns.sh, we make sure
that the commands in the pretest.sh script are run before every test
target, and before every single test.
The test scripts invoke many applications that may each create a new
zf_emu state. Many of the back-to-back tests have had issues with
this state persisting and interfering with the tests, causing time
outs or other uncertain behaviour. This change deletes the shared
memory before and after every test to make sure no errors occur
as a result of persistent memory from previous tests.
Previously, we would redirect fd 1000 into egrep to get the output
of our stackdump, however, this didn't work on newer Ubuntu's and
perhaps others. Instead, we now rely on sysfs to correctly link
to our opened fds.

As supplementary changes, this now uses cat so the output is kept
for the sake of test logs, and grep -E to replace egrep as egrep
is becoming deprecated on some newer OSes.
@jfeather-amd
Copy link
Contributor Author

Latest push rebases to also include Andy's fix for timestamping and also fixes the issue with zfstackdump. Honestly not entirely sure why the old method didn't work, but I guess Ubuntu just wasn't a fan of taking input with <&1000 perhaps because that was only known to us and not the child process? Anyway, tested the new approach on Ubuntu 22.04 and RHEL 8.6, both seem happy.

@sianj-xilinx
Copy link
Collaborator

Honestly not entirely sure why the old method didn't work, but I guess Ubuntu just wasn't a fan of taking input with <&1000 perhaps because that was only known to us and not the child process?

We've seen things like this in the past where ubu defaulted to dash not bash. I haven't looked at the context, but that sort of this might be the case here.

@jfeather-amd jfeather-amd merged commit ace0b69 into Xilinx-CNS:master May 31, 2024
@jfeather-amd jfeather-amd deleted the ON-15724-2 branch May 31, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants