Skip to content

Commit f73e56e

Browse files
committed
8361894: sun/security/krb5/config/native/TestDynamicStore.java ensure that the test is run with sudo
Reviewed-by: rhalade
1 parent b7a4c9c commit f73e56e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/jdk/sun/security/krb5/config/native/TestDynamicStore.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,15 @@
2727
* @summary SCDynamicStoreConfig works
2828
* @modules java.security.jgss/sun.security.krb5
2929
* @library /test/lib
30-
* @run main/manual/native TestDynamicStore
30+
* @run main/manual/native/timeout=180 TestDynamicStore
3131
* @requires (os.family == "mac")
3232
*/
3333

3434
import jdk.test.lib.Asserts;
3535
import sun.security.krb5.Config;
3636

37+
import javax.swing.JOptionPane;
38+
3739
// =================== Attention ===================
3840
// This test calls a native method implemented in libTestDynamicStore.m
3941
// to modify system-level Kerberos 5 settings stored in the dynamic store.
@@ -56,6 +58,17 @@ static int action(char what, char whom) throws Exception {
5658

5759
public static void main(String[] args) throws Exception {
5860

61+
// Show a popup to remind to run this test as sudo user
62+
// this will only trigger if sudo (root) user is not detected
63+
if (!"root".equals(System.getProperty("user.name"))) {
64+
65+
JOptionPane.showMessageDialog(null, """
66+
This test MUST be run as ROOT.\s
67+
Please close and RESTART the test.""");
68+
69+
Asserts.assertFalse(true, "This test must be run as ROOT");
70+
}
71+
5972
System.loadLibrary("TestDynamicStore");
6073

6174
Config cfg = Config.getInstance();

0 commit comments

Comments
 (0)