Fixes to ensure that the jtreg test is not built or executed if krb5 is not installed

This commit is contained in:
Nick Hall 2025-10-30 21:03:37 -04:00
parent 5cad1e417f
commit bc904b0ef1
2 changed files with 14 additions and 5 deletions

View File

@ -110,12 +110,18 @@ ifeq ($(call isTargetOs, linux), true)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libCreationTimeHelper := -ldl
endif
# Kerberos native test library needs krb5 and com_err libraries
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeCredentialCacheHelper := -lkrb5 -lcom_err
# Kerberos native test library - only build if krb5 is available
ifeq ($(ENABLE_LIBLINUXKRB5), true)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeCredentialCacheHelper := $(KRB5_LIBS)
BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libNativeCredentialCacheHelper := $(KRB5_CFLAGS)
ifeq ($(call isTargetOs, macosx), true)
# On macOS, disable deprecation warnings for krb5 API
BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libNativeCredentialCacheHelper := -Wno-deprecated-declarations
ifeq ($(call isTargetOs, macosx), true)
# On macOS, disable deprecation warnings for krb5 API
BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libNativeCredentialCacheHelper += -Wno-deprecated-declarations
endif
else
# Exclude the Kerberos test library if krb5 is not available
BUILD_JDK_JTREG_EXCLUDE += libNativeCredentialCacheHelper.c
endif
ifeq ($(ASAN_ENABLED), true)

View File

@ -80,6 +80,9 @@ public class NativeCacheTest {
// Test JAAS access to in-memory cache
testJAASAccessToInMemoryCache(inMemoryCacheName);
} catch (UnsatisfiedLinkError e) {
System.out.println("Kerberos native library not available - test skipped");
return;
} catch (Exception e) {
System.err.println("Test failed: " + e.getMessage());
throw e;