Skip to content

Commit

Permalink
Fixes #2784 - testGrid reports error yet it still passes CircleCI (#2767
Browse files Browse the repository at this point in the history
)

* Replace exact floating point compare with WASP::NearlyEqual

* Force pre-commit hook

* exit(-1) if grid tests fail

* change exit code

Co-authored-by: Scott Pearse <pearse@ucar.edu>
  • Loading branch information
clyne and sgpearse authored Jul 2, 2021
1 parent 8c01dce commit 7c0e054
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test_apps/smokeTests/gridTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ bool CompareIndexToCoords(VAPoR::Grid *grid,

rms = sqrt(sum / (x * y * z));

if (rms != 0 || disagreements > 0) rc = false;
if ((!Wasp::NearlyEqual(rms, 0.0)) || disagreements > 0) rc = false;
return rc;
}

Expand Down
11 changes: 7 additions & 4 deletions test_apps/smokeTests/smokeTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def main():
print()
makeBaseline = args.makeBaseline

rc = 0

if ( args.makeBaseline == False and makeBaseline == True ):
print( " Warning: Some or all baseline files for running DataMgr testswere missing. "
" These files are needed as comparisons for the results of the current series "
Expand All @@ -209,10 +211,10 @@ def main():
os.mkdir( resultsDir )

for grid in gridSizes:
if ( testGrid(grid) > 0):
if ( testGrid(grid) != 0):
print (" See artifact file " + grid + ".txt or " + resultsDir + grid + ".txt for mismatches")
print (" Failed assertions, if any, are shown above.\n" )
#sys.exit(1)
rc = 1

for dataType, dataFile in dataMgrs.items():
baselineFile = resultsDir + dataType + "_baseline.txt"
Expand All @@ -223,10 +225,11 @@ def main():
dataMgr = testDataMgrs( makeBaseline )
if ( dataMgr != 0 ):
print( "DataMgr tests failed. Results are not identical to the baseline." )
exit(-1);
rc = 1
else:
print( "DataMgr tests passed" )
exit(0);

sys.exit(rc)

if __name__ == "__main__":
main()

0 comments on commit 7c0e054

Please sign in to comment.