From ada56cdb30ddc9336cbc0157b9e6fa14ce93d709 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 28 Feb 2022 16:08:16 +0000 Subject: [PATCH] ECC-1352: CCSDS with multi-threaded tests --- tests/grib_encode_pthreads.c | 4 ++-- tests/grib_encode_pthreads.sh | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/grib_encode_pthreads.c b/tests/grib_encode_pthreads.c index e227e24bd..670086ba0 100644 --- a/tests/grib_encode_pthreads.c +++ b/tests/grib_encode_pthreads.c @@ -89,7 +89,7 @@ static int encode_file(char* input_file, char* output_file) GRIB_CHECK(grib_set_long(clone_handle, "bitsPerValue", 16), 0); /*GRIB_CHECK(grib_set_string(clone_handle, "packingType", "grid_ccsds", &str_len), 0);*/ - GRIB_CHECK(grib_set_string(clone_handle, "packingType", "grid_simple", &str_len), 0); + /*GRIB_CHECK(grib_set_string(clone_handle, "packingType", "grid_simple", &str_len), 0);*/ GRIB_CHECK(grib_set_double_array(clone_handle, "values", values, values_len), 0); @@ -118,7 +118,7 @@ void do_stuff(void* arg) int i; for (i = 0; i < FILES_PER_ITERATION; i++) { - sprintf(output_file, "temp.grib_encode_pthreads.out_%d-%d.grib", (int)number, i); + sprintf(output_file, "temp.grib_encode_pthreads_test.out_%d-%d.grib", (int)number, i); encode_file(INPUT_FILE, output_file); } } diff --git a/tests/grib_encode_pthreads.sh b/tests/grib_encode_pthreads.sh index 4382bacb0..77ff70f90 100755 --- a/tests/grib_encode_pthreads.sh +++ b/tests/grib_encode_pthreads.sh @@ -10,8 +10,25 @@ . ./include.sh -input=$ECCODES_SAMPLES_PATH/gg_sfc_grib2.tmpl +label="grib_encode_pthreads_test" -${test_dir}/grib_encode_pthreads $input +# Simple packing +# -------------- +${test_dir}/grib_encode_pthreads $ECCODES_SAMPLES_PATH/GRIB2.tmpl +for f in temp.$label.out_*.grib; do + ${tools_dir}/grib_get -p min,max,avg $f > $f.simple.txt +done -rm -f temp.grib_encode_pthreads.out_*.grib +rm -f temp.$label.out_*.grib + + +# CCSDS packing +# -------------- +${test_dir}/grib_encode_pthreads $ECCODES_SAMPLES_PATH/ccsds_grib2.tmpl +for f in temp.$label.out_*.grib; do + ${tools_dir}/grib_get -p min,max,avg $f > $f.ccsds.txt + diff $f.simple.txt $f.ccsds.txt + rm $f.simple.txt $f.ccsds.txt +done + +rm -f temp.$label.out_*.grib