[Dart-dev] DART/branches Revision: 12794

dart at ucar.edu dart at ucar.edu
Wed Aug 29 14:01:59 MDT 2018


nancy at ucar.edu
2018-08-29 14:01:59 -0600 (Wed, 29 Aug 2018)
283
rename the error handler test to be more helpful.
add a script and a program to help test the starting
up sequence in the utilities module, and provoke a range
of uncommon but possible error conditions (e.g. running in
someone else's directory with an unwritable dart_log.out file)




Modified: DART/branches/recam/developer_tests/utilities/error_handler_test.f90
===================================================================
--- DART/branches/recam/developer_tests/utilities/error_handler_test.f90	2018-08-28 21:43:04 UTC (rev 12793)
+++ DART/branches/recam/developer_tests/utilities/error_handler_test.f90	2018-08-29 20:01:59 UTC (rev 12794)
@@ -35,8 +35,11 @@
 
 ! main code here
  
+!----------------------------------------------------------------------
+
 ! initialize the dart libs
-call initialize_module()
+call initialize_mpi_utilities('error_handler_test')
+call register_module(source, revision, revdate)
 
 ! Read the namelist entry
 call find_namelist_in_file("input.nml", "error_handler_test_nml", iunit)
@@ -66,20 +69,8 @@
 
 ! end of main code
 
-contains
-
 !----------------------------------------------------------------------
 
-subroutine initialize_module
-
-  call initialize_mpi_utilities('error_handler_test')
-  call register_module(source, revision, revdate)
-  module_initialized = .true.
-
-end subroutine initialize_module
-
-!----------------------------------------------------------------------
-
 end program
 
 ! <next few lines under version control, do not edit>

Added: DART/branches/recam/developer_tests/utilities/file_utils_test.f90
===================================================================
--- DART/branches/recam/developer_tests/utilities/file_utils_test.f90	                        (rev 0)
+++ DART/branches/recam/developer_tests/utilities/file_utils_test.f90	2018-08-29 20:01:59 UTC (rev 12794)
@@ -0,0 +1,81 @@
+! DART software - Copyright UCAR. This open source software is provided
+! by UCAR, "as is", without charge, subject to all terms of use at
+! http://www.image.ucar.edu/DAReS/DART/DART_download
+!
+! $Id: file_utils_test.f90 11289 2017-03-10 21:56:06Z hendric at ucar.edu $
+
+program file_utils_test
+
+use     types_mod,     only : r8
+use utilities_mod,     only : register_module, error_handler, E_ERR, E_MSG, E_ALLMSG, &
+                              find_namelist_in_file, check_namelist_read,             &
+                              do_nml_file, do_nml_term, nmlfileunit
+use mpi_utilities_mod, only : initialize_mpi_utilities, finalize_mpi_utilities,       &
+                              task_sync, my_task_id
+
+implicit none
+
+! version controlled file description for error handling, do not edit
+character(len=256), parameter :: source   = &
+   "$URL: https://svn-dares-dart.cgd.ucar.edu/DART/branches/recam/developer_tests/utilities/file_utils_test.f90 $"
+character(len=32 ), parameter :: revision = "$Revision: 11289 $"
+character(len=128), parameter :: revdate  = "$Date: 2017-03-10 14:56:06 -0700 (Fri, 10 Mar 2017) $"
+
+logical, save :: module_initialized = .false.
+
+character(len=128) :: msgstring
+integer :: iunit, io
+character(len=8) :: task_id
+integer  :: test1
+logical  :: test2
+real(r8) :: test3
+
+! namelist items we are going to create/overwrite
+namelist /file_utils_test_nml/  test1, test2, test3
+
+! main code here
+ 
+
+!----------------------------------------------------------------------
+! mkdir test; cd test; then:
+!  touch dart_log.out; chmod 0 dart_log.out
+!  chmod 0 input.nml
+!  rm input.nml (no nml file)
+!  rm input.nml; touch input.nml (0 length nml file)
+!  rm input.nml; echo &bob > input.nml  (no trailing / )
+!  rm input.nml; echo &utilities_nml > input.nml  (no trailing / )
+!  rm input.nml; echo &file_utils_test_nml > input.nml
+!                echo / > input.nml (no &utilities_nml )
+! and run this test
+!----------------------------------------------------------------------
+
+! initialize the dart libs
+call initialize_mpi_utilities('file_utils_test')
+call register_module(source, revision, revdate)
+
+! Read the namelist entry
+call find_namelist_in_file("input.nml", "file_utils_test_nml", iunit)


More information about the Dart-dev mailing list