From 9bbc9ff100e348f6e8bdd6f17fd6a0291f84bf99 Mon Sep 17 00:00:00 2001 From: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com> Date: Sat, 18 Jan 2025 07:04:28 -0700 Subject: [PATCH] Fix use of g2c_compare in testing (#797) * working on g2c_compare * fixed g2c_compare issue --- CMakeLists.txt | 3 +++ test_utils/CMakeLists.txt | 13 +++++++++---- ...un_copygb2_tests.sh => run_copygb2_tests2.sh.in} | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) rename test_utils/{run_copygb2_tests.sh => run_copygb2_tests2.sh.in} (75%) diff --git a/CMakeLists.txt b/CMakeLists.txt index aae9d1df2..56a4ed8d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/test_utils/CMakeLists.txt b/test_utils/CMakeLists.txt index 83c18ca74..4fa4cadee 100644 --- a/test_utils/CMakeLists.txt +++ b/test_utils/CMakeLists.txt @@ -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) @@ -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) diff --git a/test_utils/run_copygb2_tests.sh b/test_utils/run_copygb2_tests2.sh.in similarity index 75% rename from test_utils/run_copygb2_tests.sh rename to test_utils/run_copygb2_tests2.sh.in index 2088b54ca..daa4ff21a 100644 --- a/test_utils/run_copygb2_tests.sh +++ b/test_utils/run_copygb2_tests2.sh.in @@ -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