aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2020-04-28 16:13:13 -0400
committerGitHub <noreply@github.com>2020-04-28 16:13:13 -0400
commit6cc450d8ff714af09374f9bc07aea8bb05f74a5c (patch)
tree1a211fa22e3e68b7cec8af53395637bebcb1f105
parentbdd8485de4cde8dba67b27146feda5fd821cd7ef (diff)
parent0f4aa4d47e7bf98c10d461639782a2361becb8c0 (diff)
downloadspmc-6cc450d8ff714af09374f9bc07aea8bb05f74a5c.tar.gz
Merge pull request #32 from jhunkeler/circle-tests
Try to store ctest results
-rw-r--r--.circleci/config.yml8
-rw-r--r--.circleci/ctest-to-junit.xsl134
-rwxr-xr-x.circleci/init.sh3
-rwxr-xr-x.circleci/test_spm.sh7
4 files changed, 150 insertions, 2 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 54b5d9e..258d452 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -6,6 +6,7 @@ jobs:
- image: centos:7
environment:
+ TEST_RESULTS: /tmp/test-results
MALLOC_CHECK_: 1
working_directory: ~/build
@@ -39,6 +40,9 @@ jobs:
command: |
.circleci/test_spm.sh
+ - store_test_results:
+ path: /tmp/test-results
+
build-macos:
macos:
xcode: 11.4.0
@@ -46,6 +50,7 @@ jobs:
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
DYLD_INSERT_LIBRARIES: /usr/lib/libgmalloc.dylib
+ TEST_RESULTS: /tmp/test-results
steps:
- checkout
@@ -70,6 +75,9 @@ jobs:
command: |
.circleci/test_spm.sh
+ - store_test_results:
+ path: /tmp/test-results
+
workflows:
version: 2
build-and-test:
diff --git a/.circleci/ctest-to-junit.xsl b/.circleci/ctest-to-junit.xsl
new file mode 100644
index 0000000..75a5f78
--- /dev/null
+++ b/.circleci/ctest-to-junit.xsl
@@ -0,0 +1,134 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:param name="pass" select="'this'"/>
+<xsl:output method="xml" indent="yes"/>
+<!-- convert ctest output to junit format -->
+<!--
+Inspired by https://stackoverflow.com/questions/6329215/how-to-get-ctest-results-in-hudson-jenkins
+Based on https://github.com/zanata/zanata-tests/blob/master/scripts/CTest2JUnit.xsl
+Extended by providing total Start date, total time, total test stats
+-->
+ <xsl:template match="/Site">
+ <xsl:variable name="StartDate"><xsl:value-of select="Testing/StartDateTime"/></xsl:variable>
+ <xsl:variable name="DoTime"><xsl:value-of select="Testing/EndTestTime - Testing/StartTestTime"/></xsl:variable>
+ <xsl:variable name="TotalTests"><xsl:value-of select="count(Testing/Test)"/></xsl:variable>
+ <xsl:variable name="Skipped"><xsl:value-of select="count(Testing/Test[@Status='notrun'])"/></xsl:variable>
+ <xsl:variable name="Disabled"><xsl:value-of select="count(Testing/Test/Results/Measurement[Value='Disabled'])"/></xsl:variable>
+ <xsl:variable name="Failed"><xsl:value-of select="count(Testing/Test[@Status='failed'])"/></xsl:variable>
+
+ <testsuite time="{$DoTime}" timestamp="{$StartDate}" tests="{$TotalTests}" failures="{$Failed}" skipped="{$Skipped}" disabled="{$Disabled}">
+
+ <xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
+ <xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
+ <xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
+ <xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
+ <xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
+ <xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
+ <xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
+ <xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
+ <xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
+ <xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
+ <xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
+ <xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
+ <xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
+ <xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
+ <xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
+ <xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
+ <xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
+ <xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
+ <xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
+ <xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
+ <xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
+ <xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
+ <properties>
+ <property name="BuildName" value="{$BuildName} {$DoTime}" />
+ <property name="BuildStamp" value="{$BuildStamp}" />
+ <property name="Name" value="{$Name}" />
+ <property name="Generator" value="{$Generator}" />
+ <property name="CompilerName" value="{$CompilerName}" />
+ <property name="OSName" value="{$OSName}" />
+ <property name="Hostname" value="{$Hostname}" />
+ <property name="OSRelease" value="{$OSRelease}" />
+ <property name="OSVersion" value="{$OSVersion}" />
+ <property name="OSPlatform" value="{$OSPlatform}" />
+ <property name="Is64Bits" value="{$Is64Bits}" />
+ <property name="VendorString" value="{$VendorString}" />
+ <property name="VendorID" value="{$VendorID}" />
+ <property name="FamilyID" value="{$FamilyID}" />
+ <property name="ModelID" value="{$ModelID}" />
+ <property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
+ <property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
+ <property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
+ <property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
+ <property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
+ <property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
+ <property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
+ </properties>
+ <xsl:apply-templates select="Testing/Test"/>
+
+ <system-out>
+ BuildName: <xsl:value-of select="$BuildName" />
+ BuildStamp: <xsl:value-of select="$BuildStamp" />
+ Name: <xsl:value-of select="$Name" />
+ Generator: <xsl:value-of select="$Generator" />
+ CompilerName: <xsl:value-of select="$CompilerName" />
+ OSName: <xsl:value-of select="$OSName" />
+ Hostname: <xsl:value-of select="$Hostname" />
+ OSRelease: <xsl:value-of select="$OSRelease" />
+ OSVersion: <xsl:value-of select="$OSVersion" />
+ OSPlatform: <xsl:value-of select="$OSPlatform" />
+ Is64Bits: <xsl:value-of select="$Is64Bits" />
+ VendorString: <xsl:value-of select="$VendorString" />
+ VendorID: <xsl:value-of select="$VendorID" />
+ FamilyID: <xsl:value-of select="$FamilyID" />
+ ModelID: <xsl:value-of select="$ModelID" />
+ ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
+ NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
+ NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
+ TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
+ TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
+ LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
+ ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
+ </system-out>
+ </testsuite>
+ </xsl:template>
+
+ <xsl:template match="Testing/Test">
+ <xsl:variable name="testcasename"><xsl:value-of select="Name"/></xsl:variable>
+ <xsl:variable name="testclassname"><xsl:value-of select="concat($pass, substring(Path,2))"/></xsl:variable>
+ <xsl:variable name="exectime">
+ <xsl:for-each select="Results/NamedMeasurement">
+ <xsl:if test="@name='Execution Time'">
+ <xsl:value-of select="Value"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
+ <xsl:if test="@Status = 'passed'">
+ <system-out><xsl:value-of select="Results/Measurement/Value/text()"/></system-out>
+ </xsl:if>
+ <xsl:if test="@Status = 'failed'">
+ <xsl:variable name="failtype">
+ <xsl:for-each select="Results/NamedMeasurement">
+ <xsl:if test="@name = 'Exit Code'">
+ <xsl:value-of select="Value"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="failcode">
+ <xsl:for-each select="Results/NamedMeasurement">
+ <xsl:if test="@name = 'Exit Value'">
+ <xsl:value-of select="Value"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <failure message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></failure>
+ </xsl:if>
+ <xsl:if test="@Status = 'notrun'">
+ <skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
+ </xsl:if>
+ </testcase>
+ </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/.circleci/init.sh b/.circleci/init.sh
index 877b9de..24b2f81 100755
--- a/.circleci/init.sh
+++ b/.circleci/init.sh
@@ -14,7 +14,8 @@ if [[ $(uname -s) == Linux ]]; then
gcc \
gcc-c++ \
gcc-gfortran \
- glibc-devel
+ glibc-devel \
+ libxslt
ln -s cmake3 /usr/bin/cmake
ln -s ctest3 /usr/bin/ctest
diff --git a/.circleci/test_spm.sh b/.circleci/test_spm.sh
index eb141e5..104e8fb 100755
--- a/.circleci/test_spm.sh
+++ b/.circleci/test_spm.sh
@@ -1,13 +1,18 @@
#!/bin/bash -e
source $(dirname "${BASH_SOURCE[0]}")/runtime.sh
+export TEST_RESULTS=${TEST_RESULTS:-/tmp/test-results}
export PREFIX=/tmp/root
export SHELL=/bin/bash
+mkdir -p "${TEST_RESULTS}"/spm
cd build
set -x
-ctest -V
+ctest -T test
+xsltproc \
+ ../.circleci/ctest-to-junit.xsl \
+ Testing/$(head -n 1 < Testing/TAG)/Test.xml > "${TEST_RESULTS}"/spm/Test.xml
spm --list