Skip to content

Commit

Permalink
Showing 6 changed files with 1,079 additions and 22 deletions.
10 changes: 5 additions & 5 deletions spec/truffle/buildTestReports.xml
Original file line number Diff line number Diff line change
@@ -5,20 +5,20 @@
~
~ Run from JRuby root directory as: ant -buildfile spec/truffle/buildTestReports.xml
-->
<project name="genTestReport" default="gen" basedir="../../">
<project name="genTestReport" default="gen" basedir="../../test">
<description>
Generate an HTML report from jUnit XML files.
</description>

<target name="gen">
<property name="genReportDir" location="tmp/unitTestReports"/>
<property name="genReportDir" location="target/mspec-html-report"/>
<delete dir="${genReportDir}"/>
<mkdir dir="${genReportDir}"/>
<junitreport todir="tmp/unitTestReports">
<fileset dir="tmp">
<junitreport todir="${genReportDir}">
<fileset dir="target/mspec-results">
<include name="**/TEST-*.xml"/>
</fileset>
<report format="frames" todir="${genReportDir}/html"/>
<report format="frames" styledir="${basedir}/../spec/truffle" todir="${genReportDir}/html"/>
</junitreport>
</target>
</project>
981 changes: 981 additions & 0 deletions spec/truffle/junit-frames.xsl

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions spec/truffle/truffle_formatter.rb
Original file line number Diff line number Diff line change
@@ -19,24 +19,27 @@ def register

def start
# TODO (nirvdrum 23-Feb-15) Remove this hack when Truffle supports deleting directories with files and can do so synchronously.
system("rm -r tmp/*")
system("rm -r #{File.join(result_dir_base, '*')}")
sleep(1)
end

def load
parts = MSpec.retrieve(:file).sub(Dir.pwd + '/', '').split('/')

@spec_type = parts[0...2].join('.')
@classname = parts[2...-1].join('_')
@spec_type = parts[0...3].join('.')
@class_name = parts[3...-1].join('_')

@class_name = 'Ruby' if @class_name.empty?

@filename_base = parts[-1].split('.rb').first.split('_spec').first

@tests.clear
@file_time = current_time

(@local_tally = TallyAction.new).register

@testsuite_name = [@spec_type, @classname, @filename_base].compact.join('.')
@dir = File.join('tmp', @spec_type, @classname)
@testsuite_name = [@spec_type, @class_name, @filename_base].compact.join('.')
@dir = File.join(result_dir_base, @spec_type, @class_name)

mkdir_p(@dir)

@@ -70,30 +73,21 @@ def unload
failures = @local_tally.counter.failures
tagged = @local_tally.counter.tagged

skipped_stats = if tagged > 0
# TODO (nirvdrum 23-Feb-15) Clean this up when Truffle supports Float#round(int)
skipped_percentage = ((tagged / tests.to_f) * 1000).round / 10.0
"#{skipped_percentage}% Skipped"
else
''
end

@file.puts <<-XML
<testsuite
tests="#{tests}"
errors="#{errors}"
failures="#{failures}"
skipped="#{tagged}"
time="#{current_time - @file_time}"
hostname="#{skipped_stats}"
name="#{@testsuite_name}">
XML

@tests.each do |h|
description = encode_for_xml h[:test].description

@file.puts <<-XML
<testcase classname="#{@classname}" name="#{description}" time="#{h[:time]}">
<testcase classname="#{@class_name}" name="#{description}" time="#{h[:time]}">
XML

if h[:exception]
@@ -169,6 +163,10 @@ def current_time
end
end

def result_dir_base
File.join('test', 'target', 'mspec-results')
end

def mkdir_p(dir)
sub_path = Dir.pwd
parts = dir.split('/')
21 changes: 21 additions & 0 deletions test/pom.rb
Original file line number Diff line number Diff line change
@@ -251,32 +251,53 @@ def truffle_spec_config(spec_type, generate_report)
profile 'truffle-specs-language-report' do

plugin :antrun do
dependency 'org.apache.ant', 'ant-junit', '${ant.version}'

execute_goals( 'run',
:id => 'rake',
:phase => 'test',
:configuration => [ xml( truffle_spec_config(:language, true) ) ] )

execute_goals( 'run',
:id => 'junit-report-generation',
:phase => 'test',
:configuration => [ xml( '<target><ant antfile="${basedir}/../spec/truffle/buildTestReports.xml" /></target>' ) ] )
end

end

profile 'truffle-specs-core-report' do

plugin :antrun do
dependency 'org.apache.ant', 'ant-junit', '${ant.version}'

execute_goals( 'run',
:id => 'rake',
:phase => 'test',
:configuration => [ xml( truffle_spec_config(:core, true) ) ] )

execute_goals( 'run',
:id => 'junit-report-generation',
:phase => 'test',
:configuration => [ xml( '<target><ant antfile="${basedir}/../spec/truffle/buildTestReports.xml" /></target>' ) ] )
end

end

profile 'truffle-specs-rubysl-report' do

plugin :antrun do
dependency 'org.apache.ant', 'ant-junit', '${ant.version}'

execute_goals( 'run',
:id => 'rake',
:phase => 'test',
:configuration => [ xml( truffle_spec_config(:rubysl, true) ) ] )

execute_goals( 'run',
:id => 'junit-report-generation',
:phase => 'test',
:configuration => [ xml( '<target><ant antfile="${basedir}/../spec/truffle/buildTestReports.xml" /></target>' ) ] )
end

end
57 changes: 57 additions & 0 deletions test/pom.xml
Original file line number Diff line number Diff line change
@@ -835,7 +835,26 @@
</target>
</configuration>
</execution>
<execution>
<id>junit-report-generation</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${basedir}/../spec/truffle/buildTestReports.xml" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>${ant.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
@@ -882,7 +901,26 @@
</target>
</configuration>
</execution>
<execution>
<id>junit-report-generation</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${basedir}/../spec/truffle/buildTestReports.xml" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>${ant.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
@@ -929,7 +967,26 @@
</target>
</configuration>
</execution>
<execution>
<id>junit-report-generation</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${basedir}/../spec/truffle/buildTestReports.xml" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>${ant.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Original file line number Diff line number Diff line change
@@ -1479,7 +1479,7 @@ public SizeNode(SizeNode prev) {

@Specialization
public int size(RubyString string) {
return string.length();
return StringSupport.strLengthFromRubyString(string);
}
}

@@ -1713,7 +1713,7 @@ public ToSymNode(ToSymNode prev) {
public RubySymbol toSym(RubyString string) {
notDesignedForCompilation();

return getContext().newSymbol(string.toString());
return getContext().newSymbol(string.getByteList());
}
}

0 comments on commit c149655

Please sign in to comment.