1#if 0
2/*********************************************************************
3 *   Copyright 1996, UCAR/Unidata
4 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
5 *   $Id: nf_test.F 2224 2015-12-16 06:10:36Z wkliao $
6 *********************************************************************/
7
8/*
9 * Test driver for netCDF-3 interface.  This program performs tests against
10 * the netCDF-3 specification for all user-level functions in an
11 * implementation of the netCDF library.
12 *
13 * Unless invoked with "-r" (readonly) option, must be invoked from a
14 * directory in which the invoker has write permission.
15 *
16 * Files:
17 * The read-only tests read files:
18 *     test.nc (see below)
19 *     test_get.F (used merely as an example of a non-netCDF file)
20 *
21 * The write tests
22 *     read test.nc (see below)
23 *     write scratch.nc (deleted after each test)
24 *
25 * The file test.nc is created by running nc_test with the -c (create) option.
26 */
27#endif
28
29        subroutine usage()
30        implicit        none
31        include "pnetcdf.inc"
32#include "tests.inc"
33
34        integer MY_LEN_TRIM
35        call error('Usage: '//TRIM(progname)//
36     +             ' [-c | -hrv -n <MAX_NMPT>]')
37        call error('       nf_test [-c]')
38        call error('   [-h] Print help' )
39        call error('   [-c] Create file test.nc (Do not do tests)' )
40        call error('   [-1] test CDF-1 format' )
41        call error('   [-2] test CDF-2 format' )
42        call error('   [-5] test CDF-5 format' )
43        call error('   [-r] Just do read-only tests' )
44        call error(
45     +  '   [-d directory] directory for storing input/output files' )
46        call error('   [-v] Verbose mode' )
47        call error(
48     +  '   [-n <max>] max. number of messages per test (Default: 20)')
49        end
50
51
52        subroutine report_test
53        implicit        none
54        character*128   msg
55#include "tests.inc"
56
57        integer MY_LEN_TRIM
58        write(msg,"(A,I1)") '*** TESTING F77 '//
59     +                      TRIM(PROGNAME)//
60     +                      ' for CDF-', cdf_format
61        if (nfailsTotal .ne. 0) then
62          write(*,*) TRIM(PROGNAME)//
63     +               ' expects to see 0 failure ... '//
64     +               'Total number of failures: ', nfailsTotal
65        endif
66        call pass_fail(nfailsTotal, msg)
67        end
68
69        subroutine test(name, func)
70        implicit        none
71        character*(*)   name
72        character*25    name_str
73        integer         name_len
74        external        func
75        include "pnetcdf.inc"
76#include "tests.inc"
77
78        integer MY_LEN_TRIM
79        name_len = MY_LEN_TRIM(name)
80        name_str(1:name_len) = name(:)
81        name_str(name_len+1:25) = ' '
82        if (verbose) write(*, 1) name_str
831       format('*** Testing ', a, ' ... ')
84
85        nfails = 0
86        call func()
87        nfailsTotal = nfailsTotal + nfails
88        if ( nfails .ne. 0) then
89            print *, ' '
90            print *, '  ### ', nfails, ' FAILURES TESTING ', name,
91     +               '! Stop ... ###'
92            call report_test
93            stop
94        end if
95        end
96
97
98#if _CRAYIEEE
99! which machines need this?
100        subroutine getarg(iarg, carg)
101        implicit        none
102        integer iarg
103        character*(*)   carg
104        integer ilen
105        integer ierror
106        call PXFGETARG(iarg, carg, ilen, ierror)
107        end
108#endif
109
110        program nf_test
111#if defined(VISUAL_CPLUSPLUS)
112!       DIGITAL Visual Fortran needs DFLIB for getarg
113        USE DFLIB
114!       DIGITAL Visual Fortran needs DFPORT for iargc
115        USE DFPORT
116        implicit        none
117#elif defined(NAGf90Fortran)
118        USE F90_UNIX_ENV, only : iargc, getarg
119        implicit none
120#else
121        implicit        none
122        integer         iargc
123#endif
124#if defined(__crayx1)
125        integer         ipxfargc
126#endif
127        include "pnetcdf.inc"
128#include "tests.inc"
129
130        integer         argc
131        character*80    arg
132        integer         iarg
133        integer         iopt
134        character*1     opt
135        integer         lastopt
136        logical         skiparg
137        integer         err
138        integer MY_LEN_TRIM
139
140        external        test_nfmpi_strerror
141        external        test_nfmpi_open
142        external        test_nfmpi_close
143        external        test_nfmpi_inq
144        external        test_nfmpi_inq_dimid
145        external        test_nfmpi_inq_dim
146        external        test_nfmpi_inq_dimlen
147        external        test_nfmpi_inq_dimname
148        external        test_nfmpi_inq_varid
149        external        test_nfmpi_inq_var
150        external        test_nfmpi_inq_natts
151        external        test_nfmpi_inq_ndims
152        external        test_nfmpi_inq_nvars
153        external        test_nfmpi_inq_unlimdim
154        external        test_nfmpi_inq_vardimid
155        external        test_nfmpi_inq_varname
156        external        test_nfmpi_inq_varnatts
157        external        test_nfmpi_inq_varndims
158        external        test_nfmpi_inq_vartype
159        external        test_nfmpi_get_var1_text
160#if defined(NF_INT1_T)
161        external        test_nfmpi_get_var1_int1
162#endif
163#if defined(NF_INT2_T)
164        external        test_nfmpi_get_var1_int2
165#endif
166        external        test_nfmpi_get_var1_int
167        external        test_nfmpi_get_var1_real
168        external        test_nfmpi_get_var1_double
169        external        test_nfmpi_get_var1_int8
170        external        test_nfmpi_get_var_text
171#if defined(NF_INT1_T)
172        external        test_nfmpi_get_var_int1
173#endif
174#if defined(NF_INT2_T)
175        external        test_nfmpi_get_var_int2
176#endif
177        external        test_nfmpi_get_var_int
178        external        test_nfmpi_get_var_real
179        external        test_nfmpi_get_var_double
180        external        test_nfmpi_get_var_int8
181        external        test_nfmpi_get_vara_text
182#if defined(NF_INT1_T)
183        external        test_nfmpi_get_vara_int1
184#endif
185#if defined(NF_INT2_T)
186        external        test_nfmpi_get_vara_int2
187#endif
188        external        test_nfmpi_get_vara_int
189        external        test_nfmpi_get_vara_real
190        external        test_nfmpi_get_vara_double
191        external        test_nfmpi_get_vara_int8
192        external        test_nfmpi_get_vars_text
193#if defined(NF_INT1_T)
194        external        test_nfmpi_get_vars_int1
195#endif
196#if defined(NF_INT2_T)
197        external        test_nfmpi_get_vars_int2
198#endif
199        external        test_nfmpi_get_vars_int
200        external        test_nfmpi_get_vars_real
201        external        test_nfmpi_get_vars_double
202        external        test_nfmpi_get_vars_int8
203
204        external        test_nfmpi_get_varm_text
205#if defined(NF_INT1_T)
206        external        test_nfmpi_get_varm_int1
207#endif
208#if defined(NF_INT2_T)
209        external        test_nfmpi_get_varm_int2
210#endif
211        external        test_nfmpi_get_varm_int
212        external        test_nfmpi_get_varm_real
213        external        test_nfmpi_get_varm_double
214        external        test_nfmpi_get_varm_int8
215
216        external        test_nfmpi_iget_var1_text
217#if defined(NF_INT1_T)
218        external        test_nfmpi_iget_var1_int1
219#endif
220#if defined(NF_INT2_T)
221        external        test_nfmpi_iget_var1_int2
222#endif
223        external        test_nfmpi_iget_var1_int
224        external        test_nfmpi_iget_var1_real
225        external        test_nfmpi_iget_var1_double
226        external        test_nfmpi_iget_var1_int8
227        external        test_nfmpi_iget_var_text
228#if defined(NF_INT1_T)
229        external        test_nfmpi_iget_var_int1
230#endif
231#if defined(NF_INT2_T)
232        external        test_nfmpi_iget_var_int2
233#endif
234        external        test_nfmpi_iget_var_int
235        external        test_nfmpi_iget_var_real
236        external        test_nfmpi_iget_var_double
237        external        test_nfmpi_iget_var_int8
238        external        test_nfmpi_iget_vara_text
239#if defined(NF_INT1_T)
240        external        test_nfmpi_iget_vara_int1
241#endif
242#if defined(NF_INT2_T)
243        external        test_nfmpi_iget_vara_int2
244#endif
245        external        test_nfmpi_iget_vara_int
246        external        test_nfmpi_iget_vara_real
247        external        test_nfmpi_iget_vara_double
248        external        test_nfmpi_iget_vara_int8
249        external        test_nfmpi_iget_vars_text
250#if defined(NF_INT1_T)
251        external        test_nfmpi_iget_vars_int1
252#endif
253#if defined(NF_INT2_T)
254        external        test_nfmpi_iget_vars_int2
255#endif
256        external        test_nfmpi_iget_vars_int
257        external        test_nfmpi_iget_vars_real
258        external        test_nfmpi_iget_vars_double
259        external        test_nfmpi_iget_vars_int8
260
261        external        test_nfmpi_iget_varm_text
262#if defined(NF_INT1_T)
263        external        test_nfmpi_iget_varm_int1
264#endif
265#if defined(NF_INT2_T)
266        external        test_nfmpi_iget_varm_int2
267#endif
268        external        test_nfmpi_iget_varm_int
269        external        test_nfmpi_iget_varm_real
270        external        test_nfmpi_iget_varm_double
271        external        test_nfmpi_iget_varm_int8
272
273        external        test_nfmpi_get_att_text
274#if defined(NF_INT1_T)
275        external        test_nfmpi_get_att_int1
276#endif
277#if defined(NF_INT2_T)
278        external        test_nfmpi_get_att_int2
279#endif
280        external        test_nfmpi_get_att_int
281        external        test_nfmpi_get_att_real
282        external        test_nfmpi_get_att_double
283        external        test_nfmpi_get_att_int8
284        external        test_nfmpi_inq_att
285        external        test_nfmpi_inq_attname
286        external        test_nfmpi_inq_attid
287        external        test_nfmpi_inq_attlen
288        external        test_nfmpi_inq_atttype
289        external        test_nfmpi_create
290        external        test_nfmpi_redef
291        external        test_nfmpi_enddef
292        external        test_nfmpi_sync
293        external        test_nfmpi_abort
294        external        test_nfmpi_def_dim
295        external        test_nfmpi_rename_dim
296        external        test_nfmpi_def_var
297        external        test_nfmpi_put_var1_text
298#if defined(NF_INT1_T)
299        external        test_nfmpi_put_var1_int1
300#endif
301#if defined(NF_INT2_T)
302        external        test_nfmpi_put_var1_int2
303#endif
304        external        test_nfmpi_put_var1_int
305        external        test_nfmpi_put_var1_real
306        external        test_nfmpi_put_var1_double
307        external        test_nfmpi_put_var1_int8
308        external        test_nfmpi_put_var_text
309#if defined(NF_INT1_T)
310        external        test_nfmpi_put_var_int1
311#endif
312#if defined(NF_INT2_T)
313        external        test_nfmpi_put_var_int2
314#endif
315        external        test_nfmpi_put_var_int
316        external        test_nfmpi_put_var_real
317        external        test_nfmpi_put_var_double
318        external        test_nfmpi_put_var_int8
319        external        test_nfmpi_put_vara_text
320#if defined(NF_INT1_T)
321        external        test_nfmpi_put_vara_int1
322#endif
323#if defined(NF_INT2_T)
324        external        test_nfmpi_put_vara_int2
325#endif
326        external        test_nfmpi_put_vara_int
327        external        test_nfmpi_put_vara_real
328        external        test_nfmpi_put_vara_double
329        external        test_nfmpi_put_vara_int8
330        external        test_nfmpi_put_vars_text
331#if defined(NF_INT1_T)
332        external        test_nfmpi_put_vars_int1
333#endif
334#if defined(NF_INT2_T)
335        external        test_nfmpi_put_vars_int2
336#endif
337        external        test_nfmpi_put_vars_int
338        external        test_nfmpi_put_vars_real
339        external        test_nfmpi_put_vars_double
340        external        test_nfmpi_put_vars_int8
341
342        external        test_nfmpi_put_varm_text
343#if defined(NF_INT1_T)
344        external        test_nfmpi_put_varm_int1
345#endif
346#if defined(NF_INT2_T)
347        external        test_nfmpi_put_varm_int2
348#endif
349        external        test_nfmpi_put_varm_int
350        external        test_nfmpi_put_varm_real
351        external        test_nfmpi_put_varm_double
352        external        test_nfmpi_put_varm_int8
353
354        external        test_nfmpi_iput_var1_text
355#if defined(NF_INT1_T)
356        external        test_nfmpi_iput_var1_int1
357#endif
358#if defined(NF_INT2_T)
359        external        test_nfmpi_iput_var1_int2
360#endif
361        external        test_nfmpi_iput_var1_int
362        external        test_nfmpi_iput_var1_real
363        external        test_nfmpi_iput_var1_double
364        external        test_nfmpi_iput_var1_int8
365        external        test_nfmpi_iput_var_text
366#if defined(NF_INT1_T)
367        external        test_nfmpi_iput_var_int1
368#endif
369#if defined(NF_INT2_T)
370        external        test_nfmpi_iput_var_int2
371#endif
372        external        test_nfmpi_iput_var_int
373        external        test_nfmpi_iput_var_real
374        external        test_nfmpi_iput_var_double
375        external        test_nfmpi_iput_var_int8
376        external        test_nfmpi_iput_vara_text
377#if defined(NF_INT1_T)
378        external        test_nfmpi_iput_vara_int1
379#endif
380#if defined(NF_INT2_T)
381        external        test_nfmpi_iput_vara_int2
382#endif
383        external        test_nfmpi_iput_vara_int
384        external        test_nfmpi_iput_vara_real
385        external        test_nfmpi_iput_vara_double
386        external        test_nfmpi_iput_vara_int8
387        external        test_nfmpi_iput_vars_text
388#if defined(NF_INT1_T)
389        external        test_nfmpi_iput_vars_int1
390#endif
391#if defined(NF_INT2_T)
392        external        test_nfmpi_iput_vars_int2
393#endif
394        external        test_nfmpi_iput_vars_int
395        external        test_nfmpi_iput_vars_real
396        external        test_nfmpi_iput_vars_double
397        external        test_nfmpi_iput_vars_int8
398
399        external        test_nfmpi_iput_varm_text
400#if defined(NF_INT1_T)
401        external        test_nfmpi_iput_varm_int1
402#endif
403#if defined(NF_INT2_T)
404        external        test_nfmpi_iput_varm_int2
405#endif
406        external        test_nfmpi_iput_varm_int
407        external        test_nfmpi_iput_varm_real
408        external        test_nfmpi_iput_varm_double
409        external        test_nfmpi_iput_varm_int8
410
411        external        test_nfmpi_rename_var
412        external        test_nfmpi_put_att_text
413#if defined(NF_INT1_T)
414        external        test_nfmpi_put_att_int1
415#endif
416#if defined(NF_INT2_T)
417        external        test_nfmpi_put_att_int2
418#endif
419        external        test_nfmpi_put_att_int
420        external        test_nfmpi_put_att_real
421        external        test_nfmpi_put_att_double
422        external        test_nfmpi_put_att_int8
423        external        test_nfmpi_copy_att
424        external        test_nfmpi_rename_att
425        external        test_nfmpi_del_att
426        external        test_nfmpi_set_fill
427#if 0
428        external        test_nfmpi_set_default_format
429#endif
430        external        nc_ignorefpe
431
432        call MPI_INIT(err)
433        comm = MPI_COMM_WORLD
434
435        call nc_ignorefpe(1)
436
437        testfile = 'test.nc'
438        scratch = 'scratch.nc'
439
440        nfailsTotal = 0
441        call getarg(0, progname)
442        create_file = .false.   !/* file test.nc will normally already exist */
443        readonly = .false.      !/* assume may write in test dir as default */
444        verbose = .false.
445        max_nmpt = 20
446        skiparg = .false.
447        cdf_format = 1
448        extra_flags = 0
449
450#if defined(__crayx1)
451        argc = ipxfargc()
452#else
453        argc = iargc()
454#endif
455        call getarg(0, PROGNAME)
456
457        do 1, iarg = 1, argc
458            if (skiparg) then
459                skiparg = .false.
460            else
461                call getarg(iarg, arg)
462                if (arg(1:1) .eq. '-') then
463                    lastopt = index(arg, ' ') - 1
464                    do 2, iopt = 2, lastopt
465                        opt = arg(iopt:iopt)
466                        if (opt .eq. 'c') then
467                            create_file = .true.
468                        else if (opt .eq. 'r') then
469                            readonly = .true.
470                        else if (opt .eq. 'v') then
471                            verbose = .true.
472                        else if (opt .eq. 'n') then
473                            call getarg(iarg+1, arg)
474                            ! NOTE: The UNICOS 8 fort77(1) compiler does
475                            ! not support list-directed I/O from an internal
476                            ! file -- so we use a format specification.
477                            read (arg, '(i6)') max_nmpt
478                            skiparg = .true.
479                            go to 1
480                        else if (opt .eq. '1') then
481                            cdf_format = 1
482                        else if (opt .eq. '2') then
483                            cdf_format = 2
484                            extra_flags = NF_64BIT_OFFSET
485                        else if (opt .eq. '5') then
486                            cdf_format = 5
487                            extra_flags = NF_64BIT_DATA
488                        else if (opt .eq. 'd') then
489                            call getarg(iarg+1, arg)
490                            testfile = TRIM(arg)//
491     +                                 "/test.nc"
492                            scratch = TRIM(arg) //
493     +                                 "/scratch.nc"
494                            skiparg = .true.
495                            go to 1
496                        else
497                            call usage
498                            call ud_exit(1)
499                        end if
500    2           continue
501                else
502                    call usage
503                    call ud_exit(1)
504                end if
505            end if
5061       continue
507
508        numGatts = 6
509        numVars  = 136
510        numTypes = 6
511        if (cdf_format .EQ. 5) then
512            numGatts = NGATTS
513            numVars  = NVARS
514            numTypes = NTYPES
515        endif
516
517C       PVFS2 driver has a problem of ADIOI_Set_lock when data sieving is
518C       enabled
519        call MPI_Info_create(info, err)
520C       call MPI_Info_set(info, "romio_pvfs2_posix_write", "enable",err)
521
522C       /* Initialize global variables defining test file */
523        call init_gvars
524
525        if ( create_file ) then
526            call write_file(testfile)
527            call MPI_Info_free(info, err)
528            if (nfailsTotal .eq. 0)
529     +           call ud_exit(0)
530            call ud_exit(1)
531        end if
532
533C       /* delete any existing scratch netCDF file */
534        if ( .not. readonly )
535     +      err = nfmpi_delete(scratch, MPI_INFO_NULL)
536
537C       /* Test read-only functions, using pregenerated test-file */
538        call test('nfmpi_strerror', test_nfmpi_strerror)
539        call test('nfmpi_open', test_nfmpi_open)
540        call test('nfmpi_close', test_nfmpi_close)
541        call test('nfmpi_inq', test_nfmpi_inq)
542        call test('nfmpi_inq_dimid', test_nfmpi_inq_dimid)
543        call test('nfmpi_inq_dim', test_nfmpi_inq_dim)
544        call test('nfmpi_inq_dimlen', test_nfmpi_inq_dimlen)
545        call test('nfmpi_inq_dimname', test_nfmpi_inq_dimname)
546        call test('nfmpi_inq_varid', test_nfmpi_inq_varid)
547        call test('nfmpi_inq_var', test_nfmpi_inq_var)
548        call test('nfmpi_inq_natts', test_nfmpi_inq_natts)
549        call test('nfmpi_inq_ndims', test_nfmpi_inq_ndims)
550        call test('nfmpi_inq_nvars', test_nfmpi_inq_nvars)
551        call test('nfmpi_inq_unlimdim', test_nfmpi_inq_unlimdim)
552        call test('nfmpi_inq_vardimid', test_nfmpi_inq_vardimid)
553        call test('nfmpi_inq_varname', test_nfmpi_inq_varname)
554        call test('nfmpi_inq_varnatts', test_nfmpi_inq_varnatts)
555        call test('nfmpi_inq_varndims', test_nfmpi_inq_varndims)
556        call test('nfmpi_inq_vartype', test_nfmpi_inq_vartype)
557
558        call test('nfmpi_get_var1_text', test_nfmpi_get_var1_text)
559#if defined(NF_INT1_T)
560        call test('nfmpi_get_var1_int1', test_nfmpi_get_var1_int1)
561#endif
562#if defined(NF_INT2_T)
563        call test('nfmpi_get_var1_int2', test_nfmpi_get_var1_int2)
564#endif
565        call test('nfmpi_get_var1_int', test_nfmpi_get_var1_int)
566        call test('nfmpi_get_var1_real', test_nfmpi_get_var1_real)
567        call test('nfmpi_get_var1_double', test_nfmpi_get_var1_double)
568        call test('nfmpi_get_var1_int8', test_nfmpi_get_var1_int8)
569
570        call test('nfmpi_get_var_text', test_nfmpi_get_var_text)
571#if defined(NF_INT1_T)
572        call test('nfmpi_get_var_int1', test_nfmpi_get_var_int1)
573#endif
574#if defined(NF_INT2_T)
575        call test('nfmpi_get_var_int2', test_nfmpi_get_var_int2)
576#endif
577        call test('nfmpi_get_var_int', test_nfmpi_get_var_int)
578        call test('nfmpi_get_var_real', test_nfmpi_get_var_real)
579        call test('nfmpi_get_var_double', test_nfmpi_get_var_double)
580        call test('nfmpi_get_var_int8', test_nfmpi_get_var_int8)
581
582        call test('nfmpi_get_vara_text', test_nfmpi_get_vara_text)
583#if defined(NF_INT1_T)
584        call test('nfmpi_get_vara_int1', test_nfmpi_get_vara_int1)
585#endif
586#if defined(NF_INT2_T)
587        call test('nfmpi_get_vara_int2', test_nfmpi_get_vara_int2)
588#endif
589        call test('nfmpi_get_vara_int', test_nfmpi_get_vara_int)
590        call test('nfmpi_get_vara_real', test_nfmpi_get_vara_real)
591        call test('nfmpi_get_vara_double', test_nfmpi_get_vara_double)
592        call test('nfmpi_get_vara_int8', test_nfmpi_get_vara_int8)
593
594        call test('nfmpi_get_vars_text', test_nfmpi_get_vars_text)
595#if defined(NF_INT1_T)
596        call test('nfmpi_get_vars_int1', test_nfmpi_get_vars_int1)
597#endif
598#if defined(NF_INT2_T)
599        call test('nfmpi_get_vars_int2', test_nfmpi_get_vars_int2)
600#endif
601        call test('nfmpi_get_vars_int', test_nfmpi_get_vars_int)
602        call test('nfmpi_get_vars_real', test_nfmpi_get_vars_real)
603        call test('nfmpi_get_vars_double', test_nfmpi_get_vars_double)
604        call test('nfmpi_get_vars_int8', test_nfmpi_get_vars_int8)
605
606        call test('nfmpi_get_varm_text', test_nfmpi_get_varm_text)
607#if defined(NF_INT1_T)
608        call test('nfmpi_get_varm_int1', test_nfmpi_get_varm_int1)
609#endif
610#if defined(NF_INT2_T)
611        call test('nfmpi_get_varm_int2', test_nfmpi_get_varm_int2)
612#endif
613        call test('nfmpi_get_varm_int', test_nfmpi_get_varm_int)
614        call test('nfmpi_get_varm_real', test_nfmpi_get_varm_real)
615        call test('nfmpi_get_varm_double', test_nfmpi_get_varm_double)
616        call test('nfmpi_get_varm_int8', test_nfmpi_get_varm_int8)
617
618        call test('nfmpi_iget_var1_text', test_nfmpi_iget_var1_text)
619#if defined(NF_INT1_T)
620        call test('nfmpi_iget_var1_int1', test_nfmpi_iget_var1_int1)
621#endif
622#if defined(NF_INT2_T)
623        call test('nfmpi_iget_var1_int2', test_nfmpi_iget_var1_int2)
624#endif
625        call test('nfmpi_iget_var1_int', test_nfmpi_iget_var1_int)
626        call test('nfmpi_iget_var1_real', test_nfmpi_iget_var1_real)
627        call test('nfmpi_iget_var1_double', test_nfmpi_iget_var1_double)
628        call test('nfmpi_iget_var1_int8', test_nfmpi_iget_var1_int8)
629
630        call test('nfmpi_iget_var_text', test_nfmpi_iget_var_text)
631#if defined(NF_INT1_T)
632        call test('nfmpi_iget_var_int1', test_nfmpi_iget_var_int1)
633#endif
634#if defined(NF_INT2_T)
635        call test('nfmpi_iget_var_int2', test_nfmpi_iget_var_int2)
636#endif
637        call test('nfmpi_iget_var_int', test_nfmpi_iget_var_int)
638        call test('nfmpi_iget_var_real', test_nfmpi_iget_var_real)
639        call test('nfmpi_iget_var_double', test_nfmpi_iget_var_double)
640        call test('nfmpi_iget_var_int8', test_nfmpi_iget_var_int8)
641
642        call test('nfmpi_iget_vara_text', test_nfmpi_iget_vara_text)
643#if defined(NF_INT1_T)
644        call test('nfmpi_iget_vara_int1', test_nfmpi_iget_vara_int1)
645#endif
646#if defined(NF_INT2_T)
647        call test('nfmpi_iget_vara_int2', test_nfmpi_iget_vara_int2)
648#endif
649        call test('nfmpi_iget_vara_int', test_nfmpi_iget_vara_int)
650        call test('nfmpi_iget_vara_real', test_nfmpi_iget_vara_real)
651        call test('nfmpi_iget_vara_double', test_nfmpi_iget_vara_double)
652        call test('nfmpi_iget_vara_int8', test_nfmpi_iget_vara_int8)
653
654        call test('nfmpi_iget_vars_text', test_nfmpi_iget_vars_text)
655#if defined(NF_INT1_T)
656        call test('nfmpi_iget_vars_int1', test_nfmpi_iget_vars_int1)
657#endif
658#if defined(NF_INT2_T)
659        call test('nfmpi_iget_vars_int2', test_nfmpi_iget_vars_int2)
660#endif
661        call test('nfmpi_iget_vars_int', test_nfmpi_iget_vars_int)
662        call test('nfmpi_iget_vars_real', test_nfmpi_iget_vars_real)
663        call test('nfmpi_iget_vars_double', test_nfmpi_iget_vars_double)
664        call test('nfmpi_iget_vars_int8', test_nfmpi_iget_vars_int8)
665
666        call test('nfmpi_iget_varm_text', test_nfmpi_iget_varm_text)
667#if defined(NF_INT1_T)
668        call test('nfmpi_iget_varm_int1', test_nfmpi_iget_varm_int1)
669#endif
670#if defined(NF_INT2_T)
671        call test('nfmpi_iget_varm_int2', test_nfmpi_iget_varm_int2)
672#endif
673        call test('nfmpi_iget_varm_int', test_nfmpi_iget_varm_int)
674        call test('nfmpi_iget_varm_real', test_nfmpi_iget_varm_real)
675        call test('nfmpi_iget_varm_double', test_nfmpi_iget_varm_double)
676        call test('nfmpi_iget_varm_int8', test_nfmpi_iget_varm_int8)
677
678        call test('nfmpi_get_att_text', test_nfmpi_get_att_text)
679#if defined(NF_INT1_T)
680        call test('nfmpi_get_att_int1', test_nfmpi_get_att_int1)
681#endif
682#if defined(NF_INT2_T)
683        call test('nfmpi_get_att_int2', test_nfmpi_get_att_int2)
684#endif
685        call test('nfmpi_get_att_int', test_nfmpi_get_att_int)
686        call test('nfmpi_get_att_real', test_nfmpi_get_att_real)
687        call test('nfmpi_get_att_double', test_nfmpi_get_att_double)
688        call test('nfmpi_get_att_int8', test_nfmpi_get_att_int8)
689        call test('nfmpi_inq_att', test_nfmpi_inq_att)
690        call test('nfmpi_inq_attname', test_nfmpi_inq_attname)
691        call test('nfmpi_inq_attid', test_nfmpi_inq_attid)
692        call test('nfmpi_inq_attlen', test_nfmpi_inq_attlen)
693        call test('nfmpi_inq_atttype', test_nfmpi_inq_atttype)
694
695C           /* Test write functions */
696        if (.not. readonly) then
697            call test('nfmpi_create', test_nfmpi_create)
698            call test('nfmpi_redef', test_nfmpi_redef)
699            call test('nfmpi_enddef', test_nfmpi_enddef)
700            call test('nfmpi_sync', test_nfmpi_sync)
701            call test('nfmpi_abort', test_nfmpi_abort)
702            call test('nfmpi_def_dim', test_nfmpi_def_dim)
703            call test('nfmpi_rename_dim', test_nfmpi_rename_dim)
704            call test('nfmpi_def_var', test_nfmpi_def_var)
705            call test('nfmpi_put_var1_text', test_nfmpi_put_var1_text)
706#if defined(NF_INT1_T)
707            call test('nfmpi_put_var1_int1', test_nfmpi_put_var1_int1)
708#endif
709#if defined(NF_INT2_T)
710            call test('nfmpi_put_var1_int2', test_nfmpi_put_var1_int2)
711#endif
712            call test('nfmpi_put_var1_int', test_nfmpi_put_var1_int)
713            call test('nfmpi_put_var1_real', test_nfmpi_put_var1_real)
714            call test('nfmpi_put_var1_double',
715     +                 test_nfmpi_put_var1_double)
716            call test('nfmpi_put_var1_int8', test_nfmpi_put_var1_int8)
717            call test('nfmpi_put_var_text', test_nfmpi_put_var_text)
718#if defined(NF_INT1_T)
719            call test('nfmpi_put_var_int1', test_nfmpi_put_var_int1)
720#endif
721#if defined(NF_INT2_T)
722            call test('nfmpi_put_var_int2', test_nfmpi_put_var_int2)
723#endif
724            call test('nfmpi_put_var_int', test_nfmpi_put_var_int)
725            call test('nfmpi_put_var_real', test_nfmpi_put_var_real)
726            call test('nfmpi_put_var_double',
727     +                 test_nfmpi_put_var_double)
728            call test('nfmpi_put_var_int8', test_nfmpi_put_var_int8)
729            call test('nfmpi_put_vara_text', test_nfmpi_put_vara_text)
730#if defined(NF_INT1_T)
731            call test('nfmpi_put_vara_int1', test_nfmpi_put_vara_int1)
732#endif
733#if defined(NF_INT2_T)
734            call test('nfmpi_put_vara_int2', test_nfmpi_put_vara_int2)
735#endif
736            call test('nfmpi_put_vara_int', test_nfmpi_put_vara_int)
737            call test('nfmpi_put_vara_real', test_nfmpi_put_vara_real)
738            call test('nfmpi_put_vara_double',
739     +                 test_nfmpi_put_vara_double)
740            call test('nfmpi_put_vara_int8', test_nfmpi_put_vara_int8)
741            call test('nfmpi_put_vars_text', test_nfmpi_put_vars_text)
742#if defined(NF_INT1_T)
743            call test('nfmpi_put_vars_int1', test_nfmpi_put_vars_int1)
744#endif
745#if defined(NF_INT2_T)
746            call test('nfmpi_put_vars_int2', test_nfmpi_put_vars_int2)
747#endif
748            call test('nfmpi_put_vars_int', test_nfmpi_put_vars_int)
749            call test('nfmpi_put_vars_real', test_nfmpi_put_vars_real)
750            call test('nfmpi_put_vars_double',
751     +                 test_nfmpi_put_vars_double)
752            call test('nfmpi_put_vars_int8', test_nfmpi_put_vars_int8)
753
754            call test('nfmpi_put_varm_text', test_nfmpi_put_varm_text)
755#if defined(NF_INT1_T)
756            call test('nfmpi_put_varm_int1', test_nfmpi_put_varm_int1)
757#endif
758#if defined(NF_INT2_T)
759            call test('nfmpi_put_varm_int2', test_nfmpi_put_varm_int2)
760#endif
761            call test('nfmpi_put_varm_int', test_nfmpi_put_varm_int)
762            call test('nfmpi_put_varm_real', test_nfmpi_put_varm_real)
763            call test('nfmpi_put_varm_double',
764     +                 test_nfmpi_put_varm_double)
765            call test('nfmpi_put_varm_int8', test_nfmpi_put_varm_int8)
766
767            call test('nfmpi_iput_var1_text', test_nfmpi_iput_var1_text)
768#if defined(NF_INT1_T)
769            call test('nfmpi_iput_var1_int1', test_nfmpi_iput_var1_int1)
770#endif
771#if defined(NF_INT2_T)
772            call test('nfmpi_iput_var1_int2', test_nfmpi_iput_var1_int2)
773#endif
774            call test('nfmpi_iput_var1_int', test_nfmpi_iput_var1_int)
775            call test('nfmpi_iput_var1_real', test_nfmpi_iput_var1_real)
776            call test('nfmpi_iput_var1_double',
777     +                 test_nfmpi_iput_var1_double)
778            call test('nfmpi_iput_var1_int8', test_nfmpi_iput_var1_int8)
779
780            call test('nfmpi_iput_var_text', test_nfmpi_iput_var_text)
781#if defined(NF_INT1_T)
782            call test('nfmpi_iput_var_int1', test_nfmpi_iput_var_int1)
783#endif
784#if defined(NF_INT2_T)
785            call test('nfmpi_iput_var_int2', test_nfmpi_iput_var_int2)
786#endif
787            call test('nfmpi_iput_var_int', test_nfmpi_iput_var_int)
788            call test('nfmpi_iput_var_real', test_nfmpi_iput_var_real)
789            call test('nfmpi_iput_var_double',
790     +                 test_nfmpi_iput_var_double)
791            call test('nfmpi_iput_var_int8', test_nfmpi_iput_var_int8)
792
793            call test('nfmpi_iput_vara_text', test_nfmpi_iput_vara_text)
794#if defined(NF_INT1_T)
795            call test('nfmpi_iput_vara_int1', test_nfmpi_iput_vara_int1)
796#endif
797#if defined(NF_INT2_T)
798            call test('nfmpi_iput_vara_int2', test_nfmpi_iput_vara_int2)
799#endif
800            call test('nfmpi_iput_vara_int', test_nfmpi_iput_vara_int)
801            call test('nfmpi_iput_vara_real', test_nfmpi_iput_vara_real)
802            call test('nfmpi_iput_vara_double',
803     +                 test_nfmpi_iput_vara_double)
804            call test('nfmpi_iput_vara_int8', test_nfmpi_iput_vara_int8)
805
806            call test('nfmpi_iput_vars_text', test_nfmpi_iput_vars_text)
807#if defined(NF_INT1_T)
808            call test('nfmpi_iput_vars_int1', test_nfmpi_iput_vars_int1)
809#endif
810#if defined(NF_INT2_T)
811            call test('nfmpi_iput_vars_int2', test_nfmpi_iput_vars_int2)
812#endif
813            call test('nfmpi_iput_vars_int', test_nfmpi_iput_vars_int)
814            call test('nfmpi_iput_vars_real', test_nfmpi_iput_vars_real)
815            call test('nfmpi_iput_vars_double',
816     +                 test_nfmpi_iput_vars_double)
817            call test('nfmpi_iput_vars_int8', test_nfmpi_iput_vars_int8)
818
819            call test('nfmpi_iput_varm_text', test_nfmpi_iput_varm_text)
820#if defined(NF_INT1_T)
821            call test('nfmpi_iput_varm_int1', test_nfmpi_iput_varm_int1)
822#endif
823#if defined(NF_INT2_T)
824            call test('nfmpi_iput_varm_int2', test_nfmpi_iput_varm_int2)
825#endif
826            call test('nfmpi_iput_varm_int', test_nfmpi_iput_varm_int)
827            call test('nfmpi_iput_varm_real', test_nfmpi_iput_varm_real)
828            call test('nfmpi_iput_varm_double',
829     +                 test_nfmpi_iput_varm_double)
830            call test('nfmpi_iput_varm_int8', test_nfmpi_iput_varm_int8)
831
832            call test('nfmpi_rename_var', test_nfmpi_rename_var)
833            call test('nfmpi_put_att_text', test_nfmpi_put_att_text)
834#if defined(NF_INT1_T)
835            call test('nfmpi_put_att_int1', test_nfmpi_put_att_int1)
836#endif
837#if defined(NF_INT2_T)
838            call test('nfmpi_put_att_int2', test_nfmpi_put_att_int2)
839#endif
840            call test('nfmpi_put_att_int', test_nfmpi_put_att_int)
841            call test('nfmpi_put_att_real', test_nfmpi_put_att_real)
842            call test('nfmpi_put_att_double',
843     +                 test_nfmpi_put_att_double)
844            call test('nfmpi_put_att_int8', test_nfmpi_put_att_int8)
845            call test('nfmpi_copy_att', test_nfmpi_copy_att)
846            call test('nfmpi_rename_att', test_nfmpi_rename_att)
847            call test('nfmpi_del_att', test_nfmpi_del_att)
848            call test('nfmpi_set_fill', test_nfmpi_set_fill)
849#if 0
850            call test('nfmpi_set_default_format',
851     +                test_nfmpi_set_default_format);
852#endif
853        end if
854
855        call MPI_Info_free(info, err)
856
857        call report_test
858
859        ! if (nfailsTotal .eq. 0) call ud_exit(0)
860        call ud_exit(0)
861        end
862