netcdf-c
netcdf-c copied to clipboard
netcdf-c-4.7.4 testsuite fails on s390x (big-endian)
The test suite fails on alpine linux edge s390x:
29: *** Testing compound types.
29: *** creating compound test file tst_comp.nc...ok.
29: *** Tests successful!
29: *** Running tst_nans.c to create test files.
29:
29: *** Testing NaN
29: *** creating NaN test file tst_nans.nc...ok.
29: *** Tests successful!
29: *** dumping tst_unicode.nc to tst_unicode.cdl...
29:
29: *** Testing UTF-8.
29: *** creating UTF-8 test file tst_unicode.nc...ok.
29: *** Tests successful!
29: *** Running tst_special_atts.c to create test files.
29:
29: *** Testing '-s' option for special attributes.
29: *** creating special attributes test file tst_special_atts.nc...ok.
29: *** Tests successful!
29: *** comparing tst_special_atts.cdl with ref_tst_special_atts.cdl...
29: --- tst_special_atts.tmp
29: +++ ref_tst_special_atts.tmp
29: @@ -45,10 +45,10 @@
29: var5:_NoFill = "true" ;
29: int var6(dim1) ;
29: var6:_Storage = "compact" ;
29: - var6:_Endianness = "big" ;
29: + var6:_Endianness = "little" ;
29: int var7 ;
29: var7:_Storage = "compact" ;
29: - var7:_Endianness = "big" ;
29: + var7:_Endianness = "little" ;
29:
29: // global attributes:
29: :_SuperblockVersion = 0 ;
1/1 Test #29: ncdump_tst_netcdf4 ...............***Failed 0.56 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.57 sec
The following tests FAILED:
29 - ncdump_tst_netcdf4 (Failed)
Errors while running CTest
This is a workaround that solves it. Not sure if it is the preferred fix.
diff --git a/ncdump/tst_special_atts.c b/ncdump/tst_special_atts.c
index 9655b86..e71cb7e 100644
--- a/ncdump/tst_special_atts.c
+++ b/ncdump/tst_special_atts.c
@@ -145,6 +145,10 @@ main(int argc, char **argv)
/* Set _Storage as compact */
if (nc_def_var_chunking(ncid, var6id, NC_COMPACT, NULL)) ERR;
if (nc_def_var_chunking(ncid, var7id, NC_COMPACT, NULL)) ERR;
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ if (nc_def_var_endian(ncid, var6id, NC_ENDIAN_LITTLE)) ERR;
+ if (nc_def_var_endian(ncid, var7id, NC_ENDIAN_LITTLE)) ERR;
+#endif
if (nc_enddef(ncid)) ERR;
This seems like an ok solution. For some other cases, we have modified the files being compared: tst_special_atts.cdl andref_tst_special_atts.cdl in this case. We edit the files to remove the endian attributes.
Thanks, applied in Gentoo for big endian arches as well.
@DennisHeimbigner Could this be considered for merging? Or is it not relevant anymore (fixed somehow elsewhere)?