2015-02-09 03:26:57 +01:00
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2015 Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
|
|
|
#
|
2017-10-12 00:11:50 +02:00
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
2015-02-09 03:26:57 +01:00
|
|
|
#
|
2017-10-12 00:11:50 +02:00
|
|
|
# This library is distributed in the hope that it will be useful,
|
2015-02-09 03:26:57 +01:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2017-10-12 00:11:50 +02:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
2015-02-09 03:26:57 +01:00
|
|
|
#
|
2017-10-12 00:11:50 +02:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, see <https://www.gnu.org/licenses/>.
|
2015-02-09 03:26:57 +01:00
|
|
|
# USA.
|
|
|
|
#
|
2017-01-18 22:16:46 +01:00
|
|
|
|
2015-02-09 03:26:57 +01:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import subprocess
|
|
|
|
import tempfile
|
|
|
|
import unittest
|
|
|
|
|
2017-09-28 02:55:24 +02:00
|
|
|
import asyncio
|
|
|
|
|
2016-02-11 01:35:51 +01:00
|
|
|
import qubes
|
2017-08-28 14:28:17 +02:00
|
|
|
import qubes.tests
|
2015-02-11 14:26:29 +01:00
|
|
|
|
2015-02-09 03:26:57 +01:00
|
|
|
VM_PREFIX = "test-"
|
|
|
|
|
|
|
|
@unittest.skipUnless(os.path.exists('/usr/bin/rpmsign') and
|
|
|
|
os.path.exists('/usr/bin/rpmbuild'),
|
2015-03-24 01:48:25 +01:00
|
|
|
'rpm-sign and/or rpm-build not installed')
|
2017-07-12 19:01:15 +02:00
|
|
|
class TC_00_Dom0UpgradeMixin(object):
|
2015-10-30 14:58:23 +01:00
|
|
|
"""
|
|
|
|
Tests for downloading dom0 updates using VMs based on different templates
|
|
|
|
"""
|
2015-02-09 03:26:57 +01:00
|
|
|
pkg_name = 'qubes-test-pkg'
|
2016-06-02 02:49:42 +02:00
|
|
|
dom0_update_common_opts = ['--disablerepo=*', '--enablerepo=test']
|
2016-02-03 17:22:15 +01:00
|
|
|
update_flag_path = '/var/lib/qubes/updates/dom0-updates-available'
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def generate_key(cls, keydir):
|
|
|
|
gpg_opts = ['gpg', '--quiet', '--no-default-keyring',
|
|
|
|
'--homedir', keydir]
|
|
|
|
p = subprocess.Popen(gpg_opts + ['--gen-key', '--batch'],
|
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
stderr=open(os.devnull, 'w'))
|
|
|
|
p.stdin.write('''
|
|
|
|
Key-Type: RSA
|
|
|
|
Key-Length: 1024
|
|
|
|
Key-Usage: sign
|
|
|
|
Name-Real: Qubes test
|
|
|
|
Expire-Date: 0
|
|
|
|
%commit
|
2017-02-19 00:07:16 +01:00
|
|
|
'''.format(keydir=keydir).encode())
|
2015-02-09 03:26:57 +01:00
|
|
|
p.stdin.close()
|
|
|
|
p.wait()
|
|
|
|
|
|
|
|
subprocess.check_call(gpg_opts + ['-a', '--export',
|
|
|
|
'--output', os.path.join(keydir, 'pubkey.asc')])
|
|
|
|
p = subprocess.Popen(gpg_opts + ['--with-colons', '--list-keys'],
|
|
|
|
stdout=subprocess.PIPE)
|
|
|
|
for line in p.stdout.readlines():
|
2017-02-19 00:07:16 +01:00
|
|
|
fields = line.decode().split(':')
|
2015-02-09 03:26:57 +01:00
|
|
|
if fields[0] == 'pub':
|
|
|
|
return fields[4][-8:].lower()
|
|
|
|
raise RuntimeError
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
2015-10-30 14:58:23 +01:00
|
|
|
super(TC_00_Dom0UpgradeMixin, cls).setUpClass()
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
cls.tmpdir = tempfile.mkdtemp()
|
|
|
|
|
|
|
|
cls.keyid = cls.generate_key(cls.tmpdir)
|
|
|
|
|
|
|
|
p = subprocess.Popen(['sudo', 'dd',
|
|
|
|
'status=none', 'of=/etc/yum.repos.d/test.repo'],
|
|
|
|
stdin=subprocess.PIPE)
|
2017-02-19 00:07:16 +01:00
|
|
|
p.stdin.write(b'''
|
2015-02-09 03:26:57 +01:00
|
|
|
[test]
|
|
|
|
name = Test
|
2016-06-02 02:49:42 +02:00
|
|
|
baseurl = http://localhost:8080/
|
2015-02-09 03:26:57 +01:00
|
|
|
enabled = 1
|
2016-06-02 02:49:42 +02:00
|
|
|
''')
|
2015-02-09 03:26:57 +01:00
|
|
|
p.stdin.close()
|
|
|
|
p.wait()
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def tearDownClass(cls):
|
|
|
|
subprocess.check_call(['sudo', 'rm', '-f',
|
|
|
|
'/etc/yum.repos.d/test.repo'])
|
|
|
|
|
2015-11-03 02:40:53 +01:00
|
|
|
shutil.rmtree(cls.tmpdir)
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
def setUp(self):
|
2015-10-30 14:58:23 +01:00
|
|
|
super(TC_00_Dom0UpgradeMixin, self).setUp()
|
2016-06-24 04:36:37 +02:00
|
|
|
if self.template.startswith('whonix-'):
|
|
|
|
# Whonix redirect all the traffic through tor, so repository
|
|
|
|
# on http://localhost:8080/ is unavailable
|
|
|
|
self.skipTest("Test not supported for this template")
|
2016-02-11 01:35:51 +01:00
|
|
|
self.init_default_template(self.template)
|
|
|
|
self.updatevm = self.app.add_new_vm(
|
|
|
|
qubes.vm.appvm.AppVM,
|
2015-10-30 14:58:23 +01:00
|
|
|
name=self.make_vm_name("updatevm"),
|
2016-02-11 01:35:51 +01:00
|
|
|
label='red'
|
|
|
|
)
|
2017-04-18 10:16:14 +02:00
|
|
|
self.loop.run_until_complete(self.updatevm.create_on_disk())
|
2016-02-11 01:35:51 +01:00
|
|
|
self.app.updatevm = self.updatevm
|
|
|
|
self.app.save()
|
2015-02-09 03:26:57 +01:00
|
|
|
subprocess.call(['sudo', 'rpm', '-e', self.pkg_name],
|
2017-09-28 03:03:30 +02:00
|
|
|
stderr=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
subprocess.check_call(['sudo', 'rpm', '--import',
|
|
|
|
os.path.join(self.tmpdir, 'pubkey.asc')])
|
2017-04-18 10:16:14 +02:00
|
|
|
self.loop.run_until_complete(self.updatevm.start())
|
2016-06-02 02:49:42 +02:00
|
|
|
self.repo_running = False
|
2017-09-28 02:55:24 +02:00
|
|
|
self.repo_proc = None
|
2015-02-09 03:26:57 +01:00
|
|
|
|
2015-10-30 14:58:23 +01:00
|
|
|
def tearDown(self):
|
2017-09-28 02:55:24 +02:00
|
|
|
if self.repo_proc:
|
|
|
|
self.repo_proc.terminate()
|
|
|
|
self.loop.run_until_complete(self.repo_proc.wait())
|
|
|
|
del self.repo_proc
|
2015-10-30 14:58:23 +01:00
|
|
|
super(TC_00_Dom0UpgradeMixin, self).tearDown()
|
2015-02-09 03:26:57 +01:00
|
|
|
|
2017-09-28 03:03:30 +02:00
|
|
|
subprocess.call(['sudo', 'rpm', '-e', self.pkg_name],
|
|
|
|
stderr=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
subprocess.call(['sudo', 'rpm', '-e', 'gpg-pubkey-{}'.format(
|
2017-09-28 03:03:30 +02:00
|
|
|
self.keyid)], stderr=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
for pkg in os.listdir(self.tmpdir):
|
|
|
|
if pkg.endswith('.rpm'):
|
|
|
|
os.unlink(pkg)
|
|
|
|
|
|
|
|
def create_pkg(self, dir, name, version):
|
|
|
|
spec_path = os.path.join(dir, name+'.spec')
|
|
|
|
spec = open(spec_path, 'w')
|
|
|
|
spec.write(
|
|
|
|
'''
|
|
|
|
Name: {name}
|
|
|
|
Summary: Test Package
|
|
|
|
Version: {version}
|
|
|
|
Release: 1
|
|
|
|
Vendor: Invisible Things Lab
|
|
|
|
License: GPL
|
|
|
|
Group: Qubes
|
|
|
|
URL: http://www.qubes-os.org
|
|
|
|
|
|
|
|
%description
|
|
|
|
Test package
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
|
|
|
%files
|
|
|
|
'''.format(name=name, version=version)
|
|
|
|
)
|
|
|
|
spec.close()
|
|
|
|
subprocess.check_call(
|
|
|
|
['rpmbuild', '--quiet', '-bb', '--define', '_rpmdir {}'.format(dir),
|
|
|
|
spec_path])
|
|
|
|
pkg_path = os.path.join(dir, 'x86_64',
|
|
|
|
'{}-{}-1.x86_64.rpm'.format(name, version))
|
|
|
|
subprocess.check_call(['sudo', 'chmod', 'go-rw', '/dev/tty'])
|
|
|
|
subprocess.check_call(
|
|
|
|
['rpm', '--quiet', '--define=_gpg_path {}'.format(dir),
|
|
|
|
'--define=_gpg_name {}'.format("Qubes test"),
|
|
|
|
'--addsign', pkg_path],
|
2017-09-28 03:03:30 +02:00
|
|
|
stdin=subprocess.DEVNULL,
|
|
|
|
stdout=subprocess.DEVNULL,
|
2015-02-09 03:26:57 +01:00
|
|
|
stderr=subprocess.STDOUT)
|
|
|
|
subprocess.check_call(['sudo', 'chmod', 'go+rw', '/dev/tty'])
|
|
|
|
return pkg_path
|
|
|
|
|
|
|
|
def send_pkg(self, filename):
|
2017-09-28 03:03:30 +02:00
|
|
|
with open(filename, 'rb') as f_pkg:
|
|
|
|
self.loop.run_until_complete(self.updatevm.run_for_stdio(
|
|
|
|
'mkdir -p /tmp/repo; cat > /tmp/repo/{}'.format(
|
|
|
|
os.path.basename(filename)),
|
|
|
|
input=f_pkg.read()))
|
2017-04-18 10:16:14 +02:00
|
|
|
try:
|
|
|
|
self.loop.run_until_complete(
|
|
|
|
self.updatevm.run_for_stdio('cd /tmp/repo; createrepo .'))
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
if e.returncode == 127:
|
|
|
|
self.skipTest('createrepo not installed in template {}'.format(
|
|
|
|
self.template))
|
|
|
|
else:
|
|
|
|
self.skipTest('createrepo failed with code {}, '
|
2017-09-28 02:58:45 +02:00
|
|
|
'cannot perform the test'.format(e.returncode))
|
2016-06-02 02:49:42 +02:00
|
|
|
self.start_repo()
|
|
|
|
|
|
|
|
def start_repo(self):
|
2017-04-18 10:16:14 +02:00
|
|
|
if self.repo_running:
|
|
|
|
return
|
2017-09-28 02:55:24 +02:00
|
|
|
self.repo_proc = self.loop.run_until_complete(self.updatevm.run(
|
2017-09-28 03:40:01 +02:00
|
|
|
'cd /tmp/repo && python -m SimpleHTTPServer 8080',
|
|
|
|
stdout=subprocess.DEVNULL,
|
|
|
|
stderr=subprocess.STDOUT))
|
2017-04-18 10:16:14 +02:00
|
|
|
self.repo_running = True
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
def test_000_update(self):
|
2016-02-03 17:22:15 +01:00
|
|
|
"""Dom0 update tests
|
|
|
|
|
|
|
|
Check if package update is:
|
|
|
|
- detected
|
|
|
|
- installed
|
|
|
|
- "updates pending" flag is cleared
|
|
|
|
"""
|
2015-02-09 03:26:57 +01:00
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '1.0')
|
|
|
|
subprocess.check_call(['sudo', 'rpm', '-i', filename])
|
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '2.0')
|
|
|
|
self.send_pkg(filename)
|
2016-02-03 17:22:15 +01:00
|
|
|
open(self.update_flag_path, 'a').close()
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
2017-09-28 02:55:24 +02:00
|
|
|
with open(logpath, 'w') as f_log:
|
|
|
|
proc = self.loop.run_until_complete(asyncio.create_subprocess_exec(
|
|
|
|
'qubes-dom0-update', '-y', *self.dom0_update_common_opts,
|
|
|
|
stdout=f_log,
|
|
|
|
stderr=subprocess.STDOUT))
|
|
|
|
self.loop.run_until_complete(proc.wait())
|
|
|
|
if proc.returncode:
|
|
|
|
del proc
|
|
|
|
with open(logpath) as f_log:
|
|
|
|
self.fail("qubes-dom0-update failed: " + f_log.read())
|
|
|
|
del proc
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
retcode = subprocess.call(['rpm', '-q', '{}-1.0'.format(
|
2017-09-28 03:03:30 +02:00
|
|
|
self.pkg_name)], stdout=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
self.assertEqual(retcode, 1, 'Package {}-1.0 still installed after '
|
|
|
|
'update'.format(self.pkg_name))
|
|
|
|
retcode = subprocess.call(['rpm', '-q', '{}-2.0'.format(
|
2017-09-28 03:03:30 +02:00
|
|
|
self.pkg_name)], stdout=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
self.assertEqual(retcode, 0, 'Package {}-2.0 not installed after '
|
|
|
|
'update'.format(self.pkg_name))
|
2016-02-03 17:22:15 +01:00
|
|
|
self.assertFalse(os.path.exists(self.update_flag_path),
|
|
|
|
"'updates pending' flag not cleared")
|
|
|
|
|
|
|
|
def test_005_update_flag_clear(self):
|
|
|
|
"""Check if 'updates pending' flag is creared"""
|
|
|
|
|
|
|
|
# create any pkg (but not install it) to initialize repo in the VM
|
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '1.0')
|
|
|
|
self.send_pkg(filename)
|
|
|
|
open(self.update_flag_path, 'a').close()
|
|
|
|
|
|
|
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
2017-09-28 02:55:24 +02:00
|
|
|
with open(logpath, 'w') as f_log:
|
|
|
|
proc = self.loop.run_until_complete(asyncio.create_subprocess_exec(
|
|
|
|
'qubes-dom0-update', '-y', *self.dom0_update_common_opts,
|
|
|
|
stdout=f_log,
|
|
|
|
stderr=subprocess.STDOUT))
|
|
|
|
self.loop.run_until_complete(proc.wait())
|
|
|
|
if proc.returncode:
|
|
|
|
del proc
|
|
|
|
with open(logpath) as f_log:
|
|
|
|
self.fail("qubes-dom0-update failed: " + f_log.read())
|
|
|
|
del proc
|
2016-02-03 17:22:15 +01:00
|
|
|
|
|
|
|
with open(logpath) as f:
|
|
|
|
dom0_update_output = f.read()
|
|
|
|
self.assertFalse('Errno' in dom0_update_output or
|
|
|
|
'Couldn\'t' in dom0_update_output,
|
|
|
|
"qubes-dom0-update reported an error: {}".
|
|
|
|
format(dom0_update_output))
|
|
|
|
|
|
|
|
self.assertFalse(os.path.exists(self.update_flag_path),
|
|
|
|
"'updates pending' flag not cleared")
|
|
|
|
|
|
|
|
def test_006_update_flag_clear(self):
|
|
|
|
"""Check if 'updates pending' flag is creared, using --clean"""
|
|
|
|
|
|
|
|
# create any pkg (but not install it) to initialize repo in the VM
|
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '1.0')
|
|
|
|
self.send_pkg(filename)
|
|
|
|
open(self.update_flag_path, 'a').close()
|
|
|
|
|
|
|
|
# remove also repodata to test #1685
|
2016-06-24 00:17:16 +02:00
|
|
|
if os.path.exists('/var/lib/qubes/updates/repodata'):
|
|
|
|
shutil.rmtree('/var/lib/qubes/updates/repodata')
|
2016-02-03 17:22:15 +01:00
|
|
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
2017-09-28 02:55:24 +02:00
|
|
|
with open(logpath, 'w') as f_log:
|
|
|
|
proc = self.loop.run_until_complete(asyncio.create_subprocess_exec(
|
|
|
|
'qubes-dom0-update', '-y', '--clean',
|
|
|
|
*self.dom0_update_common_opts,
|
|
|
|
stdout=f_log,
|
|
|
|
stderr=subprocess.STDOUT))
|
|
|
|
self.loop.run_until_complete(proc.wait())
|
|
|
|
if proc.returncode:
|
|
|
|
del proc
|
|
|
|
with open(logpath) as f_log:
|
|
|
|
self.fail("qubes-dom0-update failed: " + f_log.read())
|
|
|
|
del proc
|
2016-02-03 17:22:15 +01:00
|
|
|
|
|
|
|
with open(logpath) as f:
|
|
|
|
dom0_update_output = f.read()
|
|
|
|
self.assertFalse('Errno' in dom0_update_output or
|
|
|
|
'Couldn\'t' in dom0_update_output,
|
|
|
|
"qubes-dom0-update reported an error: {}".
|
|
|
|
format(dom0_update_output))
|
|
|
|
|
|
|
|
self.assertFalse(os.path.exists(self.update_flag_path),
|
|
|
|
"'updates pending' flag not cleared")
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
def test_010_instal(self):
|
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '1.0')
|
|
|
|
self.send_pkg(filename)
|
|
|
|
|
|
|
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
2017-09-28 02:55:24 +02:00
|
|
|
with open(logpath, 'w') as f_log:
|
|
|
|
proc = self.loop.run_until_complete(asyncio.create_subprocess_exec(
|
|
|
|
'qubes-dom0-update', '-y', *self.dom0_update_common_opts,
|
|
|
|
self.pkg_name,
|
|
|
|
stdout=f_log,
|
|
|
|
stderr=subprocess.STDOUT))
|
|
|
|
self.loop.run_until_complete(proc.wait())
|
|
|
|
if proc.returncode:
|
|
|
|
del proc
|
|
|
|
with open(logpath) as f_log:
|
|
|
|
self.fail("qubes-dom0-update failed: " + f_log.read())
|
|
|
|
del proc
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
retcode = subprocess.call(['rpm', '-q', '{}-1.0'.format(
|
|
|
|
self.pkg_name)], stdout=open('/dev/null', 'w'))
|
|
|
|
self.assertEqual(retcode, 0, 'Package {}-1.0 not installed'.format(
|
|
|
|
self.pkg_name))
|
|
|
|
|
|
|
|
def test_020_install_wrong_sign(self):
|
|
|
|
subprocess.call(['sudo', 'rpm', '-e', 'gpg-pubkey-{}'.format(
|
|
|
|
self.keyid)])
|
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '1.0')
|
|
|
|
self.send_pkg(filename)
|
|
|
|
|
|
|
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
2017-09-28 02:55:24 +02:00
|
|
|
with open(logpath, 'w') as f_log:
|
|
|
|
proc = self.loop.run_until_complete(asyncio.create_subprocess_exec(
|
|
|
|
'qubes-dom0-update', '-y', *self.dom0_update_common_opts,
|
|
|
|
self.pkg_name,
|
|
|
|
stdout=f_log,
|
|
|
|
stderr=subprocess.STDOUT))
|
|
|
|
self.loop.run_until_complete(proc.wait())
|
|
|
|
if not proc.returncode:
|
|
|
|
del proc
|
|
|
|
with open(logpath) as f_log:
|
|
|
|
self.fail("qubes-dom0-update unexpectedly succeeded: " +
|
|
|
|
f_log.read())
|
|
|
|
del proc
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
retcode = subprocess.call(['rpm', '-q', '{}-1.0'.format(
|
2017-09-28 03:03:30 +02:00
|
|
|
self.pkg_name)], stdout=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
self.assertEqual(retcode, 1,
|
|
|
|
'Package {}-1.0 installed although '
|
|
|
|
'signature is invalid'.format(self.pkg_name))
|
|
|
|
|
|
|
|
def test_030_install_unsigned(self):
|
|
|
|
filename = self.create_pkg(self.tmpdir, self.pkg_name, '1.0')
|
|
|
|
subprocess.check_call(['rpm', '--delsign', filename],
|
2017-09-28 03:03:30 +02:00
|
|
|
stdout=subprocess.DEVNULL,
|
2015-02-09 03:26:57 +01:00
|
|
|
stderr=subprocess.STDOUT)
|
|
|
|
self.send_pkg(filename)
|
|
|
|
|
|
|
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
2017-09-28 02:55:24 +02:00
|
|
|
with open(logpath, 'w') as f_log:
|
|
|
|
proc = self.loop.run_until_complete(asyncio.create_subprocess_exec(
|
|
|
|
'qubes-dom0-update', '-y', *self.dom0_update_common_opts,
|
|
|
|
self.pkg_name,
|
|
|
|
stdout=f_log,
|
|
|
|
stderr=subprocess.STDOUT))
|
|
|
|
self.loop.run_until_complete(proc.wait())
|
|
|
|
if not proc.returncode:
|
|
|
|
del proc
|
|
|
|
with open(logpath) as f_log:
|
|
|
|
self.fail("qubes-dom0-update unexpectedly succeeded: " +
|
|
|
|
f_log.read())
|
|
|
|
del proc
|
2015-02-09 03:26:57 +01:00
|
|
|
|
|
|
|
retcode = subprocess.call(['rpm', '-q', '{}-1.0'.format(
|
2017-09-28 03:03:30 +02:00
|
|
|
self.pkg_name)], stdout=subprocess.DEVNULL)
|
2015-02-09 03:26:57 +01:00
|
|
|
self.assertEqual(retcode, 1,
|
|
|
|
'UNSIGNED package {}-1.0 installed'.format(self.pkg_name))
|
2015-10-30 14:58:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
def load_tests(loader, tests, pattern):
|
2018-03-30 03:04:15 +02:00
|
|
|
tests.addTests(loader.loadTestsFromNames(
|
|
|
|
qubes.tests.create_testcases_for_templates('TC_00_Dom0Upgrade',
|
|
|
|
TC_00_Dom0UpgradeMixin, qubes.tests.SystemTestCase
|
|
|
|
globals=globals())))
|
2015-10-30 14:58:23 +01:00
|
|
|
return tests
|