-
Notifications
You must be signed in to change notification settings - Fork 11
Greatly simplify test-suite driver programs #86
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
Closed
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
ddd1aa9
feat(test): define/use test harness, test fixtures
rouson c2f951c
refac(test_harness): mv help I/O to harness report
rouson a738cac
feat(test):don't run intentional fail if --help/-h
rouson b0c034b
fix(intentional-fail): mv 'implicit none'
rouson 162628d
feat(test_harness): automatically report tally
rouson 3bed85c
refac(test): further simplify test driver
rouson d40d334
feat: default preprocessing of test main
rouson 5820af7
feat(test_diagnosis): add .expect. operator
rouson 559c1ed
fix(include): use GCC minor and patch versions
rouson f110cbc
fix: work around gfortran 14 builds
rouson ebc5be1
fix(command_line_test): mv code
rouson fe2f192
chore(CI): use more descriptive names
rouson f4c44d1
chore(CI): print versions, set env vars
rouson 56e126f
fix(include/language-support): add compilers
rouson 5ea38ec
chore(test_fixture): priv component, non-alloc arg
rouson 9e75285
chore(test_harness): priv component, non-alloc arg
rouson 932edcc
doc(test/main,harness): add/edit comments
rouson db2981e
chore(test_harness): mk component array non-poly
rouson 6120c8f
refac(test_harness): disambiguate binding name
rouson 4df3368
refac(test_harness): rm dummy args
rouson 7ed8437
refac(test_harness): collapse print statements
rouson 664578e
chore(CI): fix compiler names
rouson a928d8f
fix(CI): only run command-line tests if not in CI
rouson b757a10
Merge branch 'test-harness-feature' of github.com:berkeleylab/julienn…
rouson cff34b6
fix(CI): fix logic to skip command_line_t tests
rouson 03a05c8
fix(command_line_test_t): fix output statements
rouson 06ca107
fix(CI): use legacy-main with GCC version < 14.3.0
rouson 5a5ab9c
fix(CI): ensure non-empty test-suite main programs
rouson e049da7
fix(command_line_test): separate ptr decl/def
rouson 0c9dd15
fix(command_line_test): gfoetran 12 workaround
rouson c94c0cf
doc(README): add example of operator(.expect.)
rouson d268f93
doc(demo): refactor driver using test harness
rouson f49a117
doc(demo): update README.md
rouson 0d34d8c
chore: use .f90 file extension
rouson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name = "Example-Test-Suite" | ||
|
|
||
| [dependencies] | ||
| julienne = {git = "https://github.com/berkeleylab/julienne", tag = "2.1.0-rc5"} | ||
| julienne = {path = "../"} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute | ||
| ! Terms of use are as specified in LICENSE.txt | ||
|
|
||
| program test_suite_driver | ||
| !! Example test-suite driver | ||
| use julienne_m ,only : test_fixture_t, test_harness_t ! Import test infrastructure | ||
| use specimen_test_m ,only : specimen_test_t ! Must be a non-abstract child type extending Julienne's test_t type | ||
| use iso_fortran_env ,only : compiler_version | ||
| implicit none | ||
|
|
||
| call stop_if_compiler_too_old | ||
|
|
||
| ! Construct a test harness from an array of test fixtures, each of which is | ||
| ! constructed from a structure constructor for a type that extends test_t. | ||
| associate(test_harness => test_harness_t( [ test_fixture_t(specimen_test_t()) ] )) | ||
| call test_harness%report_results | ||
| end associate | ||
|
|
||
| contains | ||
| subroutine stop_if_compiler_too_old | ||
| character(len=:), allocatable :: compiler_identity | ||
| integer major, minor | ||
| compiler_identity = compiler_version() | ||
| if (index(compiler_identity, "GCC")==1) then | ||
| associate( final_dot => index(compiler_identity ,"." ,back=.true.)) | ||
| associate( penultimate_dot => index(compiler_identity(:final_dot-1) ,"." ,back=.true.)) | ||
| associate(space_before_version => index(compiler_identity(:penultimate_dot-1) ," " ,back=.true.)) | ||
| associate( & | ||
| major_string => compiler_identity(space_before_version+1 : penultimate_dot-1) & | ||
| ,minor_string => compiler_identity( penultimate_dot+1 : final_dot-1) & | ||
| ) | ||
| read(major_string, '(i2)') major | ||
| read(minor_string, '(i1)') minor | ||
| if ((major < 14) .or. (major==14 .and. minor<3)) stop "'"// compiler_identity //"' too old: GCC >= 14.3.0 required" | ||
| end associate | ||
| end associate | ||
| end associate | ||
| end associate | ||
| end if | ||
| end subroutine | ||
| end program | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,16 +4,21 @@ | |||||||||||||||||||||
| #ifndef _JULIENNE_LANGUAGE_SUPPORT_H | ||||||||||||||||||||||
| #define _JULIENNE_LANGUAGE_SUPPORT_H | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #ifdef __GNUC__ | ||||||||||||||||||||||
| #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) | ||||||||||||||||||||||
| #else | ||||||||||||||||||||||
| #define GCC_VERSION 0 | ||||||||||||||||||||||
| #endif | ||||||||||||||||||||||
|
Comment on lines
+7
to
+11
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nitpick: For the "not Gfortran" case, you might instead consider leaving
Suggested change
Then later your tests become more readable and slightly less error-prone: |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ! If not already determined, make a compiler-dependent determination of whether Julienne may pass | ||||||||||||||||||||||
| ! procedure actual arguments to procedure pointer dummy arguments, a feature introduced in | ||||||||||||||||||||||
| ! Fortran 2008 and described in Fortran 2023 clause 15.5.2.10 paragraph 5. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #ifndef HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY | ||||||||||||||||||||||
| # if defined(__GFORTRAN__) | ||||||||||||||||||||||
| # define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 | ||||||||||||||||||||||
| # else | ||||||||||||||||||||||
| #if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__flang__) || (GCC_VERSION > 140200) | ||||||||||||||||||||||
| # define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1 | ||||||||||||||||||||||
| # else | ||||||||||||||||||||||
| # define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 | ||||||||||||||||||||||
| # endif | ||||||||||||||||||||||
| #endif | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be written far more concisely using the preprocessor.
You will also need to rename the file back to
.F90.