MESAHub / MESAHub/mesa

Should `math`'s unit tests generate the top-level `testhub.yml`?

Open
#334 5 comments 0 reactions 0 assignees View on GitHub
rainy day
Dominant language
Fortran
Stars
249
Forks
82
Avg merge
1d 3h
Merged PRs (30d)
3

Description

In trying to test the `INTRINSIC` math backend (for issue #331), I discovered that the TestHub information in `$MESA_DIR/testhub.yml` is generated by the unit tests for the `math` module. In the unlikely event that [some madman](https://github.com/warrickball/) wants to skip the unit tests by touching `$MESA_DIR/skip_test` but still run the test suite and submit results to TestHub, TestHub rejects the results because of malformed information in `$MESA_DIR/testhub.yml`.

Though my use case is obscure, it still surprises me that a bunch of compile time information is populated by running the unit tests.

I would be less surprised if this were done somewhere like the top-level `install`. As a first pass, for example, the following `bash` script reproduces my `testhub.yml` files (produced by the `math` unit test) on an SDK system (Fedora 34) and my ifort system (RHEL 8.3):
```bash
#!/usr/bin/env bash

COMPILER=$(grep "^FC =" utils/makefile_header | head -n 1 | awk '{print $NF}')
COMPILER_VERSION=$(${COMPILER} --version | head -n 1 | awk '{print $NF}')
USE_CRMATH=$(grep "^USE_CRMATH =" utils/makefile_header | head -n 1 | awk '{print $NF}')
if [ "${USE_CRMATH}" = "YES" ]; then
MATH_BACKEND="CRMATH"
else
MATH_BACKEND="INTRINSIC"
fi

{
echo '# comment on the origin of this data'
echo '---' > $MESA_DIR/testhub.yml
echo 'compiler:' \'${COMPILER}\'
echo 'compiler_version:' \'${COMPILER_VERSION}\'
echo 'sdk_version:' \'$(mesasdk_version)\'
echo 'math_backend:' \'${MATH_BACKEND}\'
} # > $MESA_DIR/testhub_test.yml
```
Without the SDK, the line that runs `mesasdk_version` sends an error to `stderr` but produces the correct output on `stdout`. This might break a script that's set to exit if it encounters an error. This also might not work on a Mac. I recall a previous comment about not being sure if `awk` is available but there are probably simpler ways of getting the last word on a line.

Contributor guide

Open the contributing guide

Research direction

Inspect the math unit-test code that generates $MESA_DIR/testhub.yml and the top-level install path, using utils/makefile_header and the proposed Bash script as references. Reproduce the skip_test case with and without the SDK, then verify that testhub.yml is valid and available when the test suite runs without the math unit tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, fortran
Domain
build-system, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.