Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8158066: SourceDebugExtensionTest fails to rename file #227

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/InstallSDE.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
Expand Down Expand Up @@ -58,12 +58,18 @@ public static void install(byte[] aOrig, byte[] aSdeAttr, File outClassFile, boo
}

public static void install(File inOutClassFile, File attrFile, boolean verbose) throws IOException {
File tmpFile = new File(inOutClassFile.getPath() + "tmp");
File tmpFile = new File(inOutClassFile.getPath() + "tmp-out");
File tmpInOutClassFile = new File(inOutClassFile.getPath() + "tmp-in");

new InstallSDE(inOutClassFile, attrFile, tmpFile, verbose);
// Workaround delayed file deletes on Windows using a tmp file name
if (!inOutClassFile.renameTo(tmpInOutClassFile)) {
throw new IOException("inOutClassFile.renameTo(tmpInOutClassFile) failed");
}

new InstallSDE(tmpInOutClassFile, attrFile, tmpFile, verbose);

if (!inOutClassFile.delete()) {
throw new IOException("inOutClassFile.delete() failed");
if (!tmpInOutClassFile.delete()) {
throw new IOException("tmpInOutClassFile.delete() failed");
}
if (!tmpFile.renameTo(inOutClassFile)) {
throw new IOException("tmpFile.renameTo(inOutClassFile) failed");
Expand Down
2 changes: 0 additions & 2 deletions test/jdk/ProblemList.txt
Expand Up @@ -870,8 +870,6 @@ com/sun/jdi/BasicJDWPConnectionTest.java 8195703 generic-

com/sun/jdi/RepStep.java 8043571 generic-all

com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows-all

com/sun/jdi/NashornPopFrameTest.java 8187143 generic-all

############################################################################
Expand Down
16 changes: 12 additions & 4 deletions test/jdk/com/sun/jdi/sde/InstallSDE.java
Expand Up @@ -31,10 +31,18 @@ static void install(File inClassFile, File attrFile, File outClassFile)
}

static void install(File inOutClassFile, File attrFile) throws IOException {
File tmpFile = new File(inOutClassFile.getPath() + "tmp");
new InstallSDE(inOutClassFile, attrFile, tmpFile);
if (!inOutClassFile.delete()) {
throw new IOException("inOutClassFile.delete() failed");
File tmpFile = new File(inOutClassFile.getPath() + "tmp-out");
File tmpInOutClassFile = new File(inOutClassFile.getPath() + "tmp-in");

// Workaround delayed file deletes on Windows using a tmp file name
if (!inOutClassFile.renameTo(tmpInOutClassFile)) {
throw new IOException("tmp copy of inOutClassFile failed");
}

new InstallSDE(tmpInOutClassFile, attrFile, tmpFile);

if (!tmpInOutClassFile.delete()) {
throw new IOException("tmpInOutClassFile.delete() failed");
}
if (!tmpFile.renameTo(inOutClassFile)) {
throw new IOException("tmpFile.renameTo(inOutClassFile) failed");
Expand Down