"""error: module testng reads package test from both test and testng"""

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

"""error: module testng reads package test from both test and testng"""

Martin Buchholz
When I run the jtreg test
java/lang/ModuleTests/addXXX
I fail with

direct:
error: module testng reads package test from both test and testng

In the javac command line I see:
 --add-modules testng,jcommander
but ... testng and jcommander aren't modules; they're just garden variety
jar files.

Running jtreg 4.2-b07.
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Mandy Chung
The test itself is a module that depends on testng.  So testng.jar is
added as an automatic module.  This test passes on my setup.

I am puzzling how jcommander.jar is added to the module path. Can you
send the .jtr file and list what's in JTwork/modules directory?

Mandy

On 8/17/17 6:22 PM, Martin Buchholz wrote:

> When I run the jtreg test
> java/lang/ModuleTests/addXXX
> I fail with
>
> direct:
> error: module testng reads package test from both test and testng
>
> In the javac command line I see:
>   --add-modules testng,jcommander
> but ... testng and jcommander aren't modules; they're just garden variety
> jar files.
>
> Running jtreg 4.2-b07.

Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Martin Buchholz
I just upgraded to 4.2-b08, although without any effect on this problem.
 jcommander.jar is from jtreg's lib directory

code-tools/jtreg/make/Defs.gmk says:
"""
# TestNG requires jcommander, which may or may not be bundled with
TESTNG_JAR.
# If it is not, set JCOMMANDER_JAR to an appropriate version
"""

 $ ls -l ./JTwork/modules
total 1620
-rw-r--r-- 1 martin martin   63504 Aug 21 12:27 jcommander.jar
-rw-r--r-- 1 martin martin 1589287 Aug 21 12:27 testng.jar

 $ /home/martin/jtreg-binaries/current/bin/jtreg -noreport -v:fail
-compilejdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
-testjdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
java/lang/ModuleTests/addXXX
--------------------------------------------------
TEST: java/lang/ModuleTests/addXXX/Driver.java
TEST JDK:
/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk

ACTION: build -- Failed. Compilation failed: Compilation failed
REASON: User specified action: run build test/* m1/* m2/* m3/* m4/*
TIME:   0.943 seconds
messages:
command: build test/* m1/* m2/* m3/* m4/*
reason: User specified action: run build test/* m1/* m2/* m3/* m4/*
Test directory:
  compile: test/module-info, test/test.C, test/test.Service,
test/test.Main, m1/module-info, m1/p1.C, m2/module-info, m2/p2.C,
m2/p2.internal.C, m3/module-info, m3/p3.C, m4/module-info, m4/p4.C
elapsed time (seconds): 0.943

ACTION: compile -- Failed. Compilation failed: Compilation failed
REASON: .class file out of date or does not exist
TIME:   0.938 seconds
messages:
command: compile
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java
reason: .class file out of date or does not exist
Mode: othervm
elapsed time (seconds): 0.938
configuration:
javac compilation environment
  add modules: testng jcommander
  module path: /home/martin/ws/jdk10/jdk/test/JTwork/modules

rerun:
DISPLAY=localhost:10.0 \
HOME=/home/martin \
LANG=en_US.UTF-8 \
PATH=/bin:/usr/bin \

/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/javac
\

-J-Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \

-J-Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-J-Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\

-J-Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\
        -J-Dtest.vm.opts= \
        -J-Dtest.tool.vm.opts= \
        -J-Dtest.compiler.opts= \
        -J-Dtest.java.opts= \

-J-Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\

-J-Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\
        -J-Dtest.timeout.factor=1.0 \

@/home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/compile.0.jta
STDOUT:
STDERR:
error: module testng reads package test from both test and testng
1 error

TEST RESULT: Failed. Compilation failed: Compilation failed
--------------------------------------------------
Test results: failed: 1

On Mon, Aug 21, 2017 at 12:12 PM, mandy chung <[hidden email]>
wrote:

> The test itself is a module that depends on testng.  So testng.jar is
> added as an automatic module.  This test passes on my setup.
>
> I am puzzling how jcommander.jar is added to the module path. Can you send
> the .jtr file and list what's in JTwork/modules directory?
>
> Mandy
>
>
> On 8/17/17 6:22 PM, Martin Buchholz wrote:
>
>> When I run the jtreg test
>> java/lang/ModuleTests/addXXX
>> I fail with
>>
>> direct:
>> error: module testng reads package test from both test and testng
>>
>> In the javac command line I see:
>>   --add-modules testng,jcommander
>> but ... testng and jcommander aren't modules; they're just garden variety
>> jar files.
>>
>> Running jtreg 4.2-b07.
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Mandy Chung
I can reproduce it and javac outputs the following errors.  javac
compiles successfully if jcommander.jar is removed.   Will look into it.

error: the unnamed module reads package com.beust.jcommander from both
jcommander and testng
error: the unnamed module reads package com.beust.jcommander.validators
from both jcommander and testng
error: the unnamed module reads package com.beust.jcommander.internal
from both jcommander and testng
error: the unnamed module reads package
com.beust.jcommander.defaultprovider from both jcommander and testng
error: the unnamed module reads package com.beust.jcommander.converters
from both jcommander and testng
error: module jcommander reads package com.beust.jcommander from both
testng and jcommander
error: module jcommander reads package com.beust.jcommander.validators
from both testng and jcommander
error: module jcommander reads package com.beust.jcommander.internal
from both testng and jcommander
error: module jcommander reads package
com.beust.jcommander.defaultprovider from both testng and jcommander
error: module jcommander reads package com.beust.jcommander.converters
from both testng and jcommander
error: module testng reads package com.beust.jcommander from both
jcommander and testng
error: module testng reads package com.beust.jcommander.validators from
both jcommander and testng
error: module testng reads package com.beust.jcommander.internal from
both jcommander and testng
error: module testng reads package com.beust.jcommander.defaultprovider
from both jcommander and testng
error: module testng reads package com.beust.jcommander.converters from
both jcommander and testng
/scratch/mchung/ws/jdk10/jdk10-dev/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java:23:
error: module test reads package com.beust.jcommander from both testng
and jcommander
module test {

Mandy

On 8/21/17 2:14 PM, Martin Buchholz wrote:

> I just upgraded to 4.2-b08, although without any effect on this
> problem.  jcommander.jar is from jtreg's lib directory
>
> code-tools/jtreg/make/Defs.gmk says:
> """
> # TestNG requires jcommander, which may or may not be bundled with
> TESTNG_JAR.
> # If it is not, set JCOMMANDER_JAR to an appropriate version
> """
>
>  $ ls -l ./JTwork/modules
> total 1620
> -rw-r--r-- 1 martin martin   63504 Aug 21 12:27 jcommander.jar
> -rw-r--r-- 1 martin martin 1589287 Aug 21 12:27 testng.jar
>
>  $ /home/martin/jtreg-binaries/current/bin/jtreg -noreport -v:fail
> -compilejdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
> -testjdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
> java/lang/ModuleTests/addXXX
> --------------------------------------------------
> TEST: java/lang/ModuleTests/addXXX/Driver.java
> TEST JDK:
> /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>
> ACTION: build -- Failed. Compilation failed: Compilation failed
> REASON: User specified action: run build test/* m1/* m2/* m3/* m4/*
> TIME:   0.943 seconds
> messages:
> command: build test/* m1/* m2/* m3/* m4/*
> reason: User specified action: run build test/* m1/* m2/* m3/* m4/*
> Test directory:
>   compile: test/module-info, test/test.C, test/test.Service,
> test/test.Main, m1/module-info, m1/p1.C, m2/module-info, m2/p2.C,
> m2/p2.internal.C, m3/module-info, m3/p3.C, m4/module-info, m4/p4.C
> elapsed time (seconds): 0.943
>
> ACTION: compile -- Failed. Compilation failed: Compilation failed
> REASON: .class file out of date or does not exist
> TIME:   0.938 seconds
> messages:
> command: compile
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java
> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java
> reason: .class file out of date or does not exist
> Mode: othervm
> elapsed time (seconds): 0.938
> configuration:
> javac compilation environment
>   add modules: testng jcommander
>   module path: /home/martin/ws/jdk10/jdk/test/JTwork/modules
>
> rerun:
> DISPLAY=localhost:10.0 \
> HOME=/home/martin \
> LANG=en_US.UTF-8 \
> PATH=/bin:/usr/bin \
> /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/javac
> \
> -J-Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \
> -J-Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
> \
> -J-Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
> \
> -J-Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
> \
>         -J-Dtest.vm.opts= \
>         -J-Dtest.tool.vm.opts= \
>         -J-Dtest.compiler.opts= \
>         -J-Dtest.java.opts= \
> -J-Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
> \
> -J-Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
> \
>         -J-Dtest.timeout.factor=1.0 \
> @/home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/compile.0.jta
> STDOUT:
> STDERR:
> error: module testng reads package test from both test and testng
> 1 error
>
> TEST RESULT: Failed. Compilation failed: Compilation failed
> --------------------------------------------------
> Test results: failed: 1
>
> On Mon, Aug 21, 2017 at 12:12 PM, mandy chung <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     The test itself is a module that depends on testng.  So testng.jar
>     is added as an automatic module.  This test passes on my setup.
>
>     I am puzzling how jcommander.jar is added to the module path. Can
>     you send the .jtr file and list what's in JTwork/modules directory?
>
>     Mandy
>
>
>     On 8/17/17 6:22 PM, Martin Buchholz wrote:
>
>         When I run the jtreg test
>         java/lang/ModuleTests/addXXX
>         I fail with
>
>         direct:
>         error: module testng reads package test from both test and testng
>
>         In the javac command line I see:
>           --add-modules testng,jcommander
>         but ... testng and jcommander aren't modules; they're just
>         garden variety
>         jar files.
>
>         Running jtreg 4.2-b07.
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Mandy Chung
Hi Martin,

"error: module testng reads package test from both test and testng"
indicates that a split package is detected.   Does your testng.jar
contain classes of package "test"?   I downloaded testng from maven
which does not have the package "test".

The testng.jar version I had bundled with jcommander classes and hence
the error message reports com.beust.jcommander.* packages from
jcommander and testng module.  It was an old version before testng was
mavenized.   If I run jtreg with the testng and jcommander downloaded
from maven, the test passes.

You can run java -p JTwork/modules --validate-modules to check if any
split packages or other conflict.

Jon, Jan,
   I think the javac error message could be improved to make it clear
that the package is split in multiple module.   In addition, the test
only contains explicit modules.   It's strange that the javac reports
that "the unnamed module reads package xxx from ....".  I will create a
JBS issue on improving the error message.

Mandy

On 8/21/17 4:06 PM, mandy chung wrote:

> I can reproduce it and javac outputs the following errors.  javac
> compiles successfully if jcommander.jar is removed.   Will look into it.
>
> error: the unnamed module reads package com.beust.jcommander from both
> jcommander and testng
> error: the unnamed module reads package
> com.beust.jcommander.validators from both jcommander and testng
> error: the unnamed module reads package com.beust.jcommander.internal
> from both jcommander and testng
> error: the unnamed module reads package
> com.beust.jcommander.defaultprovider from both jcommander and testng
> error: the unnamed module reads package
> com.beust.jcommander.converters from both jcommander and testng
> error: module jcommander reads package com.beust.jcommander from both
> testng and jcommander
> error: module jcommander reads package com.beust.jcommander.validators
> from both testng and jcommander
> error: module jcommander reads package com.beust.jcommander.internal
> from both testng and jcommander
> error: module jcommander reads package
> com.beust.jcommander.defaultprovider from both testng and jcommander
> error: module jcommander reads package com.beust.jcommander.converters
> from both testng and jcommander
> error: module testng reads package com.beust.jcommander from both
> jcommander and testng
> error: module testng reads package com.beust.jcommander.validators
> from both jcommander and testng
> error: module testng reads package com.beust.jcommander.internal from
> both jcommander and testng
> error: module testng reads package
> com.beust.jcommander.defaultprovider from both jcommander and testng
> error: module testng reads package com.beust.jcommander.converters
> from both jcommander and testng
> /scratch/mchung/ws/jdk10/jdk10-dev/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java:23:
> error: module test reads package com.beust.jcommander from both testng
> and jcommander
> module test {
>
> Mandy
>
> On 8/21/17 2:14 PM, Martin Buchholz wrote:
>> I just upgraded to 4.2-b08, although without any effect on this
>> problem.  jcommander.jar is from jtreg's lib directory
>>
>> code-tools/jtreg/make/Defs.gmk says:
>> """
>> # TestNG requires jcommander, which may or may not be bundled with
>> TESTNG_JAR.
>> # If it is not, set JCOMMANDER_JAR to an appropriate version
>> """
>>
>>  $ ls -l ./JTwork/modules
>> total 1620
>> -rw-r--r-- 1 martin martin   63504 Aug 21 12:27 jcommander.jar
>> -rw-r--r-- 1 martin martin 1589287 Aug 21 12:27 testng.jar
>>
>>  $ /home/martin/jtreg-binaries/current/bin/jtreg -noreport -v:fail
>> -compilejdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>> -testjdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>> java/lang/ModuleTests/addXXX
>> --------------------------------------------------
>> TEST: java/lang/ModuleTests/addXXX/Driver.java
>> TEST JDK:
>> /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>>
>> ACTION: build -- Failed. Compilation failed: Compilation failed
>> REASON: User specified action: run build test/* m1/* m2/* m3/* m4/*
>> TIME:   0.943 seconds
>> messages:
>> command: build test/* m1/* m2/* m3/* m4/*
>> reason: User specified action: run build test/* m1/* m2/* m3/* m4/*
>> Test directory:
>>   compile: test/module-info, test/test.C, test/test.Service,
>> test/test.Main, m1/module-info, m1/p1.C, m2/module-info, m2/p2.C,
>> m2/p2.internal.C, m3/module-info, m3/p3.C, m4/module-info, m4/p4.C
>> elapsed time (seconds): 0.943
>>
>> ACTION: compile -- Failed. Compilation failed: Compilation failed
>> REASON: .class file out of date or does not exist
>> TIME:   0.938 seconds
>> messages:
>> command: compile
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java
>> /home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java
>> reason: .class file out of date or does not exist
>> Mode: othervm
>> elapsed time (seconds): 0.938
>> configuration:
>> javac compilation environment
>>   add modules: testng jcommander
>>   module path: /home/martin/ws/jdk10/jdk/test/JTwork/modules
>>
>> rerun:
>> DISPLAY=localhost:10.0 \
>> HOME=/home/martin \
>> LANG=en_US.UTF-8 \
>> PATH=/bin:/usr/bin \
>> /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/javac
>> \
>> -J-Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>> \
>> -J-Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>> \
>> -J-Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
>> \
>> -J-Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
>> \
>>         -J-Dtest.vm.opts= \
>>         -J-Dtest.tool.vm.opts= \
>>         -J-Dtest.compiler.opts= \
>>         -J-Dtest.java.opts= \
>> -J-Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>> \
>> -J-Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>> \
>>         -J-Dtest.timeout.factor=1.0 \
>> @/home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/compile.0.jta
>>
>> STDOUT:
>> STDERR:
>> error: module testng reads package test from both test and testng
>> 1 error
>>
>> TEST RESULT: Failed. Compilation failed: Compilation failed
>> --------------------------------------------------
>> Test results: failed: 1
>>
>> On Mon, Aug 21, 2017 at 12:12 PM, mandy chung <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     The test itself is a module that depends on testng.  So testng.jar
>>     is added as an automatic module.  This test passes on my setup.
>>
>>     I am puzzling how jcommander.jar is added to the module path. Can
>>     you send the .jtr file and list what's in JTwork/modules directory?
>>
>>     Mandy
>>
>>
>>     On 8/17/17 6:22 PM, Martin Buchholz wrote:
>>
>>         When I run the jtreg test
>>         java/lang/ModuleTests/addXXX
>>         I fail with
>>
>>         direct:
>>         error: module testng reads package test from both test and
>> testng
>>
>>         In the javac command line I see:
>>           --add-modules testng,jcommander
>>         but ... testng and jcommander aren't modules; they're just
>>         garden variety
>>         jar files.
>>
>>         Running jtreg 4.2-b07.
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Martin Buchholz
Mandy, thanks for the investigation.

On Tue, Aug 22, 2017 at 12:38 PM, mandy chung <[hidden email]>
wrote:

>
> The testng.jar version I had bundled with jcommander classes and hence the
> error message reports com.beust.jcommander.* packages from jcommander and
> testng module.  It was an old version before testng was mavenized.   If I
> run jtreg with the testng and jcommander downloaded from maven, the test
> passes.
>

Right.  maven and jigsaw are both opinionated "module" systems.  Modern
testng and jcommander mavenized jar files are cleanly separated, from
maven's point of view.


> Jon, Jan,
>   I think the javac error message could be improved to make it clear that
> the package is split in multiple module.   In addition, the test only
> contains explicit modules.   It's strange that the javac reports that "the
> unnamed module reads package xxx from ....".  I will create a JBS issue on
> improving the error message.


Yes, this message is very confusing.
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Martin Buchholz
In reply to this post by Mandy Chung
On Tue, Aug 22, 2017 at 12:38 PM, mandy chung <[hidden email]>
wrote:

> Does your testng.jar contain classes of package "test"?   I downloaded
> testng from maven which does not have the package "test".
>

Sorry, I missed that question.  Yes, for historical reasons we are using
testng 6.9.8, and I see:

  $ ( wget -qOtestng.jar
https://search.maven.org/remotecontent?filepath=org/testng/testng/6.9.8/testng-6.9.8.jar
&& jar tf testng.jar | grep '^test/[^/]*.class$' | tail; rm testng.jar)
test/ReturnValueTest.class
test/SampleInheritance.class
test/SerializationTest.class
test/SimpleBaseTest.class
test/StaticTest$InnerStaticClass.class
test/StaticTest.class
test/Test1.class
test/Test2.class
test/TestHelper.class
test/TestListener.class

Including test/ is probably a packaging mistake.
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Mandy Chung


On 8/22/17 2:55 PM, Martin Buchholz wrote:

>
>
> On Tue, Aug 22, 2017 at 12:38 PM, mandy chung <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Does your testng.jar contain classes of package "test"?   I
>     downloaded testng from maven which does not have the package "test".
>
>
> Sorry, I missed that question.  Yes, for historical reasons we are
> using testng 6.9.8, and I see:
>
>   $ ( wget -qOtestng.jar
> https://search.maven.org/remotecontent?filepath=org/testng/testng/6.9.8/testng-6.9.8.jar 
> && jar tf testng.jar | grep '^test/[^/]*.class$' | tail; rm testng.jar)
> test/ReturnValueTest.class
> test/SampleInheritance.class
> test/SerializationTest.class
> test/SimpleBaseTest.class
> test/StaticTest$InnerStaticClass.class
> test/StaticTest.class
> test/Test1.class
> test/Test2.class
> test/TestHelper.class
> test/TestListener.class
>
> Including test/ is probably a packaging mistake.
Probably.  test package is not in 6.9.5 and 6.11 which I checked.

Mandy
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Martin Buchholz
In reply to this post by Martin Buchholz
I tried updating my jtreg from testng 6.9.8 to 6.9.9 and got the
insufficiently helpful

Error occurred during initialization of boot layer
java.lang.module.FindException: Module testng not found, required by test

even though this new jtreg can run other testng tests successfully.
Full log below:

 $ jtr java/lang/ModuleTests/addXXX/Driver.java
/home/martin/jtreg-binaries/current/bin/jtreg -noreport -agentvm
-verbose:nopass,fail,error -vmoption:-enablesystemassertions -automatic
-ignore:quiet
-compilejdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
-testjdk:/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
java/lang/ModuleTests/addXXX/Driver.java
--------------------------------------------------
TEST: java/lang/ModuleTests/addXXX/Driver.java
TEST JDK:
/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk

ACTION: build -- Passed. Build successful
REASON: User specified action: run build test/* m1/* m2/* m3/* m4/*
TIME:   1.481 seconds
messages:
command: build test/* m1/* m2/* m3/* m4/*
reason: User specified action: run build test/* m1/* m2/* m3/* m4/*
Test directory:
  compile: test/module-info, test/test.C, test/test.Service,
test/test.Main, m1/module-info, m1/p1.C, m2/module-info, m2/p2.C,
m2/p2.internal.C, m3/module-info, m3/p3.C, m4/module-info, m4/p4.C
elapsed time (seconds): 1.481

ACTION: compile -- Passed. Compilation successful
REASON: .class file out of date or does not exist
TIME:   1.477 seconds
messages:
command: compile
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java
reason: .class file out of date or does not exist
Mode: agentvm
Agent id: 0
elapsed time (seconds): 1.477
configuration:
Boot Layer (javac runtime environment)
  class path: /home/martin/jtreg-binaries/4.2-b08/lib/javatest.jar
              /home/martin/jtreg-binaries/4.2-b08/lib/jtreg.jar
  patch:      java.base
/home/martin/ws/jdk10/jdk/test/JTwork/patches/java.base

javac compilation environment
  add modules: testng jcommander
  module path: /home/martin/ws/jdk10/jdk/test/JTwork/modules

rerun:
DISPLAY=localhost:10.0 \
HOME=/home/martin \
LANG=en_US.UTF-8 \
PATH=/bin:/usr/bin \

/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/javac
\
        -J-enablesystemassertions \

-J-Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-J-Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \

-J-Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-J-Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\

-J-Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\
        -J-Dtest.vm.opts=-enablesystemassertions \
        -J-Dtest.tool.vm.opts=-J-enablesystemassertions \
        -J-Dtest.compiler.opts= \
        -J-Dtest.java.opts= \

-J-Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\

-J-Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\
        -J-Dtest.timeout.factor=1.0 \
        -d
/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
\
        --module-source-path
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \
        --module-path /home/martin/ws/jdk10/jdk/test/JTwork/modules \
        --add-modules testng,jcommander
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java
direct:
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java:23:
warning: [module] module name component m1 should avoid terminal digits
module m1 {
       ^
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java:23:
warning: [module] module name component m2 should avoid terminal digits
module m2 {
       ^
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java:23:
warning: [module] module name component m3 should avoid terminal digits
module m3 {
       ^
/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java:23:
warning: [module] module name component m4 should avoid terminal digits
module m4 {
       ^
4 warnings

ACTION: build -- Passed. All files up to date
REASON: Named class compiled on demand
TIME:   0.0 seconds
messages:
command: build test/test.Main
reason: Named class compiled on demand
elapsed time (seconds): 0.0

ACTION: testng -- Failed. Unexpected exit from test [exit code: 1]
REASON: User specified action: run testng/othervm test/test.Main
TIME:   0.215 seconds
messages:
command: testng test/test.Main
reason: User specified action: run testng/othervm test/test.Main
Mode: othervm [/othervm specified]
elapsed time (seconds): 0.215
configuration:
Boot Layer
  add modules: test m4 m2 m3 m1
  module path:
/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules

STDOUT:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module testng not found, required by test
STDERR:
rerun:
DISPLAY=localhost:10.0 \
HOME=/home/martin \
LANG=en_US.UTF-8 \
PATH=/bin:/usr/bin \
CLASSPATH=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX:/home/martin/jtreg-binaries/4.2-b08/lib/testng.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jcommander.jar:/home/martin/jtreg-binaries/4.2-b08/lib/javatest.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jtreg.jar
\

/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/java
\

-Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \

-Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\

-Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\
        -Dtest.vm.opts=-enablesystemassertions \
        -Dtest.tool.vm.opts=-J-enablesystemassertions \
        -Dtest.compiler.opts= \
        -Dtest.java.opts= \

-Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\

-Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\
        -Dtest.timeout.factor=1.0 \
        --module-path
/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
\
        --add-modules test,m4,m2,m3,m1 \
        -enablesystemassertions \
        com.sun.javatest.regtest.agent.MainWrapper
/home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/testng.0.jta
java/lang/ModuleTests/addXXX/Driver.java false test/test.Main

TEST RESULT: Failed. Unexpected exit from test [exit code: 1]
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Mandy Chung

On 8/22/17 3:52 PM, Martin Buchholz wrote:

> :
>
> ACTION: testng -- Failed. Unexpected exit from test [exit code: 1]
> REASON: User specified action: run testng/othervm test/test.Main
> TIME:   0.215 seconds
> messages:
> command: testng test/test.Main
> reason: User specified action: run testng/othervm test/test.Main
> Mode: othervm [/othervm specified]
> elapsed time (seconds): 0.215
> configuration:
> Boot Layer
>   add modules: test m4 m2 m3 m1
>   module path:
> /home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
>
> STDOUT:
> Error occurred during initialization of boot layer
> java.lang.module.FindException: Module testng not found, required by test
> STDERR:
> rerun:
> DISPLAY=localhost:10.0 \
> HOME=/home/martin \
> LANG=en_US.UTF-8 \
> PATH=/bin:/usr/bin \
> CLASSPATH=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX:/home/martin/jtreg-binaries/4.2-b08/lib/testng.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jcommander.jar:/home/martin/jtreg-binaries/4.2-b08/lib/javatest.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jtreg.jar
> \
> /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/java
> \
> -Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
> \
> -Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \
> -Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
> \
> -Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
> \
> -Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
> \
> -Dtest.vm.opts=-enablesystemassertions \
> -Dtest.tool.vm.opts=-J-enablesystemassertions \
>         -Dtest.compiler.opts= \
>         -Dtest.java.opts= \
> -Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
> \
> -Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
> \
>         -Dtest.timeout.factor=1.0 \
>         --module-path
> /home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
> \

====> /home/martin/ws/jdk10/jdk/test/JTwork/modules is not in the module
path.  Therefore testng is not found.

I can't reproduce this error.  I downloaded testng 6.9.9 and it works
for me.  This is the jtreg version I used.

$ jtreg -version
jtreg, version 4.2 fcs b08
Installed in /java/devtools/jtreg/jtreg-4.2/lib/jtreg.jar
Running on platform version 9 from /java/re/jdk-9.jdk/Contents/Home.
Built with Java(TM) 2 SDK, Version 1.7.0-b147 on July 21, 2017.
Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms.
JCov 2.0-b18 beta
TestNG (testng.jar): version 6.9.9
TestNG (jcommander.jar): version 1.72


Mandy
>         --add-modules test,m4,m2,m3,m1 \
>         -enablesystemassertions \
> com.sun.javatest.regtest.agent.MainWrapper
> /home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/testng.0.jta
> java/lang/ModuleTests/addXXX/Driver.java false test/test.Main
>
> TEST RESULT: Failed. Unexpected exit from test [exit code: 1]

Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Martin Buchholz
I also tried upgrading jcommander.jar to 1.72 from 1.48, but get the same
error.
Debugging hints?


On Tue, Aug 22, 2017 at 4:28 PM, mandy chung <[hidden email]> wrote:

>
> On 8/22/17 3:52 PM, Martin Buchholz wrote:
>
> :
>
>
> ACTION: testng -- Failed. Unexpected exit from test [exit code: 1]
> REASON: User specified action: run testng/othervm test/test.Main
> TIME:   0.215 seconds
> messages:
> command: testng test/test.Main
> reason: User specified action: run testng/othervm test/test.Main
> Mode: othervm [/othervm specified]
> elapsed time (seconds): 0.215
> configuration:
> Boot Layer
>   add modules: test m4 m2 m3 m1
>   module path: /home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/
> ModuleTests/addXXX/Driver.d/modules
>
> STDOUT:
> Error occurred during initialization of boot layer
> java.lang.module.FindException: Module testng not found, required by test
> STDERR:
> rerun:
> DISPLAY=localhost:10.0 \
> HOME=/home/martin \
> LANG=en_US.UTF-8 \
> PATH=/bin:/usr/bin \
> CLASSPATH=/home/martin/ws/jdk10/jdk/test/JTwork/classes/
> java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/
> jdk10/jdk/test/java/lang/ModuleTests/addXXX:/home/
> martin/jtreg-binaries/4.2-b08/lib/testng.jar:/home/martin/
> jtreg-binaries/4.2-b08/lib/jcommander.jar:/home/martin/
> jtreg-binaries/4.2-b08/lib/javatest.jar:/home/martin/
> jtreg-binaries/4.2-b08/lib/jtreg.jar \
>     /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/java
> \
>         -Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/
> JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/
> home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \
>         -Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
> \
>         -Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
> \
>         -Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/
> classes/java/lang/ModuleTests/addXXX/Driver.d \
>         -Dtest.class.path=/home/martin/ws/jdk10/jdk/test/
> JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d \
>         -Dtest.vm.opts=-enablesystemassertions \
>         -Dtest.tool.vm.opts=-J-enablesystemassertions \
>         -Dtest.compiler.opts= \
>         -Dtest.java.opts= \
>         -Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-
> normal-server-release/images/jdk \
>         -Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-
> normal-server-release/images/jdk \
>         -Dtest.timeout.factor=1.0 \
>         --module-path /home/martin/ws/jdk10/jdk/
> test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules \
>
>
> ====> /home/martin/ws/jdk10/jdk/test/JTwork/modules is not in the module
> path.  Therefore testng is not found.
>
> I can't reproduce this error.  I downloaded testng 6.9.9 and it works for
> me.  This is the jtreg version I used.
>
> $ jtreg -version
> jtreg, version 4.2 fcs b08
> Installed in /java/devtools/jtreg/jtreg-4.2/lib/jtreg.jar
> Running on platform version 9 from /java/re/jdk-9.jdk/Contents/Home.
> Built with Java(TM) 2 SDK, Version 1.7.0-b147 on July 21, 2017.
> Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights
> reserved.
> Use is subject to license terms.
> JCov 2.0-b18 beta
> TestNG (testng.jar): version 6.9.9
> TestNG (jcommander.jar): version 1.72
>
>
> Mandy
>
>         --add-modules test,m4,m2,m3,m1 \
>         -enablesystemassertions \
>         com.sun.javatest.regtest.agent.MainWrapper
> /home/martin/ws/jdk10/jdk/test/JTwork/java/lang/
> ModuleTests/addXXX/Driver.d/testng.0.jta java/lang/ModuleTests/addXXX/Driver.java
> false test/test.Main
>
> TEST RESULT: Failed. Unexpected exit from test [exit code: 1]
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Mandy Chung
The error message is clear because testng is not found from the module path.

Error occurred during initialization of boot layer
java.lang.module.FindException: Module testng not found, required by test

If you edit the rerun command from jtr file to add JTwork/modules to
module path as follows:

--module-path /home/martin/ws/jdk10/jdk/
test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules:/home/martin/ws/jdk10/jdk/

test/JTwork/modules

If it runs successfully, then the question is why jtreg includes
JTwork/modules in javac --module-path but not at run time in your local
run but my local jtreg works fine.  Jon may have jtreg debugging tip.

Mandy

On 8/22/17 6:18 PM, Martin Buchholz wrote:

> I also tried upgrading jcommander.jar to 1.72 from 1.48, but get the
> same error.
> Debugging hints?
>
>
> On Tue, Aug 22, 2017 at 4:28 PM, mandy chung <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>
>     On 8/22/17 3:52 PM, Martin Buchholz wrote:
>>     :
>>
>>
>>     ACTION: testng -- Failed. Unexpected exit from test [exit code: 1]
>>     REASON: User specified action: run testng/othervm test/test.Main
>>     TIME:   0.215 seconds
>>     messages:
>>     command: testng test/test.Main
>>     reason: User specified action: run testng/othervm test/test.Main
>>     Mode: othervm [/othervm specified]
>>     elapsed time (seconds): 0.215
>>     configuration:
>>     Boot Layer
>>       add modules: test m4 m2 m3 m1
>>       module path:
>>     /home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
>>
>>     STDOUT:
>>     Error occurred during initialization of boot layer
>>     java.lang.module.FindException: Module testng not found, required
>>     by test
>>     STDERR:
>>     rerun:
>>     DISPLAY=localhost:10.0 \
>>     HOME=/home/martin \
>>     LANG=en_US.UTF-8 \
>>     PATH=/bin:/usr/bin \
>>     CLASSPATH=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX:/home/martin/jtreg-binaries/4.2-b08/lib/testng.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jcommander.jar:/home/martin/jtreg-binaries/4.2-b08/lib/javatest.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jtreg.jar
>>     \
>>     /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/java
>>     \
>>     -Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>>     \
>>     -Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>>     \
>>     -Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>>     \
>>     -Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
>>     \
>>     -Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
>>     \
>>     -Dtest.vm.opts=-enablesystemassertions \
>>     -Dtest.tool.vm.opts=-J-enablesystemassertions \
>>     -Dtest.compiler.opts= \
>>     -Dtest.java.opts= \
>>     -Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>>     \
>>     -Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>>     \
>>     -Dtest.timeout.factor=1.0 \
>>             --module-path
>>     /home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
>>     \
>
>     ====> /home/martin/ws/jdk10/jdk/test/JTwork/modules is not in the
>     module path.  Therefore testng is not found.
>
>     I can't reproduce this error.  I downloaded testng 6.9.9 and it
>     works for me.  This is the jtreg version I used.
>
>     $ jtreg -version
>     jtreg, version 4.2 fcs b08
>     Installed in /java/devtools/jtreg/jtreg-4.2/lib/jtreg.jar
>     Running on platform version 9 from /java/re/jdk-9.jdk/Contents/Home.
>     Built with Java(TM) 2 SDK, Version 1.7.0-b147 on July 21, 2017.
>     Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights
>     reserved.
>     Use is subject to license terms.
>     JCov 2.0-b18 beta
>     TestNG (testng.jar): version 6.9.9
>     TestNG (jcommander.jar): version 1.72
>
>
>     Mandy
>>             --add-modules test,m4,m2,m3,m1 \
>>     -enablesystemassertions \
>>     com.sun.javatest.regtest.agent.MainWrapper
>>     /home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/testng.0.jta
>>     java/lang/ModuleTests/addXXX/Driver.java false test/test.Main
>>
>>     TEST RESULT: Failed. Unexpected exit from test [exit code: 1]
>
>

Reply | Threaded
Open this post in threaded view
|

Re: """error: module testng reads package test from both test and testng"""

Martin Buchholz
Indeed, when I rerun the command with your suggested module-path, it works
(I had never used "rerun" before).
So why does my jtreg not make these modules available at runtime?  This is
a fairly ordinary Ubuntu 14.4 system.

 $ DISPLAY=localhost:10.0 \
HOME=/home/martin \
LANG=en_US.UTF-8 \
PATH=/bin:/usr/bin \
CLASSPATH=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX:/home/martin/jtreg-binaries/4.2-b08-testng-6.9.9/lib/testng.jar:/home/martin/jtreg-binaries/4.2-b08-testng-6.9.9/lib/jcommander.jar:/home/martin/jtreg-binaries/4.2-b08-testng-6.9.9/lib/javatest.jar:/home/martin/jtreg-binaries/4.2-b08-testng-6.9.9/lib/jtreg.jar
\

/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/java
\

-Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \

-Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
\

-Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\

-Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d
\
        -Dtest.vm.opts=-enablesystemassertions \
        -Dtest.tool.vm.opts=-J-enablesystemassertions \
        -Dtest.compiler.opts= \
        -Dtest.java.opts= \

-Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\

-Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
\
        -Dtest.timeout.factor=1.0 \
        --module-path
/home/martin/ws/jdk10/jdk/test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules:"/home/martin/ws/jdk10/jdk/test/JTwork/modules"
\
        --add-modules test,m4,m2,m3,m1 \
        -enablesystemassertions \
        com.sun.javatest.regtest.agent.MainWrapper
/home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/testng.0.jta
java/lang/ModuleTests/addXXX/Driver.java false test/test.Main
[TestNG] Running:
  java/lang/ModuleTests/addXXX/Driver.java

test test.Main.testAddExports(): success
test test.Main.testAddOpens(): success
test test.Main.testAddReads(): success
test test.Main.testAddUses(): success

===============================================
java/lang/ModuleTests/addXXX/Driver.java
Total tests run: 4, Failures: 0, Skips: 0
===============================================

STATUS:Passed.

On Tue, Aug 22, 2017 at 6:48 PM, mandy chung <[hidden email]> wrote:

> The error message is clear because testng is not found from the module
> path.
>
> Error occurred during initialization of boot layer
> java.lang.module.FindException: Module testng not found, required by test
>
> If you edit the rerun command from jtr file to add JTwork/modules to
> module path as follows:
>
> --module-path /home/martin/ws/jdk10/jdk/
> test/JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/mo
> dules:/home/martin/ws/jdk10/jdk/
> test/JTwork/modules
>
> If it runs successfully, then the question is why jtreg includes
> JTwork/modules in javac --module-path but not at run time in your local run
> but my local jtreg works fine.  Jon may have jtreg debugging tip.
>
> Mandy
>
> On 8/22/17 6:18 PM, Martin Buchholz wrote:
>
> I also tried upgrading jcommander.jar to 1.72 from 1.48, but get the same
> error.
> Debugging hints?
>
>
> On Tue, Aug 22, 2017 at 4:28 PM, mandy chung <[hidden email]>
> wrote:
>
>>
>> On 8/22/17 3:52 PM, Martin Buchholz wrote:
>>
>> :
>>
>>
>> ACTION: testng -- Failed. Unexpected exit from test [exit code: 1]
>> REASON: User specified action: run testng/othervm test/test.Main
>> TIME:   0.215 seconds
>> messages:
>> command: testng test/test.Main
>> reason: User specified action: run testng/othervm test/test.Main
>> Mode: othervm [/othervm specified]
>> elapsed time (seconds): 0.215
>> configuration:
>> Boot Layer
>>   add modules: test m4 m2 m3 m1
>>   module path: /home/martin/ws/jdk10/jdk/test
>> /JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules
>>
>> STDOUT:
>> Error occurred during initialization of boot layer
>> java.lang.module.FindException: Module testng not found, required by test
>> STDERR:
>> rerun:
>> DISPLAY=localhost:10.0 \
>> HOME=/home/martin \
>> LANG=en_US.UTF-8 \
>> PATH=/bin:/usr/bin \
>> CLASSPATH=/home/martin/ws/jdk10/jdk/test/JTwork/classes/java
>> /lang/ModuleTests/addXXX/Driver.d:/home/martin/ws/jdk10/jdk/
>> test/java/lang/ModuleTests/addXXX:/home/martin/jtreg-
>> binaries/4.2-b08/lib/testng.jar:/home/martin/jtreg-
>> binaries/4.2-b08/lib/jcommander.jar:/home/martin/jtreg-
>> binaries/4.2-b08/lib/javatest.jar:/home/martin/jtreg-binaries/4.2-b08/lib/jtreg.jar
>> \
>>     /home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk/bin/java
>> \
>>         -Dtest.class.path.prefix=/home/martin/ws/jdk10/jdk/test/JTwo
>> rk/classes/java/lang/ModuleTests/addXXX/Driver.d:/home/
>> martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX \
>>         -Dtest.src=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>> \
>>         -Dtest.src.path=/home/martin/ws/jdk10/jdk/test/java/lang/ModuleTests/addXXX
>> \
>>         -Dtest.classes=/home/martin/ws/jdk10/jdk/test/JTwork/classes
>> /java/lang/ModuleTests/addXXX/Driver.d \
>>         -Dtest.class.path=/home/martin/ws/jdk10/jdk/test/JTwork/
>> classes/java/lang/ModuleTests/addXXX/Driver.d \
>>         -Dtest.vm.opts=-enablesystemassertions \
>>         -Dtest.tool.vm.opts=-J-enablesystemassertions \
>>         -Dtest.compiler.opts= \
>>         -Dtest.java.opts= \
>>         -Dtest.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>> \
>>         -Dcompile.jdk=/home/martin/ws/jdk10/build/linux-x86_64-normal-server-release/images/jdk
>> \
>>         -Dtest.timeout.factor=1.0 \
>>         --module-path /home/martin/ws/jdk10/jdk/test
>> /JTwork/classes/java/lang/ModuleTests/addXXX/Driver.d/modules \
>>
>>
>> ====> /home/martin/ws/jdk10/jdk/test/JTwork/modules is not in the module
>> path.  Therefore testng is not found.
>>
>> I can't reproduce this error.  I downloaded testng 6.9.9 and it works for
>> me.  This is the jtreg version I used.
>>
>> $ jtreg -version
>> jtreg, version 4.2 fcs b08
>> Installed in /java/devtools/jtreg/jtreg-4.2/lib/jtreg.jar
>> Running on platform version 9 from /java/re/jdk-9.jdk/Contents/Home.
>> Built with Java(TM) 2 SDK, Version 1.7.0-b147 on July 21, 2017.
>> Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights
>> reserved.
>> Use is subject to license terms.
>> JCov 2.0-b18 beta
>> TestNG (testng.jar): version 6.9.9
>> TestNG (jcommander.jar): version 1.72
>>
>>
>> Mandy
>>
>>         --add-modules test,m4,m2,m3,m1 \
>>         -enablesystemassertions \
>>         com.sun.javatest.regtest.agent.MainWrapper
>> /home/martin/ws/jdk10/jdk/test/JTwork/java/lang/ModuleTests/addXXX/Driver.d/testng.0.jta
>> java/lang/ModuleTests/addXXX/Driver.java false test/test.Main
>>
>> TEST RESULT: Failed. Unexpected exit from test [exit code: 1]
>>
>>
>>
>
>