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

8289511: Improve test coverage for XPath Axes: child #9484

Closed
wants to merge 4 commits into from

Conversation

bwhuang-us
Copy link
Contributor

@bwhuang-us bwhuang-us commented Jul 13, 2022

This is a subtask of JDK-8286091 which is aiming to improve XPath expression test coverage. The goal of this subtask is validating the XPath child axis specifier in various ways.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8289511: Improve test coverage for XPath Axes: child

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9484/head:pull/9484
$ git checkout pull/9484

Update a local copy of the PR:
$ git checkout pull/9484
$ git pull https://git.openjdk.org/jdk pull/9484/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9484

View PR using the GUI difftool:
$ git pr show -t 9484

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9484.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 13, 2022

👋 Welcome back bwhuang-us! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 13, 2022
@openjdk
Copy link

openjdk bot commented Jul 13, 2022

@bwhuang-us The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jul 13, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 13, 2022

Webrevs

Copy link
Member

@JoeWang-Java JoeWang-Java left a comment

Choose a reason for hiding this comment

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

Nice test overall. Pls see comments below.

import java.io.InputStream;

/*
* @test
Copy link
Member

Choose a reason for hiding this comment

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

Add bug id here: @bug 8289511

* @run testng/othervm xpath.XPathChildTest
* @summary Tests for XPath child axis specifier.
*/
public class XPathChildTest {
Copy link
Member

Choose a reason for hiding this comment

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

Change the name to: XPathExpChildTest. The idea was to add more test cases to XPathExpTest. But since you've created the long list of test cases, it looks okay to be in a separate test.

{"/store/child::*[child::*]/author", AUTHOR_1},
{"/store/child::*[attribute::*]/author", AUTHOR_1},
{"/store/*[*][*][*][*][*][*][*][*]/author", AUTHOR_1},
{"/store/*[@*][@*][@*][@*][@*][@*][@*][@*]/author", AUTHOR_1},
Copy link
Member

Choose a reason for hiding this comment

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

What are we testing here, I mean vs *[*] or *[@*]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given the wildcard * selects all children of the context node, *[*] or *[@*] will select all children that with at least one child or one attribute. This is what we cover with line 132 and 133. For line 134 and 135, we are trying to see if multiple wildcards swallow the child node in the chain.

@DataProvider(name = "invalidExp")
public Object[][] getInvalidExp() {
return new Object[][]{
// NullPointerException
Copy link
Member

Choose a reason for hiding this comment

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

These NPE tests need to be revisited. First of all, by the spec, NPE shall throw only "If expression or returnType is null" (and that's already covered in the Exception test). Secondly, these NPEs were not thrown by the eval process, it was merely because the NodeList was empty or Node was null. The expressions themselves were not "invalid".

Copy link
Contributor Author

@bwhuang-us bwhuang-us Jul 14, 2022

Choose a reason for hiding this comment

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

Agreed. These expressions are not invalid and they are more on a focus of zero children rather than NPE. I can move them to a different test case.

Copy link
Member

@JoeWang-Java JoeWang-Java left a comment

Choose a reason for hiding this comment

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

Thanks for the update. The update looks good. One more comment below.


// position
{"/store/child::book[position()=1]/author", AUTHOR_1},
{"/store/child::book[last()]/author", AUTHOR_2},
Copy link
Member

Choose a reason for hiding this comment

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

If the intention is to test the last() function, it would be good to have more books than 2 (e.g. at least 3). But if the focus is on Axes: child, plus functions will be tested in the other subtask, I'm ok if you don't want to make further changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted. We will cover that in the XPath function() test.

@openjdk
Copy link

openjdk bot commented Jul 14, 2022

@bwhuang-us This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8289511: Improve test coverage for XPath Axes: child

Reviewed-by: joehw

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 30 new commits pushed to the master branch:

  • 0184f46: 8289919: [test] LoadLibraryUnloadTest.java failed with "Failed to unload native library"
  • cca91f7: 8290327: Remove java/lang/reflect/callerCache/ReflectionCallerCacheTest.java from ProblemList-Xcomp.txt
  • b4e2ce0: 8290366: Remove unused during_conc_mark parameter in HeapRegion::note_self_forwarding_removal_start
  • f3abb82: 8268312: Compilation error with nested generic functional interface
  • 92deab5: 8028265: Add legacy tz tests to OpenJDK
  • 70fce07: 8290246: test fails "assert(init != __null) failed: initialization not found"
  • 757a742: 8290177: Improve documentation in G1MMUTracker
  • 890bced: 8290264: java/util/concurrent/locks/Lock/OOMEInAQS.java fails with "exit code: 0"
  • 3ad3950: Merge
  • fd89ab8: 8288112: C2: Error: ShouldNotReachHere() in Type::typerr()
  • ... and 20 more: https://git.openjdk.org/jdk/compare/3216d198f382e991522600086bb2691abfe5f067...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JoeWang-Java, @iklam) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 14, 2022
Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

Please rename the issue to something more meaningful.

@JoeWang-Java
Copy link
Member

Please rename the issue to something more meaningful.

Pls refer to the main issue. This is one of the subtasks.

@iklam
Copy link
Member

iklam commented Jul 14, 2022

Please rename the issue to something more meaningful.

Pls refer to the main issue. This is one of the subtasks.

The problem is when this commit is integrated into the JDK repo, it does not show up as a subtask of another commit. When browsing the Git commit log, we should be able to have some idea what a change is about without going to JBS.

@bwhuang-us bwhuang-us changed the title 8289511: Axes: child 8289511: Improve test coverage for XPath Axes: child Jul 14, 2022
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jul 14, 2022
@JoeWang-Java
Copy link
Member

JoeWang-Java commented Jul 15, 2022

Sounds good. @bwhuang-us Bill, could you edit the title to match the JBS. I've changed the synopsis for all subtasks.
nvm, I changed the subtask to match the PR.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 15, 2022
@bwhuang-us
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 15, 2022
@openjdk
Copy link

openjdk bot commented Jul 15, 2022

@bwhuang-us
Your change (at version 9a57de4) is now ready to be sponsored by a Committer.

@JoeWang-Java
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 29, 2022

Going to push as commit cfe9026.
Since your change was applied there have been 192 commits pushed to the master branch:

  • eeac3da: 8289755: Remove --enable-reproducible-build from jib profile
  • 791fc57: 6383195: javax.crypto.spec.PBEKeySpec is not thread safe
  • e052d7f: 8288477: nmethod header size reduction
  • 54a2c5a: 8290059: Do not use std::thread in panama tests
  • 5214a17: 8291479: ProblemList compiler/rangechecks/TestRangeCheckHoistingScaledIV.java on ppc64le
  • 471a427: 8287794: Reverse*VNode::Identity problem
  • 5d1ad39: 8290839: jdk/jfr/event/compiler/TestJitRestart.java failed with "RuntimeException: No JIT restart event found: expected true, was false"
  • 97fc8de: 8291106: ZPlatformGranuleSizeShift is redundant
  • dd69a68: 8291000: C2: Purge LoadPLocked and Store*Conditional nodes
  • 07f0612: 8290532: Adjust PKCS11Exception and handle more PKCS11 error codes
  • ... and 182 more: https://git.openjdk.org/jdk/compare/3216d198f382e991522600086bb2691abfe5f067...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 29, 2022
@openjdk openjdk bot closed this Jul 29, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 29, 2022
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Jul 29, 2022
@openjdk
Copy link

openjdk bot commented Jul 29, 2022

@JoeWang-Java @bwhuang-us Pushed as commit cfe9026.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@bwhuang-us bwhuang-us deleted the JDK-8289511 branch March 1, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants