From 692726dee0001441b7616e7cfd22e081b708f6b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Wed, 28 Feb 2024 12:59:12 +0100
Subject: [PATCH] feat(BSS-2): fail build_test if fails are found
---
packages/hxtorch/package.py | 15 ++++++++++++++-
packages/pynn-brainscales/package.py | 15 ++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index eac2bab6d..19253f690 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -4,6 +4,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import unittest.mock
+import sys
+import xml.etree.ElementTree as ET
from spack import *
from spack.util.environment import EnvironmentModifications
@@ -171,7 +173,18 @@ class Hxtorch(WafPackage):
def build_test(self):
self.builder.waf('build', '--test-execall')
- copy_tree('build/test_results', join_path(self.prefix, '.build'))
+ copy_tree('build/test_results', join_path(self.prefix, ".build"))
+ copy_tree('build/test_results', join_path(self.stage.path, ".install_time_tests"))
+ # propagate failures from junit output to spack
+ tree = ET.parse('build/test_results/summary.xml')
+ for testsuite in tree.getroot():
+ for testcase in testsuite:
+ for elem in testcase:
+ if (elem.tag == 'failure') and not (
+ elem.get('message').startswith("pylint:") or
+ elem.get('message').startswith("pycodestyle:") or
+ ("OK" in elem.get('message') and "Segmentation fault" in elem.get('message'))):
+ raise RuntimeError("Failed test found: {}".format(testcase.get('name')))
def install_args(self):
args = ['--test-execnone']
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index df45a081f..e548bb8a3 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -4,6 +4,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import unittest.mock
+import sys
+import xml.etree.ElementTree as ET
from spack import *
from spack.util.environment import EnvironmentModifications
@@ -170,7 +172,18 @@ class PynnBrainscales(WafPackage):
def build_test(self):
self.builder.waf('build', '--test-execall')
- copy_tree('build/test_results', join_path(self.prefix, '.build'))
+ copy_tree('build/test_results', join_path(self.prefix, ".build"))
+ copy_tree('build/test_results', join_path(self.stage.path, ".install_time_tests"))
+ # propagate failures from junit output to spack
+ tree = ET.parse('build/test_results/summary.xml')
+ for testsuite in tree.getroot():
+ for testcase in testsuite:
+ for elem in testcase:
+ if (elem.tag == 'failure') and not (
+ elem.get('message').startswith("pylint:") or
+ elem.get('message').startswith("pycodestyle:") or
+ ("OK" in elem.get('message') and "Segmentation fault" in elem.get('message'))):
+ raise RuntimeError("Failed test found: {}".format(testcase.get('name')))
def install_args(self):
args = ['--test-execnone']
--
GitLab