Skip to content

Commit

Permalink
Fix use of g2c_compare in testing (#797)
Browse files Browse the repository at this point in the history
* working on g2c_compare

* fixed g2c_compare issue
  • Loading branch information
edwardhartnett authored Jan 18, 2025
1 parent 6d2f54b commit 9bbc9ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ endif()
# We need g2c if G2C_COMPARE is chosen.
if (G2C_COMPARE OR USE_G2C_API)
find_package(g2c 2.1.0 REQUIRED)
if (G2C_COMPARE)
find_program(G2C_COMPARE_PROG g2c_compare REQUIRED)
endif()
else()
find_package(g2c REQUIRED)
endif()
Expand Down
13 changes: 9 additions & 4 deletions test_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ endif()
# Run these shell tests.
if(BUILD_4)
if(BUILD_D)
gu_test(run_copygb2_tests2)
# gu_test(run_copygb2_tests2)
endif()
gu_test(run_cnvgrib_tests)
gu_test(run_degrib2_tests)
Expand All @@ -94,10 +94,15 @@ gu_test(run_copygb_tests)
gu_test(run_grbindex_tests)

if(G2C_COMPARE)
find_program(G2C_COMPARE g2c_compare)
gu_test(run_copygb2_tests)
configure_file("run_copygb2_tests2.sh.in"
"run_copygb2_tests2.sh" @ONLY NEWLINE_STYLE LF)
# file(COPY "${CMAKE_BISOURCE_DIR}/test_utils/run_copygb2_tests2.sh"
# DESTINATION ${CMAKE_BINARY_DIR}/test_utils
# FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# Add the shell script as a test.
add_test(NAME run_copygb2_tests2.sh COMMAND bash run_copygb2_tests2.sh)
else()
message(STATUS "g2c_compare not found.")
message(STATUS "g2c_compare not used.")
endif()

if(FTP_TEST_FILES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ echo "*** Running copygb2 test"
../utils/copygb2 -x data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2 test_gdaswave_2.grib2

# Are the files the same?
g2c_compare -v data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2 test_gdaswave_2.grib2
@G2C_COMPARE_PROG@ -v data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2 test_gdaswave_2.grib2

# Invoke interpolation logic.
../utils/copygb2 -g "30 6 0 0 0 0 0 0 1473 1025 12190000 226541000 8 25000000 265000000 5079000 5079000 0 64 25000000 25000000" -i"1 1" -x data/ref_gdaswave.t00z.wcoast.0p16.f000.grib2 test_gdaswave_2.ip.grib2

# Are the files the same?
g2c_compare -v data/ref_gdaswave.t00z.wcoast.0p16.f000.ip.grib2 test_gdaswave_2.ip.grib2
@G2C_COMPARE_PROG@ -v data/ref_gdaswave.t00z.wcoast.0p16.f000.ip.grib2 test_gdaswave_2.ip.grib2

echo "*** SUCCESS!"
exit 0

0 comments on commit 9bbc9ff

Please sign in to comment.