From 6ab42a3ff0bd943cf3059e4e83260532a536361e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 2 Aug 2024 11:04:15 +0200 Subject: [PATCH 1/3] Make test script more portable and ignore output files --- test_files/.gitignore | 3 +++ test_files/tests.sh | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 test_files/.gitignore diff --git a/test_files/.gitignore b/test_files/.gitignore new file mode 100644 index 0000000..7219052 --- /dev/null +++ b/test_files/.gitignore @@ -0,0 +1,3 @@ +*.nc +tests_output* +cfcache-files-py3/ diff --git a/test_files/tests.sh b/test_files/tests.sh index f13592c..37c6f49 100755 --- a/test_files/tests.sh +++ b/test_files/tests.sh @@ -6,17 +6,19 @@ outdir=tests_output.$$ mkdir $outdir -std_name_table=http://cfconventions.org/Data/cf-standard-names/current/src/cf-standard-name-table.xml -area_table=http://cfconventions.org/Data/area-type-table/current/src/area-type-table.xml +std_name_table=https://cfconventions.org/Data/cf-standard-names/79/src/cf-standard-name-table.xml +area_table=http://cfconventions.org/Data/area-type-table/10/src/area-type-table.xml -cfchecker="cfchecks" + +cfchecker=$(which cfchecks) failed=0 echo "Unzipping input netcdf files..." gzip -d *.gz -cache_opts="-x --cache_dir /home/ros/temp/cfcache-files-py3" +mkdir -p cfcache-files-py3 +cache_opts="-x --cache_dir ./cfcache-files-py3" for file in `ls *.nc` do @@ -37,7 +39,7 @@ do $cfchecker $cache_opts -s $std_name_table -v 1.0 $file > $outdir/$file.out 2>&1 else # Run checker using the CF version specified in the conventions attribute of the file - $cfchecker $cache_opts -s $std_name_table -v auto $file > $outdir/$file.out 2>&1 + $cfchecker $cache_opts -s $std_name_table -a $area_table -v auto $file > $outdir/$file.out 2>&1 fi # Check the output against what is expected @@ -48,8 +50,10 @@ do echo $file: Success rm $outdir/$file.out else + diff $outdir/$file.out $result echo $file: Failed failed=`expr $failed + 1` + exit 1 fi done From 9abb7a49f8905c9f58affc484397c413d96d72a2 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 2 Aug 2024 11:40:16 +0200 Subject: [PATCH 2/3] Remove debugging stuff --- test_files/tests.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test_files/tests.sh b/test_files/tests.sh index 37c6f49..f453a30 100755 --- a/test_files/tests.sh +++ b/test_files/tests.sh @@ -7,7 +7,7 @@ outdir=tests_output.$$ mkdir $outdir std_name_table=https://cfconventions.org/Data/cf-standard-names/79/src/cf-standard-name-table.xml -area_table=http://cfconventions.org/Data/area-type-table/10/src/area-type-table.xml +area_table=https://cfconventions.org/Data/area-type-table/10/src/area-type-table.xml cfchecker=$(which cfchecks) @@ -50,10 +50,8 @@ do echo $file: Success rm $outdir/$file.out else - diff $outdir/$file.out $result echo $file: Failed failed=`expr $failed + 1` - exit 1 fi done From 210428e4dba7934b4129e07ae1135e9987cb4bee Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 2 Aug 2024 11:41:06 +0200 Subject: [PATCH 3/3] Add comment explaining why the pin is needed --- test_files/tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_files/tests.sh b/test_files/tests.sh index f453a30..394af09 100755 --- a/test_files/tests.sh +++ b/test_files/tests.sh @@ -6,6 +6,8 @@ outdir=tests_output.$$ mkdir $outdir +# Pin the tables, as the tests fail if they differ. +# This can be unpinned in future MRs updating the tests. std_name_table=https://cfconventions.org/Data/cf-standard-names/79/src/cf-standard-name-table.xml area_table=https://cfconventions.org/Data/area-type-table/10/src/area-type-table.xml