|
35 | 35 | #define COMP_FLOAT_VAL (-42.0F) |
36 | 36 | #define COMP_DOUBLE_VAL 42.0 |
37 | 37 |
|
| 38 | +/* Size of buffer used for temporary filenames */ |
| 39 | +#define TEMP_FILENAME_BUF_SIZE 128 |
| 40 | + |
38 | 41 | /* Test function prototypes */ |
39 | 42 | static void test_utf8_filenames(void); |
40 | 43 | static void test_utf8_conv_failure(void); |
@@ -72,13 +75,29 @@ test_utf8_filenames(void) |
72 | 75 | const char *quot_filename = u8"‚.h5"; /* U+201A "Single Low-9 Quotation Mark" */ |
73 | 76 | const char *chin_filename = u8"漢字.h5"; |
74 | 77 | hid_t fid = H5I_INVALID_HID; |
| 78 | + hid_t fapl = H5I_INVALID_HID; |
75 | 79 | char *env = NULL; |
| 80 | + char fixed_filename[TEMP_FILENAME_BUF_SIZE]; |
76 | 81 | herr_t ret; |
77 | 82 | int acc_ret; |
78 | 83 | #ifdef H5_HAVE_WIN32_API |
79 | 84 | wchar_t *wfilename = NULL; |
80 | 85 | #endif |
81 | 86 |
|
| 87 | + /* |
| 88 | + * If the filenames would be perturbed by h5_fixname() due to |
| 89 | + * a specific VFD being used, skip this test as the filename |
| 90 | + * could be unpredictable and cause unexpected failures. |
| 91 | + */ |
| 92 | + fapl = h5_fileaccess(); |
| 93 | + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); |
| 94 | + h5_fixname(u8"€", fapl, fixed_filename, TEMP_FILENAME_BUF_SIZE); |
| 95 | + H5Pclose(fapl); |
| 96 | + if (0 != strcmp(euro_filename, fixed_filename)) { |
| 97 | + MESSAGE(5, ("Testing UTF-8 filenames -- SKIPPED due to unpredictable test filenames\n")); |
| 98 | + return; |
| 99 | + } |
| 100 | + |
82 | 101 | /* |
83 | 102 | * If the HDF5_PREFER_WINDOWS_CODE_PAGE environment variable |
84 | 103 | * is set to a true value, skip this test as the filenames |
@@ -245,10 +264,28 @@ test_utf8_conv_failure(void) |
245 | 264 | const char *filename = "\x83\x6E\x83\x8D\x81\x5B\x83\x8F\x81\x5B\x83\x8B\x83\x68" |
246 | 265 | ".h5"; |
247 | 266 | wchar_t wfilename[64]; |
248 | | - hid_t fid = H5I_INVALID_HID; |
| 267 | + hid_t fid = H5I_INVALID_HID; |
| 268 | + hid_t fapl = H5I_INVALID_HID; |
| 269 | + char fixed_filename[TEMP_FILENAME_BUF_SIZE]; |
249 | 270 | herr_t ret; |
250 | 271 | int int_ret; |
251 | 272 |
|
| 273 | + /* |
| 274 | + * If the filename would be perturbed by h5_fixname() due to |
| 275 | + * a specific VFD being used, skip this test as the filename |
| 276 | + * could be unpredictable and cause unexpected failures. |
| 277 | + */ |
| 278 | + fapl = h5_fileaccess(); |
| 279 | + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); |
| 280 | + h5_fixname("\x83\x6E\x83\x8D\x81\x5B\x83\x8F\x81\x5B\x83\x8B\x83\x68", fapl, fixed_filename, |
| 281 | + TEMP_FILENAME_BUF_SIZE); |
| 282 | + H5Pclose(fapl); |
| 283 | + if (0 != strcmp(filename, fixed_filename)) { |
| 284 | + MESSAGE(5, ("Testing UTF-8 filename conversion failure fallback -- SKIPPED due to unpredictable test " |
| 285 | + "filenames\n")); |
| 286 | + return; |
| 287 | + } |
| 288 | + |
252 | 289 | /* |
253 | 290 | * If the current code page would cause a failure in the fallback |
254 | 291 | * pathway (for example, if the current code page is UTF-8), skip |
@@ -319,12 +356,30 @@ test_utf8_conv_failure(void) |
319 | 356 | static void |
320 | 357 | test_code_page_override(void) |
321 | 358 | { |
322 | | - const char *filename = "\xc3\x9f"; /* UTF-8 'ß' / Windows code page 1252 'ß' */ |
| 359 | + const char *filename = "\xc3\x9f" |
| 360 | + ".h5"; /* UTF-8 'ß' / Windows code page 1252 'ß' */ |
323 | 361 | hid_t fid = H5I_INVALID_HID; |
| 362 | + hid_t fapl = H5I_INVALID_HID; |
324 | 363 | char *env = NULL; |
| 364 | + char fixed_filename[TEMP_FILENAME_BUF_SIZE]; |
325 | 365 | herr_t ret; |
326 | 366 | int int_ret; |
327 | 367 |
|
| 368 | + /* |
| 369 | + * If the filename would be perturbed by h5_fixname() due to |
| 370 | + * a specific VFD being used, skip this test as the filename |
| 371 | + * could be unpredictable and cause unexpected failures. |
| 372 | + */ |
| 373 | + fapl = h5_fileaccess(); |
| 374 | + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); |
| 375 | + h5_fixname("\xc3\x9f", fapl, fixed_filename, TEMP_FILENAME_BUF_SIZE); |
| 376 | + H5Pclose(fapl); |
| 377 | + if (0 != strcmp(filename, fixed_filename)) { |
| 378 | + MESSAGE(5, ("Testing code pages environment variable override -- SKIPPED due to unpredictable test " |
| 379 | + "filenames")); |
| 380 | + return; |
| 381 | + } |
| 382 | + |
328 | 383 | #ifdef H5_HAVE_WIN32_API |
329 | 384 | /* Perform some initial Windows-specific tests to see if this test |
330 | 385 | * needs to be skipped |
|
0 commit comments