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

Test project for modularity #1709

Closed
pdbain-ibm opened this issue Apr 17, 2018 · 2 comments
Closed

Test project for modularity #1709

pdbain-ibm opened this issue Apr 17, 2018 · 2 comments

Comments

@pdbain-ibm
Copy link
Contributor

We need tests to exercise modularity, specifically (at first) checking class visibility under various conditions. Eclipse at present allows only one module-info.java (and hence one module) per eclipse project.

Assuming we need N modules, we can:

  1. Maintain N projects (clumsy and hard to maintain). Also, test cases which are caught at compile time as well as runtime are problematic.

  2. Put all classes and packages for all modules in the regular source directory in one project (possibly an existing project), and separate module-info.java files in a special place. Use the generic target in build.xml to compile the classes. After that, use another build.xml target to compile the module-info files and move the packages and class files to directories corresponding to their modules along with the module info. Since the java files are in an eclipse source directory, we can edit them fairly easily.

  3. Like 2., but put all the files in a generic directory in the project and use the a special target in build.xml file to do all compilation and file movement. This loses the benefit of the source-aware editor.

I would like to know if there are other ways to approach this.

@smlambert @llxia your thoughts? Any other ideas? FYI @DanHeidinga @pshipton @keithc-ca

@pdbain-ibm
Copy link
Contributor Author

I hacked up an outline of 2. (with a makefile in lieu of the ant scripting) for designer testing the VM.
This is preliminary and I am agreeable to a better arrangement.

https://github.com/pdbain-ibm/openj9/tree/modularity

Relevant directories are https://github.com/pdbain-ibm/openj9/tree/modularity/test/functional/Java9andUp/modules
and
https://github.com/pdbain-ibm/openj9/tree/modularity/test/functional/Java9andUp/src/org/openj9/test/modularity

The files are arranged so they compile in Eclipse and the makefile rearranges them into the correct module directories.

@pdbain-ibm
Copy link
Contributor Author

pdbain-ibm commented Apr 27, 2018

The plan is:

  • put the test code itself in the Java9andUp source directory with all other test files. This simplifies writing the code and fixing syntax errors. It also causes them to be compiled by the default compile target in build.xml.
  • Put the module directories and module-info.java files in a separate modules directory.
  • In build.xml:
    • copy the module directories to a module_bin directory
    • after the test code is compiled into the bin directory, copy the modularity test class files to the appropriate module directories in module_bin, e.g. copy bin/org/openj9/test/modularity/pkgAe/Klass.class to module_bin/org.openj9test.modularity.moduleA
    • compile each module-info.java file
    • copy module_bin to the dist directory
  • run the test using the module_bin as the module path.

I have a rough draft of the tests in pull request #1763. I am working on the build script now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants