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:
Peter Scheibel 2015-10-26 15:26:08 -07:00
parent 9576860f8c
commit 3b554c709b
3 changed files with 10 additions and 1 deletions

View file

@ -34,6 +34,7 @@
import spack
from spack.build_environment import InstallError
from spack.fetch_strategy import FetchError
import spack.cmd
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)
errOutput = "Skipped due to failed dependency: {0}".format(
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:
result = TestResult.FAILED
lines = getLogFunc(package.build_log_path)
@ -196,6 +200,8 @@ def test_install(parser, args):
fake=False)
except InstallError:
pass
except FetchError:
pass
jrf = JunitResultFormat()
handled = {}

View file

@ -261,7 +261,8 @@ def fetch(self):
tty.debug(e)
continue
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):

View file

@ -105,6 +105,8 @@ def test_dependency_already_installed(self):
self.assertEqual(mo.results, {bIdX:test_install.TestResult.PASSED})
#TODO: add test(s) where Y fails to install
class MockPackageDb(object):
def __init__(self, init=None):
self.specToPkg = {}