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

(Closes 2311) Add functionality to derive module and subroutine names of adjoint test from filename for LFRic API #2749

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

DrTVockerodtMO
Copy link
Collaborator

@DrTVockerodtMO DrTVockerodtMO commented Oct 21, 2024

Closes #2311 which has a description of the problem.

Patch notes

I solved the problem by feeding the filename given to -otest down into the codebase. Here is a summary of the changes made across the relevant call tree:

src/psyclone/psyad/main.py
Changed the default value of this variable to be None. Added in the args.test_filename value to the call signature of generate_adjoint_str.

src/psyclone/psyad/tl2ad.py
Added new test_filename argument into call signature. I decided to add the conversion of the test_filename into the test_name variable here because I figured it would be API specific, so having it in the API selection telegraphs that nicely. Default value is just adjoint_test like the previous behaviour.

For the LFRic API, we take everything from test_filename before "_mod." to be the test_name.

src/psyclone/psyad/domain/lfric/lfric_adjoint_harness.py
Changed function to use test_name instead of the hardcoded value of "adjoint_test".

Testing

I tested this by making changes to src/psyclone/tests/psyad/domain/lfric/test_lfric_adjoint_harness.py. I passed in a new value of the optional test_name that is "adjoint_test_alg" which would replicate what we see in LFRic. This test passed by producing the expected "adjoint_test_alg_mod" as the module name and "adjoint_test_alg" as the subroutine name.

I also tested this by changing src/psyclone/tests/psyad/tl2ad_test.py to include a test_filename KGO, which also passed.

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.86%. Comparing base (59668bb) to head (98fe8d6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2749   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files         354      354           
  Lines       48963    48966    +3     
=======================================
+ Hits        48899    48902    +3     
  Misses         64       64           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

[LFRic] PSyAD generated adjoint tests do not update module and subroutine names correctly
1 participant