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

Support multiple required in features tag #614

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

annaibm
Copy link
Contributor

@annaibm annaibm commented Sep 20, 2024

  • Removed null statement from required feature check to ensure all required features are processed.
  • Allows the code to continue checking all feature flags, even after finding a required flag in testFlags.

related:https://github.ibm.com/runtimes/backlog/issues/1525

if (!isFeatureInTestFlags(testFlags, entry.getKey())) {
return null;
if (isFeatureInTestFlags(testFlags, entry.getKey())) {
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change, if there is no test flag and feature match, the test will run. This is not expected behavior.
Grinder - test run with TEST_FLAG=empty.

@annaibm
Copy link
Contributor Author

annaibm commented Sep 23, 2024

@annaibm annaibm requested a review from llxia September 23, 2024 14:19
@llxia
Copy link
Contributor

llxia commented Sep 23, 2024

feature required is an optional value. It may or may not exist. We cannot return null if requiredFeatureFound is not found. https://github.com/adoptium/TKG/pull/614/files#diff-1ce05e4d3d428c3c8430b54f2905415f30fd13919ff8269e99c127485d69093eR111-R113 is not correct.

For example: https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/43462/

@llxia
Copy link
Contributor

llxia commented Sep 23, 2024

This existing logic in TKG is not straightforward. To make this simple, I think we should make assumption that we cannot use feature required with other featureOpts (otherwise, we may need to rewrite the entire logic). For example, FIPS140_2:nonapplicable and FIPS140_3_OpenJCEPlusFIPS:required cannot be used together. If they are used together, only required will be considered.

With this assumption, the logic can be updated to


 for (Map.Entry<String,String> entry : ti.getFeatures().entrySet()) {
			String featureOpt = entry.getValue().toLowerCase();
			if (featureOpt.equals("required")) {
				 // create required feature list - ListA
			} else if (featureOpt.equals("nonapplicable")) {
				// Do not generate make target if the test is not applicable for one feature defined in TEST_FLAG
				if (isFeatureInTestFlags(testFlags, entry.getKey())) {
					return null;
				}
			} else if (featureOpt.equals("applicable") || featureOpt.equals("explicit")) {
				// Do nothing
			} else {
				System.err.println("Error: Please provide a valid feature parameter in test " + ti.getTestCaseName() + ". The valid string is <feature_name>:[required|applicable|nonapplicable|explicit].");
				System.exit(1);
			}
		}


// Assume that we cannot use feature required with other featureOpts
If ListA is not empty
    if testFlag is not in ListA
          return null

@LongyuZhang what do you think?

@annaibm
Copy link
Contributor Author

annaibm commented Sep 23, 2024

<features>
    <feature>FIPS140_2:nonapplicable</feature>
    <feature>FIPS140_3_OpenJCEPlusFIPS:required</feature>
    <feature>FIPS140_3_OpenJCEPlusFIPS.FIPS140-3:required</feature>
</features>

As I understand ,I think the the issue is when we are having 2 required field in features tag and it’s expecting the test flags to have both the flags mentioned but we just give one flag for eg:FIPS140_3_OpenJCEPlusFIPS or FIPS140_3_OpenJCEPlusFIPS.(which can be valid or not vice versa depends on order of iteration picked).
But the presence of the other feature (FIPS140_3_OpenJCEPlusFIPS.FIPS140-3 or FIPS140_3_OpenJCEPlusFIPS ) in the list is the reason for the error, as it is expected in the test flags but not found there. This is causing the return null in your code, preventing the generation of the required tests and leading to the error message.

@annaibm
Copy link
Contributor Author

annaibm commented Sep 23, 2024

@llxia
Copy link
Contributor

llxia commented Sep 23, 2024

I assume that we cannot use feature required with other featureOpts. This is true with your current version. If required flag is matched, ignore other featureOpts.

@llxia
Copy link
Contributor

llxia commented Sep 23, 2024

Discussed with @LongyuZhang , before this change, we need to update the existing playlist.xml. Otherwise, it will break existing testing.

Also, we should update the doc to clearly state the assumption:

  • or relationship is expected in <features>
  • required should not be used with other feature options

@annaibm
Copy link
Contributor Author

annaibm commented Sep 23, 2024

@llxia Please find the draft PR: eclipse-openj9/openj9#20215 to remove CRIU featureOption.
- remove <feature>CRIU:required</feature>

@llxia
Copy link
Contributor

llxia commented Sep 24, 2024

Please run TKG PR test.

@annaibm
Copy link
Contributor Author

annaibm commented Sep 24, 2024

@llxia
Copy link
Contributor

llxia commented Sep 24, 2024

Can we update the title to reflect the change? Update feature flag handling for required features -> Support multiple required in features tag

@annaibm annaibm changed the title Update feature flag handling for required features Support multiple required in features tag Sep 24, 2024
@annaibm
Copy link
Contributor Author

annaibm commented Sep 24, 2024

run tkg-test

Copy link

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

Copy link

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

@annaibm annaibm force-pushed the testflag branch 2 times, most recently from 278b548 to bae4614 Compare September 25, 2024 13:57
@annaibm
Copy link
Contributor Author

annaibm commented Sep 25, 2024

run tkg-test

Copy link

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

Copy link

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


if 'test_arch_390_z15_0' not in passed:
skipped.add('test_arch_390_z15_0')

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove extra space

- Removed `null` statement from `required` feature check to ensure all required features are processed.
- Allows the code to continue checking all feature flags, even after finding a required flag in `testFlags`.
- Added test_not_arch_390_z15plus_0 into passed list for running TKG test PR in github actions as no microarch version is detected.

related:https://github.ibm.com/runtimes/backlog/issues/1525

Signed-off-by: Anna Babu Palathingal <[email protected]>
@annaibm annaibm requested a review from llxia September 25, 2024 14:48
@llxia
Copy link
Contributor

llxia commented Sep 25, 2024

Thanks @annaibm. Since TKG serves as the core framework layer, it could significantly impact testing behavior. For due diligence, could you please also run sanity.functional? Say, using JDK11 on xlinux. Compare with nightly runs and the TAP file info (TEST TARGETS RESULTS SUMMARY: TOTAL: xxx EXECUTED: xxx PASSED: xxx FAILED: xxx DISABLED: xxx SKIPPED: xxx) should be the same.

@annaibm
Copy link
Contributor Author

annaibm commented Sep 26, 2024

Grinder link:
TARGET: sanity.functional
https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/43590/
TEST TARGETS SUMMARY:

  • TOTAL : 431
  • EXECUTED : 385
  • PASSED : 385
  • FAILED : 0
  • DISABLED : 8
  • SKIPPED : 38

Comparison with nightly -> https://hyc-runtimes-jenkins.swg-devops.com/job/Test_openjdk11_j9_sanity.functional_x86-64_linux/931/tapTestReport/
TEST TARGETS SUMMARY:

  • TOTAL : 98
  • EXECUTED : 98
  • PASSED : 98
  • FAILED : 0
  • DISABLED : 0
  • SKIPPED : 0

TEST TARGETS SUMMARY:

  • TOTAL : 23
  • EXECUTED : 23
  • PASSED : 23
  • FAILED : 0
  • DISABLED : 0
  • SKIPPED : 0

TEST TARGETS SUMMARY:

  • TOTAL : 310
  • EXECUTED : 264
  • PASSED : 264
  • FAILED : 0
  • DISABLED : 8
  • SKIPPED : 38

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.

Thanks @annaibm

@llxia llxia requested a review from LongyuZhang September 26, 2024 17:06
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 d28073b into adoptium:master Sep 26, 2024
3 checks passed
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.

3 participants