Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8221596

test/hotspot/jtreg/runtime/containers/docker/TestCPUSets.java failed with FileAlreadyExistsException

XMLWordPrintable

    • b15
    • x86
    • linux

      ## Symptom
      ---------------------------------------------------
      STDERR:
      java.nio.file.FileAlreadyExistsException: /home/fool/fujie/workspace/jdk/JTwork/classes/runtime/containers/docker/TestCPUSets.d/whitebox.jar
              at java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:573)
              at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:258)
              at java.base/java.nio.file.Files.copy(Files.java:1297)
              at jdk.test.lib.containers.docker.Common.prepareWhiteBox(Common.java:48)
              at TestCPUSets.main(TestCPUSets.java:57)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:567)
              at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
              at java.base/java.lang.Thread.run(Thread.java:835)

      JavaTest Message: Test threw exception: java.nio.file.FileAlreadyExistsException: /home/fool/fujie/workspace/jdk/JTwork/classes/runtime/containers/docker/TestCPUSets.d/whitebox.jar
      JavaTest Message: shutting down test

      STATUS:Failed.`main' threw exception: java.nio.file.FileAlreadyExistsException: /home/fool/fujie/workspace/jdk/JTwork/classes/runtime/containers/docker/TestCPUSets.d/whitebox.jar
      ---------------------------------------------------

      ## Reproduce
      ---------------------------------------------------
      #!/bin/bash

      JTREG=/home/fool/fujie/workspace/jtreg/build/images/jtreg
      TESTJDK=/home/fool/jdk/build/linux-x86_64-server-release/images/jdk
      DOCKER_ARGS="-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"

      rm JTreport JTwork -rf

      for i in {1..2}; do

        echo -e "\nRun ${i} ...\n"

        ${JTREG}/bin/jtreg \
          -jdk:${TESTJDK} \
          ${DOCKER_ARGS} \
          test/hotspot/jtreg/runtime/containers/docker/TestCPUSets.java

      done
      ---------------------------------------------------

      ## Fix
      ---------------------------------------------------
      diff -r 55025f677f68 test/lib/jdk/test/lib/containers/docker/Common.java
      --- a/test/lib/jdk/test/lib/containers/docker/Common.java Thu Mar 28 04:30:52 2019 +0000
      +++ b/test/lib/jdk/test/lib/containers/docker/Common.java Thu Mar 28 14:00:09 2019 +0800
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2017, 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
      @@ -30,6 +30,7 @@
       import java.io.File;
       import java.nio.file.Files;
       import java.nio.file.Paths;
      +import java.nio.file.StandardCopyOption;
       import jdk.test.lib.containers.docker.DockerRunOptions;
       import jdk.test.lib.containers.docker.DockerTestUtils;
       import jdk.test.lib.Utils;
      @@ -46,7 +47,7 @@
       
           public static void prepareWhiteBox() throws Exception {
               Files.copy(Paths.get(new File("whitebox.jar").getAbsolutePath()),
      - Paths.get(Utils.TEST_CLASSES, "whitebox.jar"));
      + Paths.get(Utils.TEST_CLASSES, "whitebox.jar"), StandardCopyOption.REPLACE_EXISTING);
           }
       
       
      ---------------------------------------------------

            jiefu Jie Fu
            jiefu Jie Fu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: