< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/GraalTest.java

Print this page
rev 56282 : [mq]: graal

*** 1,7 **** /* ! * Copyright (c) 2013, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2013, 2019, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 33,44 **** --- 33,46 ---- import java.lang.reflect.Field; import java.lang.reflect.Method; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; + import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; + import java.nio.file.attribute.FileAttribute; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List;
*** 456,466 **** static { Runtime.getRuntime().addShutdownHook(new Thread("GlobalMetricsPrinter") { @Override public void run() { ! globalMetrics.print(new OptionValues(OptionValues.newOptionMap())); } }); } private final ThreadLocal<List<DebugContext>> cachedDebugs = new ThreadLocal<>(); --- 458,468 ---- static { Runtime.getRuntime().addShutdownHook(new Thread("GlobalMetricsPrinter") { @Override public void run() { ! // globalMetrics.print(new OptionValues(OptionValues.newOptionMap())); } }); } private final ThreadLocal<List<DebugContext>> cachedDebugs = new ThreadLocal<>();
*** 504,513 **** --- 506,539 ---- */ public static TestRule createTimeoutMillis(long milliseconds) { return createTimeout(milliseconds, TimeUnit.MILLISECONDS); } + public static class TemporaryDirectory implements AutoCloseable { + + public final Path path; + private IOException closeException; + + public TemporaryDirectory(Path dir, String prefix, FileAttribute<?>... attrs) throws IOException { + path = Files.createTempDirectory(dir == null ? Paths.get(".") : dir, prefix, attrs); + } + + @Override + public void close() { + closeException = removeDirectory(path); + } + + public IOException getCloseException() { + return closeException; + } + + @Override + public String toString() { + return path.toString(); + } + } + /** * Tries to recursively remove {@code directory}. If it fails with an {@link IOException}, the * exception's {@code toString()} is printed to {@link System#err} and the exception is * returned. */
< prev index next >