History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CC-515
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Andy O
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
CruiseControl

cvstimestamp property makes a junit task with <syspropertyset> fail

Created: 23/Aug/06 04:17 PM   Updated: 09/Feb/07 09:47 PM
Component/s: Core Application
Affects Version/s: 2.5
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Windows Server 2003, JDK 1.5, VMWare virtual machine


 Description  « Hide
We have a build that executes a JUnit task as such:
    <junit
      reloading="true"
      printsummary="yes"
      haltonfailure="no"
      showoutput="yes">
      <jvmarg value="-Djava.util.logging.config.file=${junit.logging.properties}"/>
      <jvmarg value="-Demma.coverage.out.file=${tmp}/coverage.emma"/>
      <jvmarg value="-Demma.coverage.out.merge=true"/>
      <syspropertyset>
        <propertyref builtin="all"/>
      </syspropertyset>
      <classpath>
        <path refid="junit.run.classpath"/>
      </classpath>
      <formatter type="xml"/>
      <batchtest fork="yes" todir="${tmp}">
        <fileset dir="${src.test}">
          <include name="**/Test*.java"/>
          <include name="**/*Test.java"/>
        </fileset>
      </batchtest>
    </junit>

Everything runs fine outside of CruiseControl. However, when we run inside of CruiseControl, all of our JUnits fail, in fact, the JVM never starts the JUnit runner because of NoClassDefFound error "<some time>" If we remove the <syspropertyset> (which we really do need) then the tests run fine. It is the combination of <syspropertyset> and running in CruiseControl.

We've investigated this further and found that the culprit is cvstimestamp which gets passed in as "-Dcvstimestamp=some time with spaces" Important to note is that it does have the quotes around it because the CommandLine class looks for arguments with spaces in them an quotes the whole arguement (which seems wrong...shouldn't it be -Dname="parameter with spaces" or something?). If we remove cvstimestamp from the build properties in Project.java and try it, our build works flawlessly.

This issue actually doesn't occur on people running CruiseControl on a Unix box.

We think either 1 of 2 solutions would be nice.
1) The simplest solution right now seems to make cvstimestamp an optional parameter that gets passed in. It is Source Control System specific. We use SVN and have no use for this property.
2) Fix the way properties with spaces get passed into Ant Scripts.

Thanks
Andy O

 All   Comments   Work Log   Change History      Sort Order:
Jeffrey Fredrick [26/Aug/06 04:41 PM]
it isn't obvious to me that we're not already passing in the parameters correctly. I believe we need to quote the entire parameter so that the shell will parse it properly, and instead, from the description, it sounds like a bug in Ant where Ant's jUnit task isn't properly quoting the properties when it forks.

still, if somone can submit an alternative quoting strategy that solve the problem I'd be happy to commit it.

Jarkko Viinamäki [07/Oct/06 02:58 AM]
I quickly took a look a this issue. The problem is that builders/AntScript.java, builders/MavenScript.java, builders/Maven2Script.java etc. get a mapping with values which have spaces (e.g. that cvstimestamp).

E.g. AntScript.java has this line:
cmdLine.createArgument().setValue("-D" + property.getKey() + "=" + value);

Which means that the shell command is constructed with spaces and thus it breaks behaviour in Ant, Maven etc. Although I haven't tried it, I believe that this can be fixed by just adding quotes around the value parameter. E.g.

cmdLine.createArgument().setValue("-D" + property.getKey() + "=\"" + value + "\"");

This fix must be applied to all *Script.java files under builders-directory. At least on Windows platform Ant happily parses parameters passed as -Dfoo="this is the value" and does not include quotes in the actual value.

Jason Yip [10/Nov/06 10:31 PM]
Will need to check this on Linux as well.

Jeffrey Fredrick [11/Nov/06 07:23 AM]
I think we already have platform specfic quoting -- perhaps we just need to take that further?