# HG changeset patch # User iignatyev # Date 1528416623 25200 # Node ID d134badc8a422eae98427e65c811cdf488cadb28 # Parent f91927a2c8d3f989161864d76b4e3e08bc466546 8204577: jittester generator doesn't kill processes on timeout Reviewed-by: kvn, epavlova diff -r f91927a2c8d3 -r d134badc8a42 test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java --- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java Thu Jun 07 16:06:49 2018 -0700 +++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java Thu Jun 07 17:10:23 2018 -0700 @@ -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 @@ -37,6 +37,7 @@ import jdk.test.lib.jittester.utils.PseudoRandom; public abstract class TestsGenerator implements BiConsumer { + private static final int DEFAULT_JTREG_TIMEOUT = 120; protected static final String JAVA_BIN = getJavaPath(); protected static final String JAVAC = Paths.get(JAVA_BIN, "javac").toString(); protected static final String JAVA = Paths.get(JAVA_BIN, "java").toString(); @@ -73,15 +74,17 @@ pb.redirectError(new File(name + ".err")); pb.redirectOutput(new File(name + ".out")); Process process = pb.start(); - if (process.waitFor(Automatic.MINUTES_TO_WAIT, TimeUnit.MINUTES)) { - try (FileWriter file = new FileWriter(name + ".exit")) { - file.write(Integer.toString(process.exitValue())); + try { + if (process.waitFor(DEFAULT_JTREG_TIMEOUT, TimeUnit.SECONDS)) { + try (FileWriter file = new FileWriter(name + ".exit")) { + file.write(Integer.toString(process.exitValue())); + } + return process.exitValue(); } - return process.exitValue(); - } else { + } finally { process.destroyForcibly(); - return -1; } + return -1; } protected static void compilePrinter() {