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

Certain test names or test fixture parameters causes the plugin to try to write to illegal file names

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: nunit-plugin
    • Labels:
      None
    • Environment:
      Master: Hudson ver. 1.346, NUnit plugin ver: 0.9
      Slave: Windows Vista SP2
    • Similar Issues:

      Description

      Given this test class definition:

      [TestFixture(typeof(UnicodeEncoding))]
      public class TestByteStringParser<T> where T : Encoding, new()
      {
         //...
      }
      

      you will get the following error:

      ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception
      hudson.util.IOException2: remote file operation failed: c:\build\workspace\dotnet-vizrt-win32 at hudson.remoting.Channel@1cd1d94:bgohudsontest
      	at hudson.FilePath.act(FilePath.java:690)
      	at hudson.FilePath.act(FilePath.java:676)
      	at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:102)
      	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
      	at hudson.model.Build$RunnerImpl.post2(Build.java:152)
      	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
      	at hudson.model.Run.run(Run.java:1221)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:122)
      Caused by: java.io.FileNotFoundException: c:\build\workspace\dotnet-vizrt-win32\temporary-junit-reports\TEST-Vizrt.Utilities.Tests.TestByteStringParser<UnicodeEncoding>.TestMultipleStringsInOneBlock.xml (The filename, directory name, or volume label syntax is incorrect)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(Unknown Source)
      	at java.io.FileOutputStream.<init>(Unknown Source)
      	at hudson.plugins.nunit.NUnitReportTransformer.splitJUnitFile(NUnitReportTransformer.java:105)
      	at hudson.plugins.nunit.NUnitReportTransformer.transform(NUnitReportTransformer.java:69)
      	at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:55)
      	at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:26)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1962)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:114)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:270)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at hudson.remoting.Engine$1$1.run(Engine.java:58)
      	at java.lang.Thread.run(Unknown Source)
      
      

      The part to note here is that it tries to write to the filename "TEST-Vizrt.Utilities.Tests.TestByteStringParser<UnicodeEncoding>.TestMultipleStringsInOneBlock.xml" which contains illegal characters.

      I did a little bit of digging and it seems like the characters come from NUnitReportTransformer.java line 104 which uses element.getAttribute("name") as a part of the filename without sanitizing any illegal characters.

        Attachments

          Activity

          Hide
          redsolo redsolo added a comment -

          It would be great if you could attach a file containing sample nunit xml that is written to an invalid filename so i quickly can fix up a test case for this issue.

          Show
          redsolo redsolo added a comment - It would be great if you could attach a file containing sample nunit xml that is written to an invalid filename so i quickly can fix up a test case for this issue.
          Hide
          dagvl dagvl added a comment -

          This test results file contains some offending test names. Maybe it's possible to just cut them out to cut down on the file size, but I'm not familiar enough with the format to do that right now.

          Show
          dagvl dagvl added a comment - This test results file contains some offending test names. Maybe it's possible to just cut them out to cut down on the file size, but I'm not familiar enough with the format to do that right now.
          Hide
          redsolo redsolo added a comment -

          Excellent, thanks!

          Show
          redsolo redsolo added a comment - Excellent, thanks!
          Hide
          emn13 emn13 added a comment -

          I have a very similar program.

          My nunit result xml file contains...

          <test-suite name="FlexEditTest" executed="True" success="True" time="0.586" asserts="0">
          <results>
          <test-suite name="FlexEditTest("volgonderwijs")" executed="True" success="True" time="0.443" asserts="0">
          <results>

          ...i.e., at least one test-suite which is marked up with an attribute:

          [TestFixture("volgonderwijs")]
          public class FlexEditTest ...

          Such a test fixture is displayed as FlexEditTest("volgonderwijs") in the nunit GUI runner and in the result xml.

          Show
          emn13 emn13 added a comment - I have a very similar program. My nunit result xml file contains... <test-suite name="FlexEditTest" executed="True" success="True" time="0.586" asserts="0"> <results> <test-suite name="FlexEditTest("volgonderwijs")" executed="True" success="True" time="0.443" asserts="0"> <results> ...i.e., at least one test-suite which is marked up with an attribute: [TestFixture("volgonderwijs")] public class FlexEditTest ... Such a test fixture is displayed as FlexEditTest("volgonderwijs") in the nunit GUI runner and in the result xml.
          Hide
          emn13 emn13 added a comment -

          Is there an ETA on a fix for this? It's currently blocking usage of hudson for me, which otherwise looks pretty neat!

          Show
          emn13 emn13 added a comment - Is there an ETA on a fix for this? It's currently blocking usage of hudson for me, which otherwise looks pretty neat!
          Hide
          emn13 emn13 added a comment -

          Incidentally, I'm unaware of any changes I made to the case - perhaps I misclicked on edit? In any case, changes (if any) weren't intentional.

          Show
          emn13 emn13 added a comment - Incidentally, I'm unaware of any changes I made to the case - perhaps I misclicked on edit? In any case, changes (if any) weren't intentional.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : redsolo
          Path:
          trunk/hudson/plugins/nunit/src/main/java/hudson/plugins/nunit/NUnitReportTransformer.java
          trunk/hudson/plugins/nunit/src/test/java/hudson/plugins/nunit/NUnitIntegrationTest.java
          trunk/hudson/plugins/nunit/src/test/java/hudson/plugins/nunit/NUnitReportTransformerTest.java
          trunk/hudson/plugins/nunit/src/test/resources/hudson/plugins/nunit/NUnitIntegrationTest/testIssue5673.zip
          trunk/hudson/plugins/nunit/src/test/resources/hudson/plugins/nunit/issue-5673.xml
          http://jenkins-ci.org/commit/28707
          Log:
          [FIXED JENKINS-5673] The files name that are derived from the test name is now stripped of illegal characters.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : redsolo Path: trunk/hudson/plugins/nunit/src/main/java/hudson/plugins/nunit/NUnitReportTransformer.java trunk/hudson/plugins/nunit/src/test/java/hudson/plugins/nunit/NUnitIntegrationTest.java trunk/hudson/plugins/nunit/src/test/java/hudson/plugins/nunit/NUnitReportTransformerTest.java trunk/hudson/plugins/nunit/src/test/resources/hudson/plugins/nunit/NUnitIntegrationTest/testIssue5673.zip trunk/hudson/plugins/nunit/src/test/resources/hudson/plugins/nunit/issue-5673.xml http://jenkins-ci.org/commit/28707 Log: [FIXED JENKINS-5673] The files name that are derived from the test name is now stripped of illegal characters.
          Hide
          redsolo redsolo added a comment -

          This should be fixed right now, if you want to try it out now you can get the snapshot at http://hudson.ramfelt.se/job/Hudson%20plugin%20NUnit/org.jvnet.hudson.plugins$nunit/

          (Ignore the failed test, i have no idea why its happening on the server)

          Show
          redsolo redsolo added a comment - This should be fixed right now, if you want to try it out now you can get the snapshot at http://hudson.ramfelt.se/job/Hudson%20plugin%20NUnit/org.jvnet.hudson.plugins$nunit/ (Ignore the failed test, i have no idea why its happening on the server)

            People

            • Assignee:
              redsolo redsolo
              Reporter:
              dagvl dagvl
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: