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

Tests for isAccessUserOnly0 native #1656

Merged
merged 2 commits into from
May 23, 2018

Conversation

theresa-m
Copy link
Contributor

@theresa-m theresa-m commented Apr 11, 2018

  • includes tests for isAccessUserOnly0 in Java8 and Java9
  • expanded test infra to have src_90_current and src_90_latest files for different JCL versions in Java 9

Relies on: #1655

Signed-off-by: Theresa Mammarella Theresa.T.Mammarella@ibm.com

}

FileSystem fs = FileSystem.open();
File file = new File("test-file-name");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smlambert concerns with this file created for testing? I've made sure to delete it at the end of each test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Creating a file is not an issue (as you clean it up after). There are some other test changes that we will ask for on this PR, I've added @llxia for a review.

@@ -1843,5 +1843,46 @@
<subset>SE90</subset>
</subsets>
</test>

<test>
<testCaseName>FileSystem-isAccessUserOnlyTests_SE90</testCaseName>
Copy link
Contributor

Choose a reason for hiding this comment

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

For tests that should apply to Java9 and Up, its preferred to call the Java8 tests _SE80, and then drop the suffix, so the same test can be used for 9, 10, 11 and so on.

*******************************************************************************/

import org.testng.annotations.Test;
import org.testng.AssertJUnit;
Copy link
Contributor

Choose a reason for hiding this comment

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

For brand new test code, you could just import org.testng.Assert; and we should update the example, so that it uses it to. Some tests use AssertJUnit because they were converted using a JUnit-to-TestNG plugin, and the ordering of the arguments for JUnit asserts are reversed from the order of TestNG asserts.

@smlambert
Copy link
Contributor

I have not done a diff between your Test_FileSystem.java code for src_80, src_90_latest, and src_90_current, but seems like a good opportunity to reuse some code (see examples of reuse).

Another question, perhaps for @DanHeidinga, is it necessary to add tests for src_90_current, does this refer to b148 class libraries, and when can we stop adding tests to continue to support that JCL version)?

@DanHeidinga
Copy link
Member

@theresa-m Have you seen some of the createTempFile api calls like: https://docs.oracle.com/javase/9/docs/api/java/io/File.html#createTempFile-java.lang.String-java.lang.String-java.io.File-

Using those calls avoids having to name the file and ensures that the tests can be run in parallel as the file(s) will be unique.

The code explicitly deleting the file is good and to cover all the cases, please also call https://docs.oracle.com/javase/9/docs/api/java/io/File.html#deleteOnExit-- on the files.

@DanHeidinga
Copy link
Member

Another question, perhaps for @DanHeidinga, is it necessary to add tests for src_90_current, does this refer to b148 class libraries, and when can we stop adding tests to continue to support that JCL version)?

We should not be adding new tests to support b148. That's an IBM-ism

<group>functional</group>
</groups>
<subsets>
<subset>SE90</subset>
Copy link
Contributor

@llxia llxia Apr 11, 2018

Choose a reason for hiding this comment

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

also, if the test applies to Java9 and Up, then please add subset

<subset>SE100</subset>
<subset>SE110</subset>

If you debase your branch, you will see tests in this playlist.xml is updated to have SE100 and SE110.

@theresa-m
Copy link
Contributor Author

Yes reusing code for this will be great. The files are exactly the same except for the package name of the class they are testing. Thanks for the link @smlambert

@theresa-m
Copy link
Contributor Author

The addition of the current/latest folders for Java 9 was mainly because of internal test compile failures. The FileSystem class being tested changed locations between jcl versions so my test would not work on both jcls. Are there some better ways this could work?

@theresa-m
Copy link
Contributor Author

Ready for another review.

</classpath>
</javac>
</else>
</if>
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using if else, could we use variables to avoid code duplication? The differences between if and else are the following:

  • ${src_90_current} and ${src_90_latest}
  • --add-exports java.management/sun.management=ALL-UNNAMED and --add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea. I just pushed this update

@llxia
Copy link
Contributor

llxia commented Apr 13, 2018

Jenkins test sanity plinux jdk9,jdk10

@theresa-m theresa-m changed the title Tests for isAccessUserOnly0 native WIP: Tests for isAccessUserOnly0 native Apr 13, 2018
@theresa-m
Copy link
Contributor Author

Marking as WIP so this does not get merged before #1655

@llxia
Copy link
Contributor

llxia commented Apr 13, 2018

Aborted both test builds as they will not pass without #1655

@theresa-m theresa-m force-pushed the fix_1520_tests branch 3 times, most recently from 98661b1 to 5ab7fcf Compare April 23, 2018 14:03
@theresa-m theresa-m changed the title WIP: Tests for isAccessUserOnly0 native Tests for isAccessUserOnly0 native May 17, 2018
@theresa-m
Copy link
Contributor Author

@llxia the dependencies for this pr have been merged

@theresa-m
Copy link
Contributor Author

rebasing as this is a while behind.

@theresa-m
Copy link
Contributor Author

theresa-m commented May 18, 2018

Jenkins test sanity plinux jdk9,jdk10

edit: looks like I don't have permission to do this :)

@pshipton
Copy link
Member

Jenkins test sanity plinux jdk9,jdk10

@pshipton
Copy link
Member

Jenkins test sanity plinux jdk8

@theresa-m
Copy link
Contributor Author

Jdk10 test failure is fixed pending #1942

@pshipton
Copy link
Member

jenkins test sanity plinux jdk10

@pshipton
Copy link
Member

@llxia @smlambert ready for another look


protected void resolveTest(boolean actualResult, boolean expectedResult) {
logger.debug("Test passed: " + (expectedResult == actualResult));
Assert.assertEquals(expectedResult, actualResult);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need logger.debug("Test passed: " + (expectedResult == actualResult))? Does Assert.assertEquals(expectedResult, actualResult) provide the same information?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its not very helpful. I will take that out.

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.

the rest looks good to me.

theresa-m added 2 commits May 22, 2018 11:10
- includes tests for isAccessUserOnly0 in Java8 and Java9
- expanded test infra to have src_90_current and src_90_latest files for different JCL versions in Java 9

Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
@theresa-m
Copy link
Contributor Author

updated with Lan's latest comment

@theresa-m
Copy link
Contributor Author

@pshipton this is ready to go

@pshipton pshipton merged commit 8d42939 into eclipse-openj9:master May 23, 2018
@theresa-m theresa-m deleted the fix_1520_tests branch June 5, 2018 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants