Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Check file-size of test-data in tests #40

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Deal with stat command a la bsd.
  • Loading branch information
shinji-s committed Aug 12, 2020
commit 77c7d287e3cac6363380e91570096320c0870d11
15 changes: 1 addition & 14 deletions examples/C/include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,4 @@ else
set -u
fi

grib_check_filesize()
(
# There are tests that try to work on non-existing file.
# e.g. eccodes_t_grib_bitsPerValue. Check the size if it exists.
if [ -f "${data_dir}/$1" ]; then
subdir=`dirname $1`
realsize=`stat -c %s ${data_dir}/$1`
expected=`grep " $1$" ${data_dir}/${subdir}/filesize_db.txt | awk -F " " '{print $1}'`
if [ "$realsize" != "$expected" ]; then
echo Data file \"$1\" does not have the expected size, $expected, which is from http:https://download.ecmwf.org/test-data/eccodes/data/.
exit 1
fi
fi
)
. ../../tests/utils.sh
15 changes: 1 addition & 14 deletions examples/F90/include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,4 @@ else
set -u
fi

grib_check_filesize()
(
# There are tests that try to work on non-existing file.
# e.g. eccodes_t_grib_bitsPerValue. Check the size if it exists.
if [ -f "${data_dir}/$1" ]; then
subdir=`dirname $1`
realsize=`stat -c %s ${data_dir}/$1`
expected=`grep " $1$" ${data_dir}/${subdir}/filesize_db.txt | awk -F " " '{print $1}'`
if [ "$realsize" != "$expected" ]; then
echo Data file \"$1\" does not have the expected size, $expected, which is from http:https://download.ecmwf.org/test-data/eccodes/data/.
exit 1
fi
fi
)
. ../../tests/utils.sh
17 changes: 13 additions & 4 deletions tests/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ grib_check_filesize()
(
# There are tests that try to work on non-existing file.
# e.g. eccodes_t_grib_bitsPerValue. Check the size if it exists.
if [ -f "${data_dir}/$1" ]; then
subdir=`dirname $1`
realsize=`stat -c %s ${data_dir}/$1`
expected=`grep " $1$" ${data_dir}/${subdir}/filesize_db.txt | awk -F " " '{print $1}'`
fullpath=${data_dir}/$1
if [ -f $fullpath ]; then
# try GNU version first
set +e
realsize=`stat -c %s $fullpath`
if [ $? != 0 ]; then
realsize=`stat -f %z $fullpath`
set -e
else
set -e
fi
dir=`dirname $fullpath`;
expected=`grep " $1$" $dir/filesize_db.txt | awk -F " " '{print $1}'`
if [ "$realsize" != "$expected" ]; then
echo Data file \"$1\" does not have the expected size, $expected, which is from http:https://download.ecmwf.org/test-data/eccodes/data/.
exit 1
Expand Down