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

testsuite: use TAP for unit tests #87

Merged
merged 11 commits into from
Jan 25, 2024
Merged

Conversation

garlick
Copy link
Member

@garlick garlick commented Jan 25, 2024

Problem: there is no real framework for unit tests in powerman

Relocate unit tests from the top level test directory to a test subdirectory co-located with the relevant source.
Pull in the automake TAP driver and libtap.
Convert two unit tests that were just calling assert() on failure to use TAP format.

This is on top of #86

@garlick
Copy link
Member Author

garlick commented Jan 25, 2024

Fixed a distcheck problem and rebased on current master.

Copy link
Member

@chu11 chu11 left a comment

Choose a reason for hiding this comment

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

LGTM!

@chu11
Copy link
Member

chu11 commented Jan 25, 2024

@Mergifyio rebase

Copy link
Contributor

mergify bot commented Jan 25, 2024

rebase

✅ Branch has been successfully rebased

@chu11
Copy link
Member

chu11 commented Jan 25, 2024

@Mergifyio rebase

Problem: the test/tpm script has no users.

Drop script.
Problem: vpcd is a test program but it is installed.

Don't install it or its device script.
Problem: the test suite sets TEST_ETC in the test environment
but nothing uses it.

Drop TEST_ETC from the test environment.
Problem: the argv unit test lives in the test subdirectory
with a custom driver.

Move it to the libcommon directory, near the source it is testing.
Have 'make check' run it directly.
Problem: pluglist class is only used by powerman yet it
resides in libcommon.

Move pluglist to the powerman directory.
Move the pluglist unit test to the powerman directory, but
leave its driver in the top test directory for now.
Problem: the xregex unit test lives in the test subdirectory
with a custom driver.

Move it to the libcommon directory, near the source it is testing.
Have 'make check' run it directly.
Problem: the API client test program lives in the top level
test directory, but it would be usefully co-located with the
source code that it tests.

Move test/cli.c to src/powerman/test/apiclient.c.
Update test driver in the top level test directory.
Problem: unit testing is required for some small classes
used in powerman.

Pull in libtap (via the flux-pmix project), originally from
https://github.com/zorgnax/libtap
Problem: TAP output is not interpreted by 'make check'.

Prepare to add TAP tests by adding the automake TAP driver.
Problem: argv unit test just asserts on failure.

Convert it to a libtap unit test and run it with the TAP driver.
Rename executable with .t suffix to indicate that it's a TAP test.
Problem: xregex unit test just asserts on failure.

Convert it to a libtap unit test and run it with the TAP driver.
Rename executable with .t suffix to indicate that it's a TAP test.
Copy link
Contributor

mergify bot commented Jan 25, 2024

rebase

✅ Branch has been successfully rebased

@mergify mergify bot merged commit adf94a9 into chaos:master Jan 25, 2024
8 checks passed
@garlick garlick mentioned this pull request Jan 25, 2024
@garlick garlick deleted the tap_unit_tests branch January 25, 2024 20:20
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.

2 participants