Fetch errors were also terminating runs of test-install with system exit, so
stage.fetch() was updated to raise a FetchError instead of calling tty.die(). Output is the same for spack install in case of a fetch error.
This commit is contained in:
parent
9576860f8c
commit
3b554c709b
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
import spack
|
import spack
|
||||||
from spack.build_environment import InstallError
|
from spack.build_environment import InstallError
|
||||||
|
from spack.fetch_strategy import FetchError
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
|
|
||||||
description = "Treat package installations as unit tests and output formatted test results"
|
description = "Treat package installations as unit tests and output formatted test results"
|
||||||
@ -132,6 +133,9 @@ def create_test_output(topSpec, newInstalls, output, getLogFunc=fetch_log):
|
|||||||
depBID = BuildId(dep)
|
depBID = BuildId(dep)
|
||||||
errOutput = "Skipped due to failed dependency: {0}".format(
|
errOutput = "Skipped due to failed dependency: {0}".format(
|
||||||
depBID.stringId())
|
depBID.stringId())
|
||||||
|
elif (not package.installed) and (not package.stage.archive_file):
|
||||||
|
result = TestResult.FAILED
|
||||||
|
errOutput = "Failure to fetch package resources."
|
||||||
elif not package.installed:
|
elif not package.installed:
|
||||||
result = TestResult.FAILED
|
result = TestResult.FAILED
|
||||||
lines = getLogFunc(package.build_log_path)
|
lines = getLogFunc(package.build_log_path)
|
||||||
@ -196,6 +200,8 @@ def test_install(parser, args):
|
|||||||
fake=False)
|
fake=False)
|
||||||
except InstallError:
|
except InstallError:
|
||||||
pass
|
pass
|
||||||
|
except FetchError:
|
||||||
|
pass
|
||||||
|
|
||||||
jrf = JunitResultFormat()
|
jrf = JunitResultFormat()
|
||||||
handled = {}
|
handled = {}
|
||||||
|
@ -261,7 +261,8 @@ def fetch(self):
|
|||||||
tty.debug(e)
|
tty.debug(e)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
tty.die("All fetchers failed for %s" % self.name)
|
errMessage = "All fetchers failed for %s" % self.name
|
||||||
|
raise fs.FetchError(errMessage, None)
|
||||||
|
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
|
@ -105,6 +105,8 @@ def test_dependency_already_installed(self):
|
|||||||
|
|
||||||
self.assertEqual(mo.results, {bIdX:test_install.TestResult.PASSED})
|
self.assertEqual(mo.results, {bIdX:test_install.TestResult.PASSED})
|
||||||
|
|
||||||
|
#TODO: add test(s) where Y fails to install
|
||||||
|
|
||||||
class MockPackageDb(object):
|
class MockPackageDb(object):
|
||||||
def __init__(self, init=None):
|
def __init__(self, init=None):
|
||||||
self.specToPkg = {}
|
self.specToPkg = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user