--- old/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java 2018-01-25 15:59:14.000000000 -0800 +++ new/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java 2018-01-25 15:59:14.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ * manifest of a main application JAR */ +import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -41,6 +42,7 @@ import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessTools; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import static org.testng.Assert.*; @@ -48,11 +50,21 @@ @Test public class AddExportsAndOpensInManifest { + private String testName; + private int testCaseNum; + + @BeforeMethod + public void getTestName(Method m){ + testName = m.getName(); + testCaseNum = 0; + } + /** * Package Test1 and Test2 into a JAR file with the given attributes * in the JAR manifest, then execute the JAR file with `java -jar`. */ private OutputAnalyzer runTest(String attributes) throws Exception { + testCaseNum++; Manifest man = new Manifest(); Attributes attrs = man.getMainAttributes(); attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); @@ -67,7 +79,7 @@ } // create the JAR file with Test1 and Test2 - Path jarfile = Paths.get("test.jar"); + Path jarfile = Paths.get(String.format("%s-%s.jar", testName, testCaseNum)); Files.deleteIfExists(jarfile); Path classes = Paths.get(System.getProperty("test.classes", "")); @@ -172,5 +184,4 @@ attrs = "Main-Class=Test1,Add-Opens=java.base/jdk.internal.DoesNotExit"; runExpectingFail(attrs, "IllegalAccessError"); } - }