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

Refactor some tests to be only run under serial execution #376

Merged
merged 4 commits into from
Nov 4, 2023

Conversation

PhilipDeegan
Copy link
Member

@PhilipDeegan PhilipDeegan commented Nov 2, 2020

#358

not sure it's all the tests that could be "serialized" but it would probably make the mpi_tests quicker if it was merged as is

Summary by CodeRabbit

  • Refactor
    • Updated several test setup procedures to run without the need for MPI (Message Passing Interface), enhancing the flexibility and speed of test execution.
  • New Feature
    • Introduced a Python script test_coarsen_field.py to be run before the build, improving the build process.
  • Refactor
    • Implemented new functions for setting up and adding tests in the field refinement area, streamlining the test addition process.
  • Test
    • Added two new tests, test_field_refinement_on_hierarchy and test_field_refine, to improve the robustness of the software.
  • Test
    • Updated the test execution framework in test_field_refinement_on_hierarchy.cpp to use Google Test, enhancing the reliability and readability of test results.

@PhilipDeegan PhilipDeegan changed the title AMR Field Refine: extract some tests to be only run under serial execution Refactor some tests to be only run under serial execution Nov 2, 2020
@PhilipDeegan PhilipDeegan force-pushed the serial-ize branch 3 times, most recently from 3ff2bd4 to bc4add0 Compare March 9, 2021 09:42
@PhilipDeegan PhilipDeegan deleted the serial-ize branch March 31, 2021 07:43
@PhilipDeegan PhilipDeegan restored the serial-ize branch April 27, 2021 11:06
@PhilipDeegan PhilipDeegan reopened this Apr 27, 2021
@PhilipDeegan PhilipDeegan force-pushed the serial-ize branch 2 times, most recently from 92659d9 to 2a412d5 Compare April 29, 2021 12:40
Copy link
Member

@nicolasaunai nicolasaunai left a comment

Choose a reason for hiding this comment

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

rebase please

Copy link
Member

@nicolasaunai nicolasaunai left a comment

Choose a reason for hiding this comment

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

I don't know why this has waited so long.
I think it's to merge, do you @PhilipDeegan?

@PhilipDeegan
Copy link
Member Author

I don't know why this has waited so long. I think it's to merge, do you @PhilipDeegan?

not exactly proriotiy, rebase to master then merge

@coderabbitai
Copy link

coderabbitai bot commented Oct 17, 2023

Walkthrough

Walkthrough

The changes primarily involve modifications to the CMakeLists.txt files across various directories in the project. The key change is the replacement of the add_phare_test function with add_no_mpi_phare_test, suggesting a shift towards tests that do not require MPI. Additionally, new functions and tests are added in the field refinement section, and a Python script is set to run before the build in the field coarsening section.

Changes

File(s) Summary
tests/amr/data/field/coarsening/CMakeLists.txt A new custom command is added to run a Python script before the build. The add_phare_test function is replaced with add_no_mpi_phare_test.
tests/amr/data/field/overlap/CMakeLists.txt, tests/amr/data/field/time_interpolate/CMakeLists.txt, tests/amr/data/field/variable/CMakeLists.txt, tests/amr/data/particles/copy/CMakeLists.txt, tests/amr/data/particles/copy_overlap/CMakeLists.txt The add_phare_test function is replaced with add_no_mpi_phare_test in these CMakeLists.txt files.
tests/amr/data/field/refine/CMakeLists.txt Two new functions are added to set up and add tests for AMR field refinement. Two new tests are added using these functions.
tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp A main function is added to initialize and shut down the SAMRAI framework, run all the tests using Google Test, and return the test result.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 3a8b85e and 5e75d20.
Files selected for processing (8)
  • tests/amr/data/field/coarsening/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/overlap/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/refine/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (1 hunks)
  • tests/amr/data/field/time_interpolate/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/variable/CMakeLists.txt (1 hunks)
  • tests/amr/data/particles/copy/CMakeLists.txt (1 hunks)
  • tests/amr/data/particles/copy_overlap/CMakeLists.txt (1 hunks)
Files skipped from review due to trivial changes (4)
  • tests/amr/data/field/time_interpolate/CMakeLists.txt
  • tests/amr/data/field/variable/CMakeLists.txt
  • tests/amr/data/particles/copy/CMakeLists.txt
  • tests/amr/data/particles/copy_overlap/CMakeLists.txt
Additional comments (Suppressed): 7
tests/amr/data/field/coarsening/CMakeLists.txt (1)
  • 38-38: The function add_phare_test has been replaced with add_no_mpi_phare_test. Ensure that this change does not affect the execution of the test suite and that the new function is defined and works as expected.
tests/amr/data/field/overlap/CMakeLists.txt (1)
  • 33-33: The function add_phare_test has been replaced with add_no_mpi_phare_test. Ensure that this change is intentional and that the test does not require MPI support. If MPI support is required, consider creating a separate function for tests that require MPI.
- add_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
+ add_no_mpi_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (1)
  • 135-152: The new main function initializes the Google Test framework and the SAMRAI framework, runs all tests, and then shuts down the frameworks. This is a standard setup for a test suite using these frameworks. However, ensure that the initialization and shutdown of the SAMRAI framework does not interfere with other tests or parts of the application that may also be using SAMRAI.
tests/amr/data/field/refine/CMakeLists.txt (4)
  • 18-34: The function _setup_amr_field_refine_test is a good abstraction that encapsulates the common setup for the tests. It improves the modularity and maintainability of the code.

  • 37-40: The function _add_general_amr_field_refine_test wraps the setup and addition of a test that requires MPI. This function improves the readability of the code and makes it easier to add new tests in the future.

  • 42-45: The function _add_serial_amr_field_refine_test wraps the setup and addition of a test that does not require MPI. This function improves the readability of the code and makes it easier to add new tests in the future.

  • 48-49: Ensure that the tests test_field_refinement_on_hierarchy and test_field_refine are correctly categorized as requiring MPI and not requiring MPI, respectively. Misclassification could lead to test failures or incorrect test results.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between baf4698 and 9171647.
Files selected for processing (8)
  • tests/amr/data/field/coarsening/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/overlap/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/refine/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (1 hunks)
  • tests/amr/data/field/time_interpolate/CMakeLists.txt (1 hunks)
  • tests/amr/data/field/variable/CMakeLists.txt (1 hunks)
  • tests/amr/data/particles/copy/CMakeLists.txt (1 hunks)
  • tests/amr/data/particles/copy_overlap/CMakeLists.txt (1 hunks)
Files skipped from review due to trivial changes (1)
  • tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp
Additional comments: 10
tests/amr/data/particles/copy_overlap/CMakeLists.txt (1)
  • 24-27: The change from add_phare_test to add_no_mpi_phare_test indicates that the test no longer requires MPI. Ensure that this is the intended behavior and that the test still functions correctly without MPI.
tests/amr/data/field/time_interpolate/CMakeLists.txt (1)
  • 18-21: The change from add_phare_test to add_no_mpi_phare_test suggests that the test does not require MPI. Ensure that this is the case and that all necessary changes have been made to the test to accommodate this.
tests/amr/data/field/coarsening/CMakeLists.txt (1)
  • 34-38: The new custom command ensures that the Python script test_coarsen_field.py is run before the build of the target. This is a good practice for generating any necessary data or performing checks before the build process. However, ensure that the Python script does not have any side effects that could affect the build process or other tests. Also, verify that the Python script runs successfully in the build environment.
tests/amr/data/field/variable/CMakeLists.txt (1)
  • 23-26: The change from add_phare_test to add_no_mpi_phare_test indicates that the test no longer requires MPI. Ensure that this is the intended behavior and that the test still functions correctly without MPI.
- add_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
+ add_no_mpi_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
tests/amr/data/particles/copy/CMakeLists.txt (1)
  • 24-27: The change from add_phare_test to add_no_mpi_phare_test indicates that the test no longer requires MPI. Ensure that this is the intended behavior and that the test still functions correctly without MPI.
- add_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
+ add_no_mpi_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
tests/amr/data/field/overlap/CMakeLists.txt (1)
  • 30-34: The change from add_phare_test to add_no_mpi_phare_test indicates that the test no longer requires MPI. Ensure that this is the intended behavior and that the test still functions correctly without MPI.
- add_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
+ add_no_mpi_phare_test(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
tests/amr/data/field/refine/CMakeLists.txt (4)
  • 18-34: The function _setup_amr_field_refine_test is well defined and modular. It sets up the test by adding an executable, setting the include directories, and linking the necessary libraries. This function is reused in _add_general_amr_field_refine_test and _add_serial_amr_field_refine_test which is a good practice.

  • 37-40: The function _add_general_amr_field_refine_test sets up the test and adds it as a general test. It's clear and concise.

  • 42-45: The function _add_serial_amr_field_refine_test sets up the test and adds it as a serial test. It's clear and concise.

  • 48-49: The new tests test_field_refinement_on_hierarchy and test_field_refine are added correctly using the new functions. Ensure that these tests are running and passing as expected.

@PhilipDeegan PhilipDeegan merged commit 1a7a04b into PHAREHUB:master Nov 4, 2023
PhilipDeegan added a commit to PhilipDeegan/PHARE that referenced this pull request Nov 30, 2023
* AMR Field Refine: extract some tests to be only run under serial execution
* AMR Field Overlap: refactor tests to be only run under serial execution
* AMR Field Time Interpolate: refactor tests to be only run under serial execution
* AMR: rm tests from MPI suite
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