Skip to content

Commit

Permalink
8319128: sun/security/pkcs11 tests fail on OL 7.9 aarch64
Browse files Browse the repository at this point in the history
8319136: Skip pkcs11 tests on linux-aarch64

Backport-of: 1f9b03e597d87679964e8772c6bea538c74feb2c
  • Loading branch information
Andrew Lu committed Mar 13, 2024
1 parent 09ebd1c commit 02ef1c7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 9 deletions.
17 changes: 14 additions & 3 deletions test/jdk/sun/security/pkcs11/PKCS11Test.java
Expand Up @@ -54,7 +54,11 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import jdk.test.lib.Platform;
import jdk.test.lib.artifacts.Artifact;
import jdk.test.lib.artifacts.ArtifactResolver;
import jdk.test.lib.artifacts.ArtifactResolverException;
Expand Down Expand Up @@ -759,11 +763,18 @@ private static String fetchNssLib(String osId) {
return fetchNssLib(MACOSX_AARCH64.class);

case "Linux-amd64-64":
return fetchNssLib(LINUX_X64.class);
if (Platform.isOracleLinux7()) {
throw new SkippedException("Skipping Oracle Linux prior to v8");
} else {
return fetchNssLib(LINUX_X64.class);
}

case "Linux-aarch64-64":
return fetchNssLib(LINUX_AARCH64.class);

if (Platform.isOracleLinux7()) {
throw new SkippedException("Skipping Oracle Linux prior to v8");
} else {
return fetchNssLib(LINUX_AARCH64.class);
}
default:
return null;
}
Expand Down
15 changes: 10 additions & 5 deletions test/jdk/sun/security/pkcs11/Provider/MultipleLogins.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, 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
Expand All @@ -21,6 +21,7 @@
* questions.
*/


import sun.security.pkcs11.SunPKCS11;

import javax.security.auth.Subject;
Expand All @@ -32,12 +33,10 @@
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.security.*;
import java.util.Iterator;
import java.util.PropertyPermission;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;

import jdk.test.lib.util.ForceGC;
import jtreg.SkippedException;

public class MultipleLogins {
private static final String KS_TYPE = "PKCS11";
Expand All @@ -46,7 +45,13 @@ public class MultipleLogins {
static final Policy DEFAULT_POLICY = Policy.getPolicy();

public static void main(String[] args) throws Exception {
String nssConfig = PKCS11Test.getNssConfig();
String nssConfig = null;
try {
nssConfig = PKCS11Test.getNssConfig();
} catch (SkippedException exc) {
System.out.println("Skipping test: " + exc.getMessage());
}

if (nssConfig == null) {
// No test framework support yet. Ignore
System.out.println("No NSS config found. Skipping.");
Expand Down
1 change: 1 addition & 0 deletions test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh
Expand Up @@ -26,6 +26,7 @@
# @summary
# @library /test/lib/
# @build jdk.test.lib.util.ForceGC
# jdk.test.lib.Platform
# @run shell MultipleLogins.sh

# set a few environment variables so that the shell-script can run stand-alone
Expand Down
Expand Up @@ -53,7 +53,7 @@ private static enum MethodGroup {
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isMusl",
"isSlowDebugBuild", "hasSA", "isRoot", "isTieredSupported",
"areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
"isHardenedOSX", "hasOSXPlistEntries");
"isHardenedOSX", "hasOSXPlistEntries", "isOracleLinux7");

public final List<String> methodNames;

Expand Down
15 changes: 15 additions & 0 deletions test/lib/jdk/test/lib/Platform.java
Expand Up @@ -33,6 +33,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Platform {
Expand Down Expand Up @@ -344,6 +345,20 @@ private static boolean isArch(String archnameRE) {
.matches();
}

public static boolean isOracleLinux7() {
if (System.getProperty("os.name").toLowerCase().contains("linux") &&
System.getProperty("os.version").toLowerCase().contains("el")) {
Pattern p = Pattern.compile("el(\\d+)");
Matcher m = p.matcher(System.getProperty("os.version"));
if (m.find()) {
try {
return Integer.parseInt(m.group(1)) <= 7;
} catch (NumberFormatException nfe) {}
}
}
return false;
}

/**
* Returns file extension of shared library, e.g. "so" on linux, "dll" on windows.
* @return file extension
Expand Down

3 comments on commit 02ef1c7

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@luchenlin
Copy link

Choose a reason for hiding this comment

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

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 02ef1c7 Mar 13, 2024

Choose a reason for hiding this comment

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

@luchenlin Could not automatically backport 02ef1c72 to openjdk/jdk11u-dev due to conflicts in the following files:

  • test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
  • test/jdk/sun/security/pkcs11/PKCS11Test.java

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk11u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk11u-dev.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b backport-luchenlin-02ef1c72

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk17u-dev.git 02ef1c7264165434afe51fe675635593033edc56

# Backport the commit
$ git cherry-pick --no-commit 02ef1c7264165434afe51fe675635593033edc56
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 02ef1c7264165434afe51fe675635593033edc56'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk11u-dev with the title Backport 02ef1c7264165434afe51fe675635593033edc56.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 02ef1c72 from the openjdk/jdk17u-dev repository.

The commit being backported was authored by Andrew Lu on 13 Mar 2024 and had no reviewers.

Thanks!

Please sign in to comment.