Added xml output for tests (#664)

Added test reporting information for jenkins
This commit is contained in:
AMZN-AlexOteiza
2021-05-11 12:44:27 +01:00
committed by GitHub
parent d49135659f
commit 591ad7f824
2 changed files with 38 additions and 10 deletions
+26 -4
View File
@@ -60,7 +60,7 @@ def palRm(path) {
} else {
def win_path = path.replace('/','\\')
bat label: "Removing ${win_path}",
script: "del ${win_path}"
script: "del /Q ${win_path}"
}
}
@@ -354,6 +354,16 @@ def TestMetrics(Map pipelineConfig, String workspace, String branchName, String
}
}
def ExportTestResults(Map options, String platform, String type, String workspace, Map params) {
catchError(message: "Error exporting tests results (this won't fail the build)", buildResult: 'SUCCESS', stageResult: 'FAILURE') {
def o3deroot = "${workspace}/${ENGINE_REPOSITORY_NAME}"
dir("${o3deroot}/${params.OUTPUT_DIRECTORY}") {
junit testResults: "Testing/**/*.xml"
palRmDir("Testing")
}
}
}
def PostBuildCommonSteps(String workspace, boolean mount = true) {
echo 'Starting post-build common steps...'
@@ -396,6 +406,14 @@ def CreateTestMetricsStage(Map pipelineConfig, String branchName, Map environmen
}
}
def CreateExportTestResultsStage(Map pipelineConfig, String platformName, String jobName, Map environmentVars, Map params) {
return {
stage("${jobName}_results") {
ExportTestResults(pipelineConfig, platformName, jobName, environmentVars['WORKSPACE'], params)
}
}
}
def CreateTeardownStage(Map environmentVars) {
return {
stage('Teardown') {
@@ -511,11 +529,15 @@ try {
}
}
finally {
if (env.MARS_REPO && platform.value.build_types[build_job_name].PARAMETERS.containsKey('TEST_METRICS') && platform.value.build_types[build_job_name].PARAMETERS.TEST_METRICS == 'True') {
def output_directory = platform.value.build_types[build_job_name].PARAMETERS.OUTPUT_DIRECTORY
def configuration = platform.value.build_types[build_job_name].PARAMETERS.CONFIGURATION
def params = platform.value.build_types[build_job_name].PARAMETERS
if (env.MARS_REPO && params && params.containsKey('TEST_METRICS') && params.TEST_METRICS == 'True') {
def output_directory = params.OUTPUT_DIRECTORY
def configuration = params.CONFIGURATION
CreateTestMetricsStage(pipelineConfig, branchName, envVars, build_job_name, output_directory, configuration).call()
}
if (params && params.containsKey('TEST_RESULTS') && params.TEST_RESULTS == 'True') {
CreateExportTestResultsStage(pipelineConfig, platform.key, build_job_name, envVars, params).call()
}
CreateTeardownStage(envVars).call()
}
}
@@ -106,7 +106,8 @@
"CMAKE_TARGET": "TEST_SUITE_smoke TEST_SUITE_main",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo",
"CTEST_OPTIONS": "-L \"(SUITE_smoke|SUITE_main)\" -LE \"(REQUIRES_gpu)\" -T Test",
"TEST_METRICS": "True"
"TEST_METRICS": "True",
"TEST_RESULTS": "True"
}
},
"profile_vs2019": {
@@ -154,7 +155,8 @@
"CMAKE_TARGET": "TEST_SUITE_smoke TEST_SUITE_main",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo",
"CTEST_OPTIONS": "-L \"(SUITE_smoke|SUITE_main)\" -LE \"(REQUIRES_gpu)\" -T Test",
"TEST_METRICS": "True"
"TEST_METRICS": "True",
"TEST_RESULTS": "True"
}
},
"test_gpu_profile_vs2019": {
@@ -174,7 +176,8 @@
"CMAKE_TARGET": "TEST_SUITE_smoke TEST_SUITE_main",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo",
"CTEST_OPTIONS": "-L \"(SUITE_smoke_REQUIRES_gpu|SUITE_main_REQUIRES_gpu)\" -T Test",
"TEST_METRICS": "True"
"TEST_METRICS": "True",
"TEST_RESULTS": "True"
}
},
"asset_profile_vs2019": {
@@ -211,7 +214,8 @@
"CMAKE_TARGET": "TEST_SUITE_periodic",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo",
"CTEST_OPTIONS": "-L \"(SUITE_periodic)\" -T Test",
"TEST_METRICS": "True"
"TEST_METRICS": "True",
"TEST_RESULTS": "True"
}
},
"sandbox_test_profile_vs2019": {
@@ -232,7 +236,8 @@
"CMAKE_TARGET": "TEST_SUITE_sandbox",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo",
"CTEST_OPTIONS": "-L \"(SUITE_sandbox)\" -T Test",
"TEST_METRICS": "True"
"TEST_METRICS": "True",
"TEST_RESULTS": "True"
}
},
"benchmark_test_profile_vs2019": {
@@ -250,7 +255,8 @@
"CMAKE_TARGET": "TEST_SUITE_benchmark",
"CMAKE_NATIVE_BUILD_ARGS": "/m /nologo",
"CTEST_OPTIONS": "-L \"(SUITE_benchmark)\" -T Test",
"TEST_METRICS": "True"
"TEST_METRICS": "True",
"TEST_RESULTS": "True"
}
},
"release_vs2019": {