This directory contains expected CDL (Common Data Language) output files for the example programs that remain in NEP: cache_tuning and chunking_performance in examples/performance/. These files serve as regression test baselines to ensure examples continue producing correct output across code changes.
The expected files for the generic NetCDF teaching examples moved with those examples to the NetCDF Developer's Handbook repository in v4.3.0.
Purpose
CDL files are human-readable text representations of NetCDF file structure and data, generated by the ncdump utility. By comparing example program output against these baseline CDL files, we can:
- Detect unintended changes to example output
- Verify examples produce correct NetCDF structure
- Catch regressions during development
File Naming Convention
Expected CDL files follow the pattern: <example_name>_<variant>_expected.cdl
- cache_tuning_expected.cdl - Expected ncdump -h -s metadata for cache_tuning's cache_test.nc
- chunking_performance_{contiguous,time_optimized,spatial_optimized,balanced}_expected.cdl - Expected ncdump output for each of the four files chunking_performance writes
How Tests Work
The cache_tuning_validate and chunking_performance_validate_* CTest tests:
- Run the example program (via a DEPENDS test or inline)
- Generate CDL from the output NetCDF file(s) using ncdump (through validate_cdl.sh, generated from ../validate_cdl.sh.in)
- Compare the generated CDL with the expected CDL file
- Report success if they match, failure if they differ
When to Regenerate Baselines
Regenerate expected CDL files when:
- Intentional changes: You modify an example to produce different output
- Format changes: NetCDF library updates change CDL formatting
Do NOT regenerate for:
- Bug fixes that restore correct behavior
- Code refactoring that doesn't change output
- Build system changes
How to Regenerate Baselines
# Build and run the example
cd build/examples/performance
./cache_tuning
./chunking_performance
# Generate new baselines
ncdump -h -s cache_test.nc > ../../examples/expected_output/cache_tuning_expected.cdl
for f in contiguous time_optimized spatial_optimized balanced; do
ncdump chunk_${f}.nc > ../../examples/expected_output/chunking_performance_${f}_expected.cdl
done
Verifying Correctness
Before committing regenerated baselines, manually verify:
- Dimensions: Correct names and sizes
- Variables: Correct names, types, and dimensions
- Attributes: Correct names and values (global and variable)
- Structure: Overall file structure is logical
Troubleshooting
CDL Format Changes
If NetCDF library updates change CDL formatting:
- Regenerate all baselines with the new format
- Document the change in commit message
- Verify the actual NetCDF file structure is unchanged (only formatting differs)
References