Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-19877

xUnit does not support symbolic link for input files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      plugin version: 1.48
      Jenkins v1.487
      Windows 2008 R2
    • Similar Issues:

      Description

      Recently, we switched our build system to use symbolic links instead of copying files around and turns out that the xUnit plugin does not work with them. The file is found, but plugin thinks that the file is empty.

      14:02:31 [xUnit] [INFO] - [CppUnit-1.12.1 (default)] - 1 test report file(s) were found with the pattern '*/exports/unittest//UnitTestResults.xml' relative to 'e:\sandbox\Runtime_trunk' for the testing framework 'CppUnit-1.12.1 (default)'.
      14:02:31 [xUnit] [ERROR] - The result file 'e:\sandbox\Runtime_trunk\outputs\exports\unittest\win32\UnitTestResults.xml' for the metric 'CppUnit' is empty. The result file has been skipped.

      I've looked into the code that causes failure; a call to:

      public boolean checkFileIsNotEmpty(File inputFile)

      { return inputFile.length() != 0; }

      The native symbolic links support was added to Java 7. I'm not sure if simply rebuilding plugin with JDK 7 will return non zero file size for symbolic links (Windows itself shows file size as zero) or is that even feasible as it forces Java 7. Or maybe the code needs to check first if the file is symbolic link and treat it differently.

      I guess another possible solution (assuming that we can read the file content in using old file class) would be to load the file content and check if that is non zero.

        Attachments

          Activity

          Hide
          msiemczyk Maciek Siemczyk added a comment - - edited

          I ended up disabling the two unit tests that are using Java 7 API.

          https://github.com/msiemczyk/xunit-plugin/commit/2f32af622600f39ddb59bdf317526c0afd7e6756

          Show
          msiemczyk Maciek Siemczyk added a comment - - edited I ended up disabling the two unit tests that are using Java 7 API. https://github.com/msiemczyk/xunit-plugin/commit/2f32af622600f39ddb59bdf317526c0afd7e6756
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: msiemczyk
          Path:
          .gitignore
          src/main/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationService.java
          src/test/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationServiceTest.java
          http://jenkins-ci.org/commit/xunit-plugin/1b606180e27a8a1c237263f5667bc0c74adf6f7b
          Log:
          Fix JENKINS-19877

          • Modified checkFileIsNotEmpty() method to use canonical file, which
            will resolve symbolic links, when possible.
          • Added 4 new unit tests to exercise the modified method. Two of the new
            unit tests are using new Java 7 IO API and JDK 7 or newer is required to
            compile them.
          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: msiemczyk Path: .gitignore src/main/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationService.java src/test/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationServiceTest.java http://jenkins-ci.org/commit/xunit-plugin/1b606180e27a8a1c237263f5667bc0c74adf6f7b Log: Fix JENKINS-19877 Modified checkFileIsNotEmpty() method to use canonical file, which will resolve symbolic links, when possible. Added 4 new unit tests to exercise the modified method. Two of the new unit tests are using new Java 7 IO API and JDK 7 or newer is required to compile them.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: msiemczyk
          Path:
          src/test/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationServiceTest.java
          http://jenkins-ci.org/commit/xunit-plugin/2f32af622600f39ddb59bdf317526c0afd7e6756
          Log:
          FIX JENKINS-19877

          Disabled two of the unit tests that are using Java 7 API.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: msiemczyk Path: src/test/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationServiceTest.java http://jenkins-ci.org/commit/xunit-plugin/2f32af622600f39ddb59bdf317526c0afd7e6756 Log: FIX JENKINS-19877 Disabled two of the unit tests that are using Java 7 API.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          .gitignore
          src/main/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationService.java
          src/test/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationServiceTest.java
          http://jenkins-ci.org/commit/xunit-plugin/cd5dc2cc72ebb48a0a0278f82d9c11629e348f7c
          Log:
          Merge pull request #6 from msiemczyk/master

          Fix JENKINS-19877

          Compare: https://github.com/jenkinsci/xunit-plugin/compare/a54ae9f0e51c...cd5dc2cc72eb

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: .gitignore src/main/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationService.java src/test/java/com/thalesgroup/hudson/plugins/xunit/service/XUnitValidationServiceTest.java http://jenkins-ci.org/commit/xunit-plugin/cd5dc2cc72ebb48a0a0278f82d9c11629e348f7c Log: Merge pull request #6 from msiemczyk/master Fix JENKINS-19877 Compare: https://github.com/jenkinsci/xunit-plugin/compare/a54ae9f0e51c...cd5dc2cc72eb
          Hide
          msiemczyk Maciek Siemczyk added a comment -

          Hi Gregory,

          We have installed 1.63 plugin on our main master and everything works great. Thanks for your help.

          Regards,
          Maciek

          Show
          msiemczyk Maciek Siemczyk added a comment - Hi Gregory, We have installed 1.63 plugin on our main master and everything works great. Thanks for your help. Regards, Maciek

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              msiemczyk Maciek Siemczyk
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: