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

Fix cleanup in build-namelist_test.pl #2877

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
16 changes: 10 additions & 6 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ sub cat_and_create_namelistinfile {
}
}
}
system( "/bin/rm $namelistfile" );
system( "/bin/rm -f $namelistfile" );
&cleanup();
}
print "\n===============================================================================\n";
Expand Down Expand Up @@ -466,7 +466,7 @@ sub cat_and_create_namelistinfile {
if ( defined($opts{'generate'}) ) {
$cfiles->copyfiles( "$options", $mode );
}
system( "/bin/rm $namelistfile" );
system( "/bin/rm -f $namelistfile" );
&cleanup();
}

Expand Down Expand Up @@ -1303,6 +1303,7 @@ sub cat_and_create_namelistinfile {
eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); };
isnt( $?, 0, $key );
system( "cat $tempfile" );
&cleanup();
}


Expand Down Expand Up @@ -1386,12 +1387,14 @@ sub cat_and_create_namelistinfile {
eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); };
isnt( $?, 0, $key );
system( "cat $tempfile" );
&cleanup();
# Now run with -ignore_warnings and make sure it works
$options .= " -ignore_warnings";
eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); };
is( $?, 0, $key );
is( $@, '', "$options" );
system( "cat $tempfile" );
&cleanup();
}

print "\n===============================================================================\n";
Expand Down Expand Up @@ -1442,6 +1445,7 @@ sub cat_and_create_namelistinfile {
$finidat = `grep finidat lnd_in`;
ok ( $finidat =~ "testfile.nc", "coldwfinidat $key finidat? $finidat" );
}
&cleanup();
}

#
Expand Down Expand Up @@ -1971,7 +1975,7 @@ sub cat_and_create_namelistinfile {
}
&cleanup();

system( "/bin/rm $finidat" );
system( "/bin/rm -f $finidat" );

print "\n==================================================\n";
print " Dumping output \n";
Expand All @@ -1982,7 +1986,7 @@ sub cat_and_create_namelistinfile {
print "Successfully ran all testing for build-namelist\n\n";

&cleanup( "config" );
system( "/bin/rm $tempfile" );
system( "/bin/rm -f $tempfile" );

sub cleanup {
#
Expand All @@ -1993,10 +1997,10 @@ sub cleanup {
print "Cleanup files created\n";
if ( defined($type) ) {
if ( $type eq "config" ) {
system( "/bin/rm config_cache.xml" );
system( "/bin/rm -f config_cache.xml" );
}
} else {
system( "/bin/rm $tempfile *_in" );
system( "/bin/rm -f $tempfile *_in" );
}
}

Loading