From f73e56e24f0edfaeb99e2106a56725ea033bd6d6 Mon Sep 17 00:00:00 2001 From: Mikhail Yankelevich Date: Fri, 24 Oct 2025 09:14:04 +0000 Subject: [PATCH] 8361894: sun/security/krb5/config/native/TestDynamicStore.java ensure that the test is run with sudo Reviewed-by: rhalade --- .../krb5/config/native/TestDynamicStore.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java index 7e396013a71..0ee559f33e4 100644 --- a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java +++ b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,13 +27,15 @@ * @summary SCDynamicStoreConfig works * @modules java.security.jgss/sun.security.krb5 * @library /test/lib - * @run main/manual/native TestDynamicStore + * @run main/manual/native/timeout=180 TestDynamicStore * @requires (os.family == "mac") */ import jdk.test.lib.Asserts; import sun.security.krb5.Config; +import javax.swing.JOptionPane; + // =================== Attention =================== // This test calls a native method implemented in libTestDynamicStore.m // to modify system-level Kerberos 5 settings stored in the dynamic store. @@ -56,6 +58,17 @@ public class TestDynamicStore { public static void main(String[] args) throws Exception { + // Show a popup to remind to run this test as sudo user + // this will only trigger if sudo (root) user is not detected + if (!"root".equals(System.getProperty("user.name"))) { + + JOptionPane.showMessageDialog(null, """ + This test MUST be run as ROOT.\s + Please close and RESTART the test."""); + + Asserts.assertFalse(true, "This test must be run as ROOT"); + } + System.loadLibrary("TestDynamicStore"); Config cfg = Config.getInstance();