with one click
mapl-testing
Run and debug MAPL tests with pFUnit framework
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Run and debug MAPL tests with pFUnit framework
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Safely switch between NAG, gfortran, and Intel compilers when building MAPL
MAPL Fortran coding standards and style conventions
GitHub workflow, commit conventions, and PR process for MAPL
Build MAPL with NAG, gfortran, or Intel compilers on macOS and Linux
MAPL error handling macros and best practices
First-time MAPL development environment setup and configuration
| name | mapl-testing |
| description | Run and debug MAPL tests with pFUnit framework |
| compatibility | opencode |
Guide you through running and debugging MAPL tests, including:
Use this skill when:
MAPL provides two testing approaches depending on your needs:
Use for:
Pros: Comprehensive Cons: Slow (rebuilds everything)
Use for:
Pros: Very fast (< 1 minute for changes to generic3g) Cons: Only tests generic3g component
cd <build-dir> # e.g., cd nag or cd gfortran
ctest --output-on-failure
IMPORTANT: Running ctest at the top level rebuilds everything, which can be slow.
ctest --output-on-failure -j 4 # Use 4 parallel jobs
ctest -R <test-pattern> --output-on-failure
# Examples:
ctest -R generic3g --output-on-failure
ctest -R GridComp --output-on-failure
ctest -V # Very verbose
ctest --output-on-failure # Show output only on failure (recommended)
Problem: Running ctest at top level is too slow during development.
Solution: Build and run generic3g tests directly from their directory.
CRITICAL:
$BUILD/generic3g/tests directoryDYLD_LIBRARY_PATH to include gridcomps directory# 1. Navigate to generic3g tests directory
cd $BUILD/generic3g/tests
# Example paths:
cd ~/swdev/VS/MAPL/nag/generic3g/tests
cd ~/swdev/VS/MAPL/gfortran/generic3g/tests
# 2. Build just generic3g tests
make
# 3. Set library path
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
# 4. Run tests
mpirun -np 1 ./MAPL.generic3g.tests
# WRONG - running from top-level build directory
cd ~/swdev/VS/MAPL/nag
export DYLD_LIBRARY_PATH=$PWD/generic3g/tests/gridcomps:$DYLD_LIBRARY_PATH
mpirun -np 1 ./generic3g/tests/MAPL.generic3g.tests # Will fail!
# CORRECT - running from within tests directory
cd ~/swdev/VS/MAPL/nag/generic3g/tests
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
mpirun -np 1 ./MAPL.generic3g.tests # Works!
When running ./MAPL.generic3g.tests, use these flags AFTER the executable name:
mpirun -np 1 ./MAPL.generic3g.tests -d
Use when:
Output:
Starting test: Test_GridComp_create
Ending test: Test_GridComp_create
Starting test: Test_GridComp_run
# <crash happens here - no "Ending" message>
This shows Test_GridComp_run started but never finished.
mpirun -np 1 ./MAPL.generic3g.tests -f ComponentDriver
Use when:
IMPORTANT: Filter uses simple substring matching:
-f GridComp-f ComponentDriver-f Grid* (wildcards don't work)-f .Grid. (regex doesn't work)-f Grid.*Comp (regex doesn't work)mpirun -np 1 ./MAPL.generic3g.tests -d -f GridComp
This runs only GridComp tests with diagnostic output. Perfect for focused debugging.
# Run all tests with diagnostics
mpirun -np 1 ./MAPL.generic3g.tests -d
# Run only ComponentDriver tests
mpirun -np 1 ./MAPL.generic3g.tests -f ComponentDriver
# Debug GridComp tests specifically
mpirun -np 1 ./MAPL.generic3g.tests -d -f GridComp
# Run tests matching "create" in name
mpirun -np 1 ./MAPL.generic3g.tests -f create
Some tests only run on specific platforms and are automatically excluded on others.
What: Tests memory information reporting
Requires: /proc/self/status (Linux-specific file system)
Status on macOS: Automatically excluded via CMake configuration
Location: utilities/tests/CMakeLists.txt
If you see this "fail" on macOS: This is expected. The test is disabled via CMake on non-Linux platforms.
Symptoms:
dyld: Library not loaded: @rpath/libSomeComponent.dylib
Problem: DYLD_LIBRARY_PATH not set or incorrect
Solution:
# Must include gridcomps directory
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
# Verify you're in correct directory
pwd # Should end in: .../generic3g/tests
Symptoms:
NAG Fortran compiler: License error
Problem: gridcomps directory not in DYLD_LIBRARY_PATH
Solution: The gridcomps directory contains NAG license information. Ensure DYLD_LIBRARY_PATH includes it:
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
This is the same fix as library load errors above.
Symptoms:
Problem: Framework couldn't report failure location
Solution: Use -d flag
mpirun -np 1 ./MAPL.generic3g.tests -d
Look for test that "started" but never "ended".
Symptoms:
-f but getting unexpected resultsProblem: Trying to use wildcards or regex
Solution: Use simple substring matching only
# WRONG
mpirun -np 1 ./MAPL.generic3g.tests -f "Grid*"
# CORRECT
mpirun -np 1 ./MAPL.generic3g.tests -f Grid
The filter matches any test name containing that substring.
Possible causes:
Debugging:
Problem: Need quick test feedback during generic3g development
Solution: Use fast workflow (see above)
cd $BUILD/generic3g/tests
make
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
mpirun -np 1 ./MAPL.generic3g.tests
This typically takes < 1 minute vs many minutes for full ctest.
When a test fails:
Identify failing test
# If crash with no error, use -d
mpirun -np 1 ./MAPL.generic3g.tests -d
Isolate the test
# Run only that test
mpirun -np 1 ./MAPL.generic3g.tests -f FailingTestName
Add diagnostics
# Combine filter and diagnostics
mpirun -np 1 ./MAPL.generic3g.tests -d -f FailingTestName
Check environment
# Verify modules loaded
module list
# Verify library path
echo $DYLD_LIBRARY_PATH
# Verify in correct directory
pwd # Should be in generic3g/tests
Try different compiler (if applicable)
# Maybe NAG-specific issue, try gfortran
cd ~/swdev/VS/MAPL/gfortran/generic3g/tests
make
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
mpirun -np 1 ./MAPL.generic3g.tests -f FailingTestName
When writing new tests:
cd <build-dir>
ctest --output-on-failure
cd $BUILD/generic3g/tests
make
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
mpirun -np 1 ./MAPL.generic3g.tests
cd $BUILD/generic3g/tests
export DYLD_LIBRARY_PATH=$PWD/gridcomps:$DYLD_LIBRARY_PATH
mpirun -np 1 ./MAPL.generic3g.tests -d -f TestName
pfunit-troubleshooting - Deep dive into pFUnit-specific debuggingmapl-build - Building MAPL before testingcompiler-switching - Testing with different compilers