netcdf-c/nc_test
Dennis Heimbigner 0b7a5382e7 Codify cross-platform file paths
The netcdf-c code has to deal with a variety of platforms:
Windows, OSX, Linux, Cygwin, MSYS, etc.  These platforms differ
significantly in the kind of file paths that they accept.  So in
order to handle this, I have created a set of replacements for
the most common file system operations such as _open_ or _fopen_
or _access_ to manage the file path differences correctly.

A more limited version of this idea was already implemented via
the ncwinpath.h and dwinpath.c code. So this can be viewed as a
replacement for that code. And in path in many cases, the only
change that was required was to replace '#include <ncwinpath.h>'
with '#include <ncpathmgt.h>' and then replace file operation
calls with the NCxxx equivalent from ncpathmgr.h Note that
recently, the ncwinpath.h was renamed ncpathmgmt.h, so this pull
request should not require dealing with winpath.

The heart of the change is include/ncpathmgmt.h, which provides
alternate operations such as NCfopen or NCaccess and which properly
parse and rebuild path arguments to work for the platform on which
the code is executing. This mostly matters for Windows because of the
way that it uses backslash and drive letters, as compared to *nix*.
One important feature is that the user can do string manipulations
on a file path without having to worry too much about the platform
because the path management code will properly handle most mixed cases.
So one can for example concatenate a path suffix that uses forward
slashes to a Windows path and have it work correctly.

The conversion code is in libdispatch/dpathmgr.c, and the
important function there is NCpathcvt which does the proper
conversions to the local path format.

As a rule, most code should just replace their file operations with
the corresponding NCxxx ones defined in include/ncpathmgmt.h. These
NCxxx functions all call NCpathcvt on their path arguments before
executing the actual file operation.

In some rare cases, the client may need to directly use NCpathcvt,
but this should be avoided as much as possible. If there is a need
for supporting a new file operation not already in ncpathmgmt.h, then
use the code in dpathmgr.c as a template. Also please notify Unidata
so we can include it as a formal part or our supported operations.
Also, if you see an operation in the library that is not using the
NCxxx form, then please submit an issue so we can fix it.

Misc. Changes:
* Clean up the utf8 testing code; it is impossible to get some
  tests to work under windows using shell scripts; the args do
  not pass as utf8 but as some other encoding.
* Added an extra utf8 test case: test_unicode_path.sh
* Add a true test for HDF5 1.10.6 or later because as noted in
  PR https://github.com/Unidata/netcdf-c/pull/1794,
  HDF5 changed its Windows file path handling.
2021-03-04 13:41:31 -07:00
..
bad_cdf5_begin.nc
CMakeLists.txt Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
error.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
error.h More copyright stanza updates. 2018-12-06 14:56:42 -07:00
f03tst_open_mem.nc Fix use of 'int' to represent 'hid_t' that caused HDF5 1.10 to fail. 2018-05-30 14:47:37 -06:00
large_files.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
make_test_file.sh Swapped /bin/bash for /bin/sh to test on osx. 2018-08-12 23:01:08 -06:00
Makefile.am Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
nc_enddef.cdl
nc_sync.cdl
nc_test.c Merge remote-tracking branch 'origin/license_update.wif' into pr-aggregation.wif 2018-12-11 17:08:21 -05:00
nc_test.html
quick_large_files.c Spelling fixes 2019-09-18 08:03:01 -06:00
ref_tst_diskless2.cdl
ref_tst_diskless3_create.cdl Fix cmake X mmap 2019-04-19 20:32:26 -06:00
ref_tst_diskless3_open.cdl Fix cmake X mmap 2019-04-19 20:32:26 -06:00
ref_tst_http_nc3.cdl Use the built-in HDF5 byte-range reader, if available. 2020-09-24 14:33:58 -06:00
ref_tst_http_nc4a.cdl Use the built-in HDF5 byte-range reader, if available. 2020-09-24 14:33:58 -06:00
ref_tst_http_nc4b.cdl Mostly revert the filter code to reduce its complexity of use. 2020-09-27 12:43:46 -06:00
ref_tst_http_nc4c.cdl Mostly revert the filter code to reduce its complexity of use. 2020-09-27 12:43:46 -06:00
run_cdf5.sh
run_diskless2.sh Fix more memory leaks in netcdf-c library 2018-11-15 10:00:38 -07:00
run_diskless5.sh
run_diskless.sh Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
run_inmemory.sh Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
run_mmap.sh Fix cmake X mmap 2019-04-19 20:32:26 -06:00
run_pnetcdf_test.sh Use PnetCDF instead of parallel-netcdf to avoid confusion with 2018-09-17 17:18:48 -05:00
t_nc_p5.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
t_nc.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
test_byterange.sh Cleanup byterange test URLS 2020-10-12 16:16:02 -06:00
test_get.m4 further removal of RELAX_COORD_BOUNDS macro 2019-11-26 06:45:26 -07:00
test_put.m4 removed non-relaxed coord bounds from test code 2019-11-26 06:20:34 -07:00
test_read.m4 removed non-relaxed coord bounds from test code 2019-11-26 06:20:34 -07:00
test_write.m4 removed non-relaxed coord bounds from test code 2019-11-26 06:20:34 -07:00
testnc3perf.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tests.h windows: detect Windows using the correct define name 2019-11-07 07:55:47 -05:00
tst_addvar.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tst_atts3.c fixed comment 2020-08-12 07:59:45 -06:00
tst_big_rvar.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_big_var2.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_big_var6.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_big_var.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_byterange.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_cdf5_begin.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tst_cdf5format.c Added int i and j declarations 2019-02-12 15:10:39 +00:00
tst_def_var_fill.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_default_format_pnetcdf.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_default_format.c Merge remote-tracking branch 'origin/license_update.wif' into pr-aggregation.wif 2018-12-11 17:08:21 -05:00
tst_diskless2.c Fix cmake X mmap 2019-04-19 20:32:26 -06:00
tst_diskless3.c Spelling fixes 2019-09-18 08:03:01 -06:00
tst_diskless4.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_diskless5.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tst_diskless5.cdl
tst_diskless6.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_diskless.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_err_enddef.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tst_formats.c Mostly revert the filter code to reduce its complexity of use. 2020-09-27 12:43:46 -06:00
tst_formatx_pnetcdf.c warnings fixes 2019-01-03 07:07:13 -07:00
tst_global_fillval.c Merge remote-tracking branch 'origin/license_update.wif' into pr-aggregation.wif 2018-12-11 17:08:21 -05:00
tst_inmemory.c warnings fixes 2019-01-03 07:07:13 -07:00
tst_inq_type.c merged ejh_test_null_vars_stride this time I mean it! 2019-01-03 06:36:58 -07:00
tst_large_cdf5.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_large.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_max_var_dims.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tst_meta.c cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
tst_misc.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_names.c Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
tst_nofill2.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_nofill3.c Spelling fixes 2019-09-18 08:03:01 -06:00
tst_nofill.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_norm.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_open_cdf5.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_open_mem.c Prepare for the path management code 2020-10-13 19:12:15 -06:00
tst_parallel2.c More copyright stanza updates. 2018-12-06 14:56:42 -07:00
tst_pnetcdf.c merged master 2019-01-02 03:52:51 -07:00
tst_small.c Spelling fixes 2019-09-18 08:03:01 -06:00
tst_utf8_phrases.c Spelling fixes 2019-09-18 08:03:01 -06:00
tst_utf8_validate.c Testing a fix for a failure I observed. 2018-12-06 17:46:30 -07:00
util.c merged ejh_test_null_vars_stride this time I mean it! 2019-01-03 06:36:58 -07:00