Skip to content

Convert test_pioc.cpp to C++ style targeting jayeshkrishna/async_thread_support#678

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/convert-test-pioc-style
Draft

Convert test_pioc.cpp to C++ style targeting jayeshkrishna/async_thread_support#678
Copilot wants to merge 3 commits intomasterfrom
copilot/convert-test-pioc-style

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

test_pioc.cpp used the legacy C test pattern (run_test_main, pio_test_init2, test_shared.cpp infrastructure). This converts it to the modern C++ test style used by other unit tests in the suite, targeting the jayeshkrishna/async_thread_support branch.

Changes

  • test_pioc.cpp: Style conversion to match test_spio_rearr_contig.cpp (the existing style reference in async_thread_support):

    • LOG_RANK0 macro, static const int FAIL = -1
    • test_driver(MPI_Comm, wrank, wsz, *num_errors) with try/catch wrapping of major test phases
    • main() directly initializes MPI (no more run_test_main)
    • Inlines run_tests_no_async() and run_tests_async() from test_shared.cpp, removing that dependency
    • Preserves async_thread_support-specific API changes: updated malloc_iodesc signature (extra arg), free(iodesc->map), free(iodesc->dimlen)
    • Fixed C++ incompatibilities: VLA float test_data[arraylen], uncasted malloc
  • CMakeLists.txt: Updates test_pioc to drop test_shared.cpp dependency (based on async_thread_support's CMakeLists).

Style pattern (new tests follow this structure)

int test_driver(MPI_Comm comm, int wrank, int wsz, int *num_errors) {
    int nerrs = 0, ret = PIO_NOERR;
    try { ret = test_foo(wrank); } catch(...) { ret = PIO_EINTERNAL; }
    if (ret != PIO_NOERR) { LOG_RANK0(wrank, "test_foo() FAILED\n"); nerrs++; }
    else                  { LOG_RANK0(wrank, "test_foo() PASSED\n"); }
    *num_errors += nerrs;
    return nerrs;
}

int main(int argc, char *argv[]) {
    MPI_Init(&argc, &argv);
    // ... rank/size setup ...
    test_driver(MPI_COMM_WORLD, wrank, wsz, &num_errors);
    MPI_Finalize();
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… remove test_pioc.c

Co-authored-by: jayeshkrishna <7873429+jayeshkrishna@users.noreply.github.com>
@jayeshkrishna
Copy link
Copy Markdown
Contributor

@copilot : Work on branch jayeshkrishna/async_thread_support instead of master

Copilot AI changed the title [WIP] Convert test_pioc.cpp to match test_spio_rearr_contig.cpp style Convert test_pioc.c to C++ style and add test_spio_rearr_contig.cpp Mar 11, 2026
… update api usage, remove test_spio_rearr_contig.cpp

Co-authored-by: jayeshkrishna <7873429+jayeshkrishna@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 11, 2026

@copilot : Work on branch jayeshkrishna/async_thread_support instead of master

Updated in commit 1c93511. The changes are now based on jayeshkrishna/async_thread_support:

  • test_pioc.cpp style conversion is applied on top of the async_thread_support version (preserving the updated malloc_iodesc signature with extra arg, free(iodesc->map), free(iodesc->dimlen))
  • test_spio_rearr_contig.cpp removed (already exists in async_thread_support for pio_rearr_contig.hpp)
  • CMakeLists.txt is now async_thread_support's version with only one change: test_shared.cpp removed from test_pioc (since the style conversion inlines those functions)

Copilot AI changed the title Convert test_pioc.c to C++ style and add test_spio_rearr_contig.cpp Convert test_pioc.cpp to C++ style targeting jayeshkrishna/async_thread_support Mar 11, 2026
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