Skip to content
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

Unit tests for SWFlowTempTest.MainSoilTemperatureFunction_LyrMAX fail intermittently #210

Closed
dschlaep opened this issue Jul 11, 2018 · 0 comments
Assignees
Milestone

Comments

@dschlaep
Copy link
Member

Most of the time the unit tests pass well, but in rare cases the test for SWFlowTempTest.MainSoilTemperatureFunction_LyrMAX fails with

[ RUN      ] SWFlowTempTest.MainSoilTemperatureFunction_LyrMAX
test/test_SW_Flow_lib_temp.cc:569: Failure
Expected: (sTemp3[k]) < (100), actual: 999 vs 100
test/test_SW_Flow_lib_temp.cc:569: Failure
Expected: (sTemp3[k]) < (100), actual: 999 vs 100
test/test_SW_Flow_lib_temp.cc:569: Failure
Expected: (sTemp3[k]) < (100), actual: 999 vs 100
test/test_SW_Flow_lib_temp.cc:569: Failure
Expected: (sTemp3[k]) < (100), actual: 999 vs 100
test/test_SW_Flow_lib_temp.cc:569: Failure
Expected: (sTemp3[k]) < (100), actual: 999 vs 100
...

This is easy to ignore locally but simply re-running the unit tests; however, this is not suitable for our CI checks.

--> My guess is that this is because of the use of random number generator in the initialization of the test variables which produces values that break the function (unexpectedly) in these rare cases:

    for (i = 0; i < nlyrs2; i++) {
      bDensity2[i] = fmaxf(RandNorm(1.,0.5), 0.1); // greater than 0.1
      fc2[i] = fmaxf(RandNorm(1.5, 0.5), 0.1); // greater than 0.1
...

which was introduced by commit ae0b6ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants