Skip to content

Automatically generate demo test suite from JSON file - #92

Merged
rouson merged 24 commits into
mainfrom
auto-generate-driver
Aug 22, 2025
Merged

Automatically generate demo test suite from JSON file#92
rouson merged 24 commits into
mainfrom
auto-generate-driver

Conversation

@rouson

@rouson rouson commented Aug 12, 2025

Copy link
Copy Markdown
Contributor

Given a JSON file that lists a set of test subjects, the new program in app/scaffold.F90 added by this PR generates the a stub test suite that has been committed in the demo/test subdirectory. The Generating test scaffolding section of the demo/README.md file shows the JSON file format and describes how to generate and run the demonstration test suite.

@rouson rouson changed the title Automatically generate test-suite driver program from JSON file Automatically generate demo test stubs + drive from JSON file Aug 13, 2025
@rouson rouson changed the title Automatically generate demo test stubs + drive from JSON file Automatically generate demo test suite from JSON file Aug 13, 2025
rouson and others added 19 commits August 15, 2025 21:53
This commit converts the following string_t procedures from
being declared pure to being declared elemental:

- base_name
- get_real
- get_real_with_character_key
- get_double_precision
- get_double_precision_with_character_key
- get_string_with_character_key
- get_integer_with_character_key
- get_integer
- get_logical_with_character_key
- string_t_cat_character
- character_cat_string_t
This commit
1. Shrinks the JSON file to just a list of test subjects.
2. Rewrites the scaffolding app to create a driver based on
  a. test type names formed by appending '_test_t' to subject names
  b. test module names formed by appending '_m' to subject names.
3. Relocates the file 'test-suite.json' to demo/ and uses that file
   to generate 'demo/test/driver.f90'.
This commit disaggregates pull requests 92 and 93 to ensure
that 92 builds independently of the compiler_t derived type
that 93 adds.
With this commit, the command below, when executed outside the
demo/test subdirectory, prompts the app/scaffold.F90 program to

1. Read a JSON file containing an array of test-subject names and
2. Create a demonstration test suite in the demo/test subdirectory.

fpm run scaffold \
  --compiler flang-new \
  -- --json-file demo/test-suite.json \
  --suite-path demo/test

whereupon running the command below while inside the demo
subdirectory will run the created test suite, demonstrating one
one passing test and one failing test:

fpm test --compiler flang-new

At present, the `fpm run scaffold` command works with the LLVM
flang (flang-new) compiler but not with the GCC (gfortran) or
NAG (nagfor) compilers.  The second fpm command works with either
compiler.
Co-authored-by: Dan Bonachea <dobonachea@lbl.gov>
This commit converts the following string_t procedures from
being declared pure to being declared elemental:

- base_name
- get_real
- get_real_with_character_key
- get_double_precision
- get_double_precision_with_character_key
- get_string_with_character_key
- get_integer_with_character_key
- get_integer
- get_logical_with_character_key
- string_t_cat_character
- character_cat_string_t
This commit
1. Switches to the older form of the test-suite driver program
   when the GCC version is less than 14.3.  This prevents a test
   failure in GitHub CI, where the GCC version is currently 14.2.
2. Skips one string_t test with GCC.
This commit makes the specific string_t binding get_integer_array
public when compiling with gfortran to work around a seg fault that
occurs when this procedure is invoked through the get_json_value
generic binding.  The corresponding unit test is adjusted to use
the specific binding until a minimal reproducer can be developed
and reported, at which point it could make sense to instead skip the
test as a way to document and expose the issue in the test output.
@rouson
rouson force-pushed the auto-generate-driver branch from aff53f4 to 97e77c4 Compare August 16, 2025 05:08
rouson added 5 commits August 16, 2025 17:32
This commit reverts several specific procedures from elemental to
non-elemental pure.  The relevant functions extract values from
JSON key/value pairs.  Making these functions elemental causes an
apparent ambiguity with the corresponding versions of these
functions that extract array values from JSON key/value pairs.
Four compilers tested accept the code, but gfortran disambiguates
the call differently, causing a crash.  This commit eliminates the
crash.
This commit overhauls the demonstration project documentation,
including the demo/README.md and the UML class diagram, for the
new test-suite driver structure.
@rouson
rouson merged commit c5da31f into main Aug 22, 2025
8 checks passed
@rouson
rouson deleted the auto-generate-driver branch August 22, 2025 13:06
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.

1 participant