CTSM icon indicating copy to clipboard operation
CTSM copied to clipboard

Fix cleanup in build-namelist_test.pl

Open samsrabin opened this issue 1 year ago • 3 comments

Description of changes

This PR is intended to fix the failure of build-namelist_test.pl to clean up after itself.

Unfortunately, at the moment it doesn't.

Specific notes

Contributors other than yourself, if any: None

CTSM Issues Fixed:

  • Will resolve #2876

Are answers expected to change (and if so in what way)? No

Any User Interface Changes (namelist or namelist defaults changes)? No

Does this create a need to change or add documentation? Did you do so? No

Testing performed, if any: Running build-namelist_test.pl.

samsrabin avatar Nov 12 '24 01:11 samsrabin

I think the issue has to do with all these calls

eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); };

which are set up with this at the top:

my $bldnml = "../build-namelist -verbose -csmdata $inputdata_rootdir -configuration clm -structure standard -glc_nec 10 -no-note";
if ( $opts{'test'} ) {
   $bldnml .= " -test";
}

my $tempfile = "temp_file.txt";

Somehow all the options are getting put into the name of the tempfile?

samsrabin avatar Nov 12 '24 01:11 samsrabin

The files are created here, in the copyfiles subroutine: https://github.com/ESCOMP/CTSM/blob/931b4250d4e9ad9cf5ae3c703e62a1dab0897763/bld/unit_testers/NMLTest/CompFiles.pm#L134-L136

samsrabin avatar Nov 12 '24 22:11 samsrabin

Simple update here, but ultimately we want to get rid of the .pl, as this is something that's harder than @samsrabin appreciated here. Will need @ekluzek to fix this as a quality of life improvement.

wwieder avatar Nov 14 '24 17:11 wwieder