Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions src/split_ncvars/split_ncvars.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ my $list_ncvars
? $ENV{LIST_NCVARS}
: "$prefix/bin/list_ncvars.sh";

unless (-f $list_ncvars) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test scripot is required to ensure this line does what you expect.

Also, only testing if the file exists is not sufficient. You do need to verify the command runs. It would be easier to verify that the command ran successfully in the location where the command is run in this script than just trying to figure out if the command exits and is executable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much. I that checking the exit status would be better than this check, and I'll do that in a separate PR.

die "ERROR: required list-vars script not available (was looking for '$list_ncvars')";
}

my $ncdump
= defined( $ENV{NCDUMP} )
? $ENV{NCDUMP}
Expand Down
6 changes: 5 additions & 1 deletion tests/split_ncvars/split_ncvars
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be added to the Makefile.am where the test environment is defined, not here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true for all other files.

PR #338 has a fix for the PKGLIBEXECDIR. Please work to have that merged as well.

export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from plevel and timeavg
${builddir=.}/create_timeavg_test_ncfiles || framework_failure_ "failed to create timeavg test files"
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"
Expand All @@ -43,4 +47,4 @@ split_ncvars.pl test_input_*.nc || fail_ split_ncvars.pl multiple input files fa
test -f var1.nc || fail_ var1.nc not created with multiple input files
test -f var2.nc || fail_ var2.nc not created with multiple input files
# Verify there are 60 time steps
ncdump -h var1.nc | grep -q '60 currently' || fail_ var1.nc does not have 60 time steps
ncdump -h var1.nc | grep -q '60 currently' || fail_ var1.nc does not have 60 time steps
4 changes: 4 additions & 0 deletions tests/split_ncvars/split_ncvars-i
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`
export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from plevel
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"
mkdir idir || framework_failure_ "failed to create idir"
Expand Down
4 changes: 4 additions & 0 deletions tests/split_ncvars/split_ncvars-l
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`
export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from timeavg
${builddir=.}/create_timeavg_test_ncfiles || framework_failure_ "failed to create test files"

Expand Down
4 changes: 4 additions & 0 deletions tests/split_ncvars/split_ncvars-o
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`
export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from plevel
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"

Expand Down
4 changes: 4 additions & 0 deletions tests/split_ncvars/split_ncvars-p
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`
export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from plevel
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create test files"

Expand Down
4 changes: 4 additions & 0 deletions tests/split_ncvars/split_ncvars-s
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`
export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from plevel
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"

Expand Down
4 changes: 4 additions & 0 deletions tests/split_ncvars/split_ncvars-v
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ fi

. ${srcdir=.}/init.sh; path_prepend_ ../src

# Set paths to list-vars script and just-compiled exec
export LIST_NCVARS=`find ../.. -name list_ncvars.sh`
export PKGLIBEXECDIR=$(dirname $LIST_NCVARS)

# Use the test netCDF files from plevel
${builddir=.}/create_plevel_test_ncfile || framework_failure_ "failed to create test files"

Expand Down