From david.holmes at oracle.com Tue Apr 1 05:34:17 2014 From: david.holmes at oracle.com (David Holmes) Date: Tue, 01 Apr 2014 15:34:17 +1000 Subject: Creating jar files as part of a test? In-Reply-To: <5339A492.5020200@oracle.com> References: <5339044B.8060806@oracle.com> <5339077F.1060307@oracle.com> <5339A492.5020200@oracle.com> Message-ID: <533A4FD9.4090600@oracle.com> On 1/04/2014 3:23 AM, Jonathan Gibbons wrote: > If you are going to use test.classes, then > > a) you probably want your test to be the only test in its containing > directory -- otherwise you'll get the classes from other tests in your > jar file > b) you probably don't want to use library code (@library) because those > classes will be stored somewhere else. The test has to use @library because it is using processtools to launch another VM to run the "real" test via the jar file I am creating (and the fact it is a jar file is a critical part of the thing under test). So I guess I'm going to have to run the jar tool passing the value of test.classes as the path to the actual classes I want in the jar, and list the actual classes individually. Thanks, David > -- Jon > > On 03/30/2014 11:21 PM, Wang Weijun wrote: >> They are in test.classes (system property) I guess. >> >> If you are willing to create MANIFEST.MF yourself (or suppose it's not >> necessary for you), it's also OK to open a ZipOutputStream, and >> (putNextEntry, write)*. >> >> --Max >> >> On Mar 31, 2014, at 14:13, David Holmes wrote: >> >>> On 31/03/2014 4:08 PM, Wang Weijun wrote: >>>> test/java/util/jar/Manifest/CreateManifest.java has: >>>> >>>> String [] args = new String [] { "cvfm", jarFileName, >>>> ManifestName}; >>>> sun.tools.jar.Main jartool = >>>> new sun.tools.jar.Main(System.out, System.err, "jar"); >>>> jartool.run(args); >>> Thanks Max. I should have clarified that of course one option is to >>> simply run the jar tool programmatically :) But in that case I don't >>> know how to tell it where to find the files that jtreg has compiled - >>> are they simply in the current working directory? (Guess I can find >>> out readily enough :) ). >>> >>> Cheers, >>> David >>> >>>> --Max >>>> >>>> On Mar 31, 2014, at 13:59, David Holmes >>>> wrote: >>>> >>>>> I need to dynamically create a jar file containing some of the >>>>> classes that form my test, and then use that jar file on a >>>>> secondary exec of the VM (using ProcessTools). Given we aren't >>>>> supposed to check-in binary files to the repos, what is the >>>>> simplest way to generate a jar file using jtreg? >>>>> >>>>> Thanks, >>>>> David > From jonathan.gibbons at oracle.com Tue Apr 1 20:32:10 2014 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 01 Apr 2014 13:32:10 -0700 Subject: Creating jar files as part of a test? In-Reply-To: <533A4FD9.4090600@oracle.com> References: <5339044B.8060806@oracle.com> <5339077F.1060307@oracle.com> <5339A492.5020200@oracle.com> <533A4FD9.4090600@oracle.com> Message-ID: <533B224A.6090203@oracle.com> On 03/31/2014 10:34 PM, David Holmes wrote: > The test has to use @library because it is using processtools to > launch another VM to run the "real" test via the jar file I am > creating (and the fact it is a jar file is a critical part of the > thing under test). > > So I guess I'm going to have to run the jar tool passing the value of > test.classes as the path to the actual classes I want in the jar, and > list the actual classes individually. > > Thanks, > David test.classes points to a directory which only contains the classes for the files in the main test source directory. test.class.path is a path which contains a series of directories or jars for all the classes for the test. The includes the same directory as for test.classes as well as directories for the library classes. I understand that you are using processtools to launch the real test via the jar file. But is it the case that you don't need any library classes in the .jar file? In that case, you may be able to get away with just jarring up the test.classes directory. -- Jon From david.holmes at oracle.com Wed Apr 2 01:45:40 2014 From: david.holmes at oracle.com (David Holmes) Date: Wed, 02 Apr 2014 11:45:40 +1000 Subject: Creating jar files as part of a test? In-Reply-To: <533B224A.6090203@oracle.com> References: <5339044B.8060806@oracle.com> <5339077F.1060307@oracle.com> <5339A492.5020200@oracle.com> <533A4FD9.4090600@oracle.com> <533B224A.6090203@oracle.com> Message-ID: <533B6BC4.20006@oracle.com> On 2/04/2014 6:32 AM, Jonathan Gibbons wrote: > > On 03/31/2014 10:34 PM, David Holmes wrote: >> The test has to use @library because it is using processtools to >> launch another VM to run the "real" test via the jar file I am >> creating (and the fact it is a jar file is a critical part of the >> thing under test). >> >> So I guess I'm going to have to run the jar tool passing the value of >> test.classes as the path to the actual classes I want in the jar, and >> list the actual classes individually. >> >> Thanks, >> David > > > test.classes points to a directory which only contains the classes for > the files in the main test source directory. > > test.class.path is a path which contains a series of directories or jars > for all the classes for the test. The includes the same directory as > for test.classes as well as directories for the library classes. > > > I understand that you are using processtools to launch the real test via > the jar file. But is it the case that you don't need any library > classes in the .jar file? In that case, you may be able to get away with > just jarring up the test.classes directory. Correct. The jar only needs some trivial test logic - nothing from processtools or any other library classes. Thanks, David > -- Jon