Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failures in dtypes test on cygwin #5077

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/H5T.c
Original file line number Diff line number Diff line change
Expand Up @@ -5660,8 +5660,8 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co
old_npaths = H5T_g.npaths;

/* Set a few convenience variables */
new_api_func = (matched_path && conv->is_app && conv->u.app_func);
Copy link
Collaborator Author

@jhendersonHDF jhendersonHDF Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an additional check to prevent the no-op path from being considered a new conversion path, which had some odd side effects from replacing the path with a slightly different, new no-op path.

new_lib_func = (matched_path && !conv->is_app && conv->u.lib_func);
new_api_func = (matched_path && !noop_conv && conv->is_app && conv->u.app_func);
new_lib_func = (matched_path && !noop_conv && !conv->is_app && conv->u.lib_func);

/* If we didn't find the path, if the caller is an API function specifying
* a new hard conversion function, or if the caller is a private function
Expand Down
36 changes: 19 additions & 17 deletions test/dtypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6436,16 +6436,17 @@ test__Float16(void)
}

if (is_little_endian) {
if (path->conv.u.lib_func != H5T__conv_noop) {
Copy link
Collaborator Author

@jhendersonHDF jhendersonHDF Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In at least cygwin, H5T__conv_noop (and some of the other functions used below) has a different address from path->conv.u.lib_func, so the two can't be compared directly. Instead, compare based on the conversion path name.

if (strcmp(path->name, "no-op") != 0) {
H5_FAILED();
printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE was not H5T__conv_noop\n");
printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE was not a no-op\n");
goto error;
}
}
else {
if (path->conv.u.lib_func != H5T__conv_order_opt) {
if (strcmp(path->name, "fbo(opt)") != 0) {
H5_FAILED();
printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE was not H5T__conv_order\n");
printf(
"Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE was not a byte-swap conversion\n");
goto error;
}
}
Expand All @@ -6469,16 +6470,17 @@ test__Float16(void)
}

if (is_little_endian) {
if (path->conv.u.lib_func != H5T__conv_order_opt) {
if (strcmp(path->name, "fbo(opt)") != 0) {
H5_FAILED();
printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE was not H5T__conv_order\n");
printf(
"Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE was not a byte-swap conversion\n");
goto error;
}
}
else {
if (path->conv.u.lib_func != H5T__conv_noop) {
if (strcmp(path->name, "no-op") != 0) {
H5_FAILED();
printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE was not H5T__conv_noop\n");
printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE was not a no-op\n");
goto error;
}
}
Expand Down Expand Up @@ -7393,7 +7395,7 @@ test_complex_type_conv_funcs(void)
printf("Invalid conversion path for H5T_NATIVE_FLOAT_COMPLEX -> H5T_NATIVE_FLOAT_COMPLEX\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_noop) {
if (strcmp(conv_path->name, "no-op") != 0) {
H5_FAILED();
printf("Conversion path for H5T_NATIVE_FLOAT_COMPLEX -> H5T_NATIVE_FLOAT_COMPLEX was not a no-op\n");
goto error;
Expand All @@ -7409,7 +7411,7 @@ test_complex_type_conv_funcs(void)
printf("Invalid conversion path for H5T_NATIVE_DOUBLE_COMPLEX -> H5T_NATIVE_DOUBLE_COMPLEX\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_noop) {
if (strcmp(conv_path->name, "no-op") != 0) {
H5_FAILED();
printf(
"Conversion path for H5T_NATIVE_DOUBLE_COMPLEX -> H5T_NATIVE_DOUBLE_COMPLEX was not a no-op\n");
Expand All @@ -7426,7 +7428,7 @@ test_complex_type_conv_funcs(void)
printf("Invalid conversion path for H5T_NATIVE_LDOUBLE_COMPLEX -> H5T_NATIVE_LDOUBLE_COMPLEX\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_noop) {
if (strcmp(conv_path->name, "no-op") != 0) {
H5_FAILED();
printf(
"Conversion path for H5T_NATIVE_LDOUBLE_COMPLEX -> H5T_NATIVE_LDOUBLE_COMPLEX was not a no-op\n");
Expand All @@ -7453,7 +7455,7 @@ test_complex_type_conv_funcs(void)
printf("Can't find datatype conversion path\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_order) {
if (strcmp(conv_path->name, "complexbo") != 0) {
H5_FAILED();
printf("Conversion path for H5T_COMPLEX_IEEE_F32LE -> H5T_COMPLEX_IEEE_F32BE was not a byte-swap "
"conversion\n");
Expand All @@ -7465,7 +7467,7 @@ test_complex_type_conv_funcs(void)
printf("Can't find datatype conversion path\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_order) {
if (strcmp(conv_path->name, "complexbo") != 0) {
H5_FAILED();
printf("Conversion path for H5T_COMPLEX_IEEE_F32BE -> H5T_COMPLEX_IEEE_F32LE was not a byte-swap "
"conversion\n");
Expand Down Expand Up @@ -7881,7 +7883,7 @@ test_complex_array_compat_conv(void)
printf("Invalid conversion path for complex type -> array type\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_complex_compat) {
if (strcmp(conv_path->name, "complex_array_compat") != 0) {
H5_FAILED();
printf("Conversion path for complex type -> array type was not a no-op\n");
goto error;
Expand All @@ -7896,7 +7898,7 @@ test_complex_array_compat_conv(void)
printf("Invalid conversion path for array type -> complex type\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_complex_compat) {
if (strcmp(conv_path->name, "array_complex_compat") != 0) {
H5_FAILED();
printf("Conversion path for array type -> complex type was not a no-op\n");
goto error;
Expand Down Expand Up @@ -8338,7 +8340,7 @@ test_complex_compound_compat_conv(void)
printf("Invalid conversion path for complex type -> compound type\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_complex_compat) {
if (strcmp(conv_path->name, "complex_compound_compat") != 0) {
H5_FAILED();
printf("Conversion path for complex type -> compound type was not a no-op\n");
goto error;
Expand All @@ -8353,7 +8355,7 @@ test_complex_compound_compat_conv(void)
printf("Invalid conversion path for compound type -> complex type\n");
goto error;
}
if (conv_path->conv.u.lib_func != H5T__conv_complex_compat) {
if (strcmp(conv_path->name, "compound_complex_compat") != 0) {
H5_FAILED();
printf("Conversion path for compound type -> complex type was not a no-op\n");
goto error;
Expand Down
Loading