RFR: Re-arrange test directory structure

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Apr 7 17:21:34 UTC 2022


On Thu, 7 Apr 2022 17:15:22 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> Looking more at jextract tests, when we moved things in the standalone repo, few things went wrong. For instance, `TestSplit` cannot be executed right now, because it would need to be ran with some custom JDK properties. But since it's now part of a testng test structure, that is not possible.
> 
> We'd need to move TestSplit in a different folder, but if we do that we have a problem, in that TestSplit depends on the TestUtils and JextractToolRunner helpers.
> 
> This patch moves all the helper classes (JextractToolRunner, TestUtils, JextractAPITestBase) in the `testlib` package under the `test/lib` folder.
> 
> Then, this patch restructures the test folder, as follows:
> 
> * the `java` folder is renamed to `testng` - all testng test w/o jtreg header live here
> * the `generator` folder is moved under a new folder called `jtreg`; under this new folder we find tests with regular jtreg header
> 
> With all this, we can now add a TEST.properties file under `test/testng` which contains a pointer to the lib folder that should be used by testng tests.
> 
> And, we can finally move TestSplit under `test/jtreg`, and add the jtreg test header we need to be able to run this correctly.

test/lib/testlib/JextractApiTestBase.java line 45:

> 43: 
> 44:     public static  Declaration.Scoped parse(String headerFilename, String... parseOptions) {
> 45:         Path header = Paths.get(System.getProperty("test.file")).getParent().resolve(headerFilename);

This path is now independent from where tests are located

test/lib/testlib/JextractToolRunner.java line 90:

> 88:     protected JextractToolRunner(Path input, Path output) {
> 89:          inputDir = (input != null) ? input :
> 90:                 Paths.get(System.getProperty("test.file")).getParent();

This path is now independent from where tests are located

-------------

PR: https://git.openjdk.java.net/jextract/pull/17


More information about the jextract-dev mailing list