Skip to content

Update deps + parameterized test support#548

Open
mattdurak wants to merge 8 commits intomasterfrom
parameterized_tests
Open

Update deps + parameterized test support#548
mattdurak wants to merge 8 commits intomasterfrom
parameterized_tests

Conversation

@mattdurak
Copy link
Contributor

Updates c-testrunnerswitcher submodule to master, bringing in PARAMETERIZED_TEST_FUNCTION macro support.

Changes:

  • deps/c-testrunnerswitcher: Updated to master (48b0066) which adds PARAMETERIZED_TEST_FUNCTION macro
  • gballoc_hl_metrics_ut: Refactored 6 near-identical tests into 2 parameterized tests:
    • 3 malloc tests (varying alloc size + timer values) → 1 PARAMETERIZED_TEST_FUNCTION with 3 CASEs
    • 3 realloc-NULL-ptr tests (varying alloc size) → 1 PARAMETERIZED_TEST_FUNCTION with 3 CASEs
  • Net reduction: ~170 lines of duplicated test code

- Update deps/c-testrunnerswitcher to master (adds PARAMETERIZED_TEST_FUNCTION support)
- Refactor 3 gballoc_hl_malloc tests into 1 PARAMETERIZED_TEST_FUNCTION (varying alloc size and timer values)
- Refactor 3 gballoc_hl_realloc NULL-ptr tests into 1 PARAMETERIZED_TEST_FUNCTION (varying alloc size)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mattdurak and others added 3 commits March 10, 2026 14:09
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…llback tests

Refactor 8 identical notify event tests in async_socket_linux_ut.c into
a single PARAMETERIZED_TEST_FUNCTION with 3 parameters (io_type,
epoll_action, expected_result) and 8 cases.

Refactor 6 identical on_file_io_complete_win32 callback tests in
file_win32_ut.c into a single PARAMETERIZED_TEST_FUNCTION with 4
parameters (io_type, io_result, num_bytes_transferred,
expected_success) and 6 cases.

Net reduction: 333 lines removed, 26 added.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattdurak
Copy link
Contributor Author

mattdurak commented Mar 11, 2026

Parameterized Test Conversion Review — PR #548

Files with PARAMETERIZED_TEST_FUNCTION conversions

1. common/tests/tqueue_ut/tqueue_ut.c — ✅ PASS

  • 11 TEST_FUNCTIONs deleted → 4 PARAMETERIZED_TEST_FUNCTIONs with correct CASEs.
  • All deleted tests accounted for. No tests dropped.
  • SRS comments are correctly deduplicated and placed above each PTF.
  • Helper functions (test_TQUEUE_PUSH_when_entry_state_is_different_than_NOT_USED_tries_again, test_TQUEUE_POP_when_entry_state_is_different_than_USED_tries_again) are deleted and logic is inlined.
  • No // no-srs issues.

2. linux/tests/async_socket_linux_ut/async_socket_linux_ut.c⚠️ ISSUE

  • 8 TEST_FUNCTIONs deleted → 1 PARAMETERIZED_TEST_FUNCTION with 8 CASEs. All deleted tests accounted for.
  • Helper function logic inlined correctly.
  • SRS issue (line 1862): Tests_SRS_ASYNC_SOCKET_LINUX_04_012 was added to this PTF, but it was NOT present on any of the 8 original TEST_FUNCTIONs being replaced. On master, SRS 04_012 reads "If async_socket is NULL, async_socket_notify_io_async shall fail and return a non-zero value" (a different requirement on a different test). On this branch, it reads "event_complete_callback shall call the notify complete callback with an ABANDONED flag...", which duplicates the text of SRS 04_008. This appears to be either a copy-paste error in the SRS number or an incorrectly redefined SRS requirement. Recommend removing line 1862.

3. win32/tests/file_win32_ut/file_win32_ut.c — ✅ PASS

  • 6 TEST_FUNCTIONs deleted → 1 PARAMETERIZED_TEST_FUNCTION with 6 CASEs. All deleted tests accounted for.
  • SRS comments (43_034, 43_066, 43_068) correctly deduplicated and placed above the PTF.
  • No helper function issues.

4. win32/tests/gballoc_hl_metrics_ut/gballoc_hl_metrics_ut.c — ✅ PASS

  • 6 TEST_FUNCTIONs deleted → 2 PARAMETERIZED_TEST_FUNCTIONs (3 malloc CASEs, 3 realloc CASEs). All deleted tests accounted for.
  • SRS comments correctly deduplicated:
    • malloc PTF: 02_001, 01_028, 01_007, 01_029, 01_043, 01_044, 01_045, 01_042 ✅
    • realloc PTF: 02_003, 01_032, 01_013, 01_033, 01_058, 01_059, 01_060, 01_061 ✅
  • Test logic correctly parameterized inline.

Files with only // no-srs removal (no PTF conversions)

These 4 files had // no-srs removed from existing TEST_FUNCTIONs that were not converted to PARAMETERIZED_TEST_FUNCTIONs:

File TEST_FUNCTIONs affected
common/tests/real_thandle_helper_ut/real_thandle_helper_ut.c thandle_test_helper_can_register_for_a_real_thandle, function_call_is_mocked_correctly
common/tests/real_thandle_log_context_handle_ut/real_thandle_log_context_handle_ut.c thandle_ptr_log_context_handle_with_mocks
linux/tests/linux_reals_ut/reals_linux_ut.c check_all_c_pal_reals
win32/tests/reals_win32_ut/reals_win32_ut.c check_all_c_pal_reals

These tests genuinely have no SRS requirements — they are infrastructure/sanity checks. Removing // no-srs without adding SRS comments leaves these tests without either marker. Consider keeping // no-srs or adding appropriate SRS comments, unless the convention is changing project-wide.


Summary

Check Result
Every CASE matches a deleted TEST_FUNCTION ✅ All 31 deleted TEST_FUNCTIONs → 31 CASEs across 8 PTFs
No tests dropped ✅ All accounted for
SRS comments deduplicated & placed correctly ⚠️ 1 issue: extraneous SRS 04_012 in async_socket_linux_ut.c
No inappropriate // no-srs added ✅ None added
Helper functions inlined & deleted ✅ All verified
// no-srs removals from non-converted tests ℹ️ 4 files — see table above

…n-parameterized tests

- Remove extraneous Tests_SRS_ASYNC_SOCKET_LINUX_04_012 comment from async_socket_linux_ut.c
- Restore // no-srs on TEST_FUNCTIONs in real_thandle_helper_ut.c, real_thandle_log_context_handle_ut.c, reals_linux_ut.c, reals_win32_ut.c

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattdurak
Copy link
Contributor Author

mattdurak commented Mar 11, 2026

Fixed: removed extraneous SRS comment (Tests_SRS_ASYNC_SOCKET_LINUX_04_012), restored // no-srs on non-parameterized tests in real_thandle_helper_ut.c, real_thandle_log_context_handle_ut.c, reals_linux_ut.c, reals_win32_ut.c #Closed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattdurak mattdurak marked this pull request as ready for review March 11, 2026 21:53
@mattdurak
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattdurak
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mattdurak
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

anporumb
anporumb previously approved these changes Mar 11, 2026
Copy link
Contributor

@anporumb anporumb left a comment

Choose a reason for hiding this comment

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

:shipit:

@mattdurak mattdurak enabled auto-merge (squash) March 11, 2026 22:38
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattdurak
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mattdurak
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants