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

zlinux micro architecture detection #477

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

annaibm
Copy link
Contributor

@annaibm annaibm commented Dec 6, 2023

  • zlinux version detection
  • add tests

resolves: #471

scripts/testTKG/test_platformRequirements.py Outdated Show resolved Hide resolved
src/org/openj9/envInfo/MachineInfo.java Outdated Show resolved Hide resolved
@annaibm annaibm force-pushed the support_zlinux_471 branch 2 times, most recently from 8be8ff7 to ed415da Compare December 6, 2023 20:38
@annaibm annaibm requested a review from llxia December 7, 2023 16:45
src/org/openj9/envInfo/MachineInfo.java Outdated Show resolved Hide resolved
src/org/openj9/envInfo/MachineInfo.java Outdated Show resolved Hide resolved
@llxia
Copy link
Contributor

llxia commented Dec 7, 2023

@annaibm annaibm force-pushed the support_zlinux_471 branch 4 times, most recently from a082c65 to 1b8eb23 Compare December 11, 2023 20:35
@annaibm annaibm requested a review from llxia December 11, 2023 20:55
@annaibm annaibm force-pushed the support_zlinux_471 branch from 1b8eb23 to ee9ddea Compare January 12, 2024 19:55
@annaibm
Copy link
Contributor Author

annaibm commented Jan 12, 2024

run tkg-test

Copy link

@annaibm TKG test build started, workflow Run ID: 7506926904

Copy link

@annaibm Build(s) failed, workflow Run ID: 7506926904

@annaibm annaibm force-pushed the support_zlinux_471 branch from ee9ddea to 8707903 Compare January 12, 2024 21:06
@annaibm
Copy link
Contributor Author

annaibm commented Jan 12, 2024

run tkg-test

Copy link

@annaibm TKG test build started, workflow Run ID: 7507448275

Copy link

@annaibm Build(s) failed, workflow Run ID: 7507448275

@annaibm annaibm force-pushed the support_zlinux_471 branch 2 times, most recently from 28c29a2 to b975ffb Compare January 17, 2024 21:16
@annaibm
Copy link
Contributor Author

annaibm commented Jan 17, 2024

run tkg-test

Copy link

@annaibm TKG test build started, workflow Run ID: 7561887930

Copy link

@annaibm Build(s) failed, workflow Run ID: 7561887930

@annaibm annaibm force-pushed the support_zlinux_471 branch from b975ffb to 42d112b Compare January 17, 2024 22:05
@annaibm
Copy link
Contributor Author

annaibm commented Jan 17, 2024

run tkg-test

Copy link

@annaibm TKG test build started, workflow Run ID: 7562336648

@annaibm annaibm force-pushed the support_zlinux_471 branch from d98fb7e to df2f2fc Compare April 5, 2024 16:47
@annaibm
Copy link
Contributor Author

annaibm commented Apr 5, 2024

run tkg-test

Copy link

github-actions bot commented Apr 5, 2024

@annaibm TKG test build started, workflow Run ID: 8573067259

Copy link

github-actions bot commented Apr 5, 2024

@annaibm Build(s) successful, workflow Run ID: 8573067259

@annaibm annaibm force-pushed the support_zlinux_471 branch 3 times, most recently from 6790a68 to a4d7dbe Compare April 10, 2024 16:21
@annaibm
Copy link
Contributor Author

annaibm commented Apr 10, 2024

run tkg-test

Copy link

@annaibm TKG test build started, workflow Run ID: 8634602513

Copy link

@annaibm Build(s) successful, workflow Run ID: 8634602513

@annaibm
Copy link
Contributor Author

annaibm commented Apr 10, 2024

Grinder links:
test_arch_390_z14: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39663/ passed for z14 m/c
test_arch_390_z14: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39664/ skipped when z15 m/c is used
test_not_arch_390: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39665/ skipped for s390x_linux
test_not_arch_390:https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39666/ - passed for aarch64_linux

String microArchVersion = prSplitOnDot[2];
String environmentMicroArch = arg.getMicroArch();
if (microArchVersion.endsWith("+")) {
int microArchVersionInt, environmentMicroArchVerInt;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please initialize the values

}
return microArchVersionInt <= environmentMicroArchVerInt;
} else {
return environmentMicroArch.equals(microArchVersion);
Copy link
Contributor

Choose a reason for hiding this comment

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

@annaibm annaibm force-pushed the support_zlinux_471 branch from bbcd29a to 70aec5c Compare April 11, 2024 13:59
@annaibm annaibm requested a review from llxia April 11, 2024 14:21
settings.mk Outdated
@@ -103,7 +103,7 @@ ifneq (,$(findstring win,$(SPEC)))
P=;
D=\\
EXECUTABLE_SUFFIX=.exe
RUN_SCRIPT="cmd /c"
RUN_SCRIPT="cmd /c"
RUN_SCRIPT_STRING=$(RUN_SCRIPT)
SCRIPT_SUFFIX=.bat
PROPS_DIR=props_win
Copy link
Contributor

Choose a reason for hiding this comment

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

There are no changes to this file other than formatting. I would prefer not to include this change. Please create separate PR for formatting if needed.

Comment on lines 449 to 454
boolean isZCharMatch = environmentMicroArch.startsWith(microArchVersion.substring(0, 1));
boolean isZStart = microArchVersion.startsWith("z") && environmentMicroArch.startsWith("z");
if (!(isZCharMatch || isZStart)) {
System.out.println("The microarchitecture does not match required starting character of 'z' prefix.");
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We shuold not hardcode z. What if we have other versions that start with different letter in the future? Please see suggested changed below.

String microArch = prSplitOnDot[2];
if (!microArch.equals(arg.getMicroArch())) {
String microArchVersion = prSplitOnDot[2];
String environmentMicroArch = arg.getMicroArch();
Copy link
Contributor

Choose a reason for hiding this comment

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

  • rename microArchVersion to requiredMicroArch
  • rename environmentMicroArch to actualMicroArch

@@ -484,4 +484,33 @@ private boolean matchPlat(String fullSpec, String pr) {
}
return true;
}

private boolean isVersionCompare(String prVersion, String environmentVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to use one function. Something like:

private boolean executeTest(String requiredLabel, String actualLabel) {
  if (requiredLabel.isEmpty() || actualLabel.isEmpty()) {
    return false;
  } else if (requiredLabel == actualLabel) {
    return true;
  } else if (requiredLabel.endsWith("+")) {
    Pattern pattern = Pattern.compile("(\\D+)?(\\d+)");
		Matcher requiredLabelMatcher = pattern.matcher(requiredLabel);
		Matcher actualLabelMatcher = pattern.matcher(actualLabel);

    if (requiredLabelMatcher.find() && actualLabelMatcher.find() && requiredLabelMatcher.groupCount() == 2 && actualLabelMatcher.groupCount() == 2) {
      if (requiredLabelMatcher.group(1) == actualLabelMatcher.group(1)) {
        int requiredLabelNum = 0;
        int actualLabelNum = 0;
        try {
          requiredLabelNum = Integer.parseInt(requiredLabelMatcher.group(2));
          actualLabelNum = Integer.parseInt(actualLabelMatcher.group(2));
        } catch (NumberFormatException e) {
          System.out.println("Error: unrecognized requiredLabel:" + requiredLabel + " or actualLabel:" + actualLabel);
          System.err.println(e.getMessage());
          System.exit(1);
        }
        if (actualLabelNum >= requiredLabelNum) {
      	   return true;
      	}
      }
    }
  }
  return false;
}

@annaibm annaibm force-pushed the support_zlinux_471 branch from 70aec5c to 6a2c35d Compare April 11, 2024 19:55
@annaibm annaibm requested a review from llxia April 11, 2024 20:08
@llxia
Copy link
Contributor

llxia commented Apr 12, 2024

Thanks @annaibm . Please rerun tests with the latest change. And we should also test os cases.

@annaibm annaibm force-pushed the support_zlinux_471 branch from 6a2c35d to 5108976 Compare April 12, 2024 18:44
@annaibm
Copy link
Contributor Author

annaibm commented Apr 12, 2024

Grinder links:
1.test_arch_390_z14: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39815/ passed for z14 m/c
2. test_arch_390_z14: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39816/skipped when z15 m/c is used
3. test_not_arch_390: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39817/ skipped for s390x_linux
4. test_not_arch_390:https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39819/- passed for aarch64_linux
5. TESTLIST=test_os_linux_ubuntu22,test_arch_390_z13,test_arch_390_z13plus,test_arch_390_z14,test_arch_390_z14plus,test_arch_390_z15,test_arch_390_z15plus,test_arch_x86_skylake:
https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39814/

OS testcases:

  1. TESTLIST=test_os_linux_ubuntu22,test_os_osx,test_osx_x86-64,test_not_linux_arch_x86,test_osx_x86-64_win_x86_aix_ppc64,test_os_linux_ubuntu20plus,test_os_linux_ubuntu20plus_rhel8plus,test_not_os_linux_ubuntu20plus: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39810/
  2. TESTLIST=test_os_linux_ubuntu22,test_os_osx,test_osx_x86-64,test_not_linux_arch_x86,test_osx_x86-64_win_x86_aix_ppc64,test_os_linux_ubuntu20plus,test_os_linux_ubuntu20plus_rhel8plus,test_not_os_linux_ubuntu20plus: (ubu22s390x-rt-1.hursley.ibm.com)
    https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39807/
  3. test_os_linux_ubuntu22 : https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39823/ ([rhel8s390x-rt-2.hursley.ibm.com]
  4. test_os_linux_ubuntu22 : https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39826/ (ubu22s390x-rt-1.hursley.ibm.com)

@llxia
Copy link
Contributor

llxia commented Apr 16, 2024

test_os_linux_ubuntu22 : https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/39826/ (ubu22s390x-rt-1.hursley.ibm.com)

can you rerun this build?

@annaibm
Copy link
Contributor Author

annaibm commented Apr 16, 2024

- zlinux version detection
- add tests

Signed-off-by: Anna Babu Palathingal <[email protected]>
@annaibm annaibm force-pushed the support_zlinux_471 branch from 5108976 to 14de8ce Compare April 16, 2024 19:06
@annaibm annaibm marked this pull request as ready for review April 16, 2024 21:33
Copy link
Contributor

@llxia llxia left a comment

Choose a reason for hiding this comment

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

LGTM

@llxia llxia requested a review from LongyuZhang April 17, 2024 13:03
Copy link
Contributor

@LongyuZhang LongyuZhang left a comment

Choose a reason for hiding this comment

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

LGTM

@LongyuZhang LongyuZhang merged commit 8e4a2d4 into adoptium:master Apr 17, 2024
3 checks passed
@annaibm annaibm deleted the support_zlinux_471 branch July 25, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support detect zlinux version in TKG
4 participants