30 import java.nio.file.Path;
31
32 import jdk.internal.vm.compiler.collections.EconomicMap;
33 import org.graalvm.compiler.debug.DebugOptions;
34 import org.graalvm.compiler.options.OptionKey;
35 import org.graalvm.compiler.options.OptionValues;
36 import org.junit.Test;
37
38 /**
39 * Check that setting the dump path results in files ending up in the right directory with matching
40 * names.
41 */
42 public class DumpPathTest extends GraalCompilerTest {
43
44 public static Object snippet() {
45 return new String("snippet");
46 }
47
48 @Test
49 public void testDump() throws IOException {
50 Path dumpDirectoryPath = Files.createTempDirectory("DumpPathTest");
51 String[] extensions = new String[]{".cfg", ".bgv", ".graph-strings"};
52 EconomicMap<OptionKey<?>, Object> overrides = OptionValues.newOptionMap();
53 overrides.put(DebugOptions.DumpPath, dumpDirectoryPath.toString());
54 overrides.put(DebugOptions.PrintGraphFile, true);
55 overrides.put(DebugOptions.PrintCanonicalGraphStrings, true);
56 overrides.put(DebugOptions.Dump, "*");
57
58 // Generate dump files.
59 test(new OptionValues(getInitialOptions(), overrides), "snippet");
60 // Check that Ideal files got created, in the right place.
61 checkForFiles(dumpDirectoryPath, extensions);
62
63 // Clean up the generated files.
64 scrubDirectory(dumpDirectoryPath);
65 }
66
67 /**
68 * Check that the given directory contains file or directory names with all the given
69 * extensions.
|
30 import java.nio.file.Path;
31
32 import jdk.internal.vm.compiler.collections.EconomicMap;
33 import org.graalvm.compiler.debug.DebugOptions;
34 import org.graalvm.compiler.options.OptionKey;
35 import org.graalvm.compiler.options.OptionValues;
36 import org.junit.Test;
37
38 /**
39 * Check that setting the dump path results in files ending up in the right directory with matching
40 * names.
41 */
42 public class DumpPathTest extends GraalCompilerTest {
43
44 public static Object snippet() {
45 return new String("snippet");
46 }
47
48 @Test
49 public void testDump() throws IOException {
50 assumeManagementLibraryIsLoadable();
51 Path dumpDirectoryPath = Files.createTempDirectory("DumpPathTest");
52 String[] extensions = new String[]{".cfg", ".bgv", ".graph-strings"};
53 EconomicMap<OptionKey<?>, Object> overrides = OptionValues.newOptionMap();
54 overrides.put(DebugOptions.DumpPath, dumpDirectoryPath.toString());
55 overrides.put(DebugOptions.PrintGraphFile, true);
56 overrides.put(DebugOptions.PrintCanonicalGraphStrings, true);
57 overrides.put(DebugOptions.Dump, "*");
58
59 // Generate dump files.
60 test(new OptionValues(getInitialOptions(), overrides), "snippet");
61 // Check that Ideal files got created, in the right place.
62 checkForFiles(dumpDirectoryPath, extensions);
63
64 // Clean up the generated files.
65 scrubDirectory(dumpDirectoryPath);
66 }
67
68 /**
69 * Check that the given directory contains file or directory names with all the given
70 * extensions.
|