[master 1/1] Don't crash if no groups are specified (#1316816)
by dashea
From: David Shea <dshea(a)redhat.com>
If the groups input field in the GUI is empty, set the groups list to an
empty list instead of a list containing an empty string.
---
pyanaconda/ui/gui/spokes/user.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index e4e49c7..968079e 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -156,7 +156,8 @@ def apply(self):
else:
self._user.gid = None
- self._user.groups = [g.strip() for g in self._tGroups.get_text().split(",")]
+ # ''.split(',') returns [''] instead of [], which is not what we want
+ self._user.groups = [g.strip() for g in self._tGroups.get_text().split(",") if g]
def run(self):
self.window.show()
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/fe14b640d6172cd726f8114e60...
8 years, 1 month
[master 1/1] Set both req_size and size of thin pool when growing LVM
by dashea
From: Vratislav Podzimek <vpodzime(a)redhat.com>
This fixes an issue with growing thin pool requests where the thin pools don't
have their size set but their req_size is set to the sum of their thin LVs.
---
blivet/partitioning.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 37a19e1..d2aff6b 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1976,6 +1976,7 @@ def grow_lvm(storage):
if lv in vg.thinpools:
# make sure the pool's base size is at least the sum of its lvs'
lv.req_size = max(lv.req_size, lv.used_space)
+ lv.size = lv.req_size
# add the required padding to the requested pool size
lv.req_size += Size(blockdev.lvm.get_thpool_padding(lv.req_size, vg.pe_size))
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/124f876ef9ff26359c542e77be70...
8 years, 1 month
[master 1/1] Multiple Dogtail tests improvements
by dashea
From: Alexander Todorov <atodorov(a)redhat.com>
- use unittest.skipIf and execute via nosetests_root.sh
- remove support for anacondaArgs because it was not used
- screenshots are placed in the correct test results directory
- logs are collected on test failures too
- cleanup mounted filesystems and update anaconda-cleanup to
use the new BlockDev loop plugin along the way
---
.gitignore | 1 +
scripts/anaconda-cleanup | 4 +--
tests/Makefile.am | 1 -
tests/gui/base.py | 29 +++++++++------
tests/nosetests_root.sh | 11 ++++++
tests/run_gui_tests.sh | 93 ------------------------------------------------
6 files changed, 33 insertions(+), 106 deletions(-)
delete mode 100755 tests/run_gui_tests.sh
diff --git a/.gitignore b/.gitignore
index 42de069..3f51d0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,6 +72,7 @@ py-compile
stamp-h1
tags
test-driver
+tests/autogui-results-*/
tests/*/*/*.log
tests/*/*/*.trs
tests/*/*.log
diff --git a/scripts/anaconda-cleanup b/scripts/anaconda-cleanup
index 19e41a3..8699c7d 100755
--- a/scripts/anaconda-cleanup
+++ b/scripts/anaconda-cleanup
@@ -41,6 +41,7 @@ pyanaconda.anaconda_log.init()
from blivet.blivet import StorageDiscoveryConfig
from blivet.devicetree import DeviceTree
from blivet import devicelibs
+from gi.repository import BlockDev as blockdev
storage_config = StorageDiscoveryConfig()
@@ -56,7 +57,7 @@ for dev in os.listdir(sys_class_block):
continue
loop = os.listdir("%s/%s/slaves" % (sys_class_block, dev))[0].strip()
- storage_config.disk_images[name] = devicelibs.loop.get_backing_file(loop)
+ storage_config.disk_images[name] = blockdev.loop_get_backing_file(loop)
if not image_install:
live_install = live_install or os.path.exists("/dev/live")
@@ -87,4 +88,3 @@ for name in devicetree.disk_images.keys():
device = devicetree.get_device_by_name(name)
device.deactivate(recursive=True)
os.system("udevadm control --env=ANACONDA=0")
-
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cdd8a39..e0237ea 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -53,7 +53,6 @@ dist_check_SCRIPTS = $(srcdir)/glade/*.py \
gettext_tests/canary_tests.sh \
storage/run_storage_tests.py \
install/run_install_test.sh \
- run_gui_tests.sh \
$(srcdir)/gui/*.py \
$(srcdir)/storage/cases/*.py \
$(srcdir)/*_tests/*.py
diff --git a/tests/gui/base.py b/tests/gui/base.py
index 2f76847..a38ec4a 100644
--- a/tests/gui/base.py
+++ b/tests/gui/base.py
@@ -23,6 +23,7 @@
import copy
import glob
import shutil
+import selinux
import subprocess
import tempfile
import traceback
@@ -32,7 +33,7 @@
from dogtail.config import config as dogtail_config
from dogtail.predicate import GenericPredicate
from dogtail.tree import SearchError, root
-from dogtail.utils import doDelay, screenshot
+from dogtail.utils import doDelay, isA11yEnabled, screenshot
from nose.plugins.multiprocess import TimedOutException
class UITestCase(unittest.TestCase):
@@ -69,12 +70,17 @@ class UITestCase(unittest.TestCase):
which is used instead of runTest for error handling purposes.
"""
+ suite_name = None
+
def update_scratch_dir(self, name=""):
""" Update the directory where Dogtail saves screenshots. """
path = os.path.join(testconfig.config.get("resultsdir", ""), name)
if not path.endswith("/"):
path += "/"
+ if not os.path.isdir(path):
+ os.makedirs(path)
+
dogtail_config.load({"scratchDir": path})
###
@@ -86,7 +92,7 @@ def runTest(self):
anaconda should a test fail. Subclasses should not override this.
See the documentation for _run.
"""
- self.update_scratch_dir()
+ self.update_scratch_dir(self.suite_name)
try:
self._run()
@@ -240,6 +246,10 @@ def exit_spoke(self, hubName="INSTALLATION SUMMARY", node=None):
self.check_window_displayed(hubName)
+(a)unittest.skipIf(os.geteuid() != 0, "GUI tests must be run as root")
+(a)unittest.skipIf(os.environ.get("DISPLAY", "") == "", "DISPLAY must be defined")
+(a)unittest.skipIf(selinux.security_getenforce() == 1, "SELinux must be disabled or in Permissive mode, see rhbz#1276376")
+(a)unittest.skipIf(not isA11yEnabled(), "Assistive Technologies are disabled")
class DogtailTestCase(unittest.TestCase):
"""A subclass that defines all the parameters for starting a local
copy of anaconda, inspecting results, and managing temporary data!
@@ -275,7 +285,7 @@ def __init__(self, methodName='runTest'):
self.suite = unittest.TestSuite()
for test in self.tests:
T = test()
- T.update_scratch_dir(self.name)
+ T.suite_name = self.name
self.suite.addTest(T)
self.test_result = None
@@ -351,11 +361,11 @@ def die(self, terminate=False):
if terminate:
self._proc.terminate()
- # tests will click the Reboot or Quit button which will shutdown anaconda
- # we need to make sure /mnt/sysimage/* are unmounted and device mapper devices
- # are removed before starting the next test. ATM I have no idea if pyanaconda
- # provides an API for this so wait for a while instead!
- doDelay(30)
+ # Tests will click the Reboot or Quit button which will shutdown anaconda.
+ # We need to make sure /mnt/sysimage/* are unmounted and device mapper devices
+ # are removed before starting the next test.
+ subprocess.call(["%s/scripts/anaconda-cleanup" % os.environ.get("top_srcdir", ".")],
+ stderr=subprocess.STDOUT)
self._proc.kill()
self._proc = None
@@ -389,7 +399,6 @@ def runTest(self):
args = ["%s/anaconda.py" % os.environ.get("top_srcdir", ""), "-G"]
for drive in self._drivePaths.values():
args += ["--image", drive]
- args += testconfig.config.get("anacondaArgs", "").strip('"')
# Save a reference to the running anaconda process so we can later kill
# it if necessary. For now, the only reason we'd want to kill it is
@@ -401,7 +410,7 @@ def runTest(self):
self.test_result = unittest.TextTestRunner(verbosity=2, failfast=True).run(self.suite)
if not self.test_result.wasSuccessful():
raise AssertionError('Dogtail tests failed')
- except TimedOutException:
+ except (TimedOutException, AssertionError):
self.die(True)
self.collect_logs()
self.cleanup()
diff --git a/tests/nosetests_root.sh b/tests/nosetests_root.sh
index 9169de8..ea65021 100755
--- a/tests/nosetests_root.sh
+++ b/tests/nosetests_root.sh
@@ -4,3 +4,14 @@
srcdir=${srcdir:=$(dirname "$0")}
exec ${srcdir}/nosetests.sh ${srcdir}/pyanaconda_tests/user_create_test.py
+
+if ! rpm -q python3-nose-testconfig &> /dev/null; then
+ echo "python3-nose-testconfig is not available; exiting."
+ exit 99
+fi
+
+export LC_ALL=C # translations confuse Dogtail
+
+exec ${srcdir}/nosetests.sh -s --nologcapture --process-timeout 1200 \
+ --tc=resultsdir:$(readlink -f autogui-results-$(date +"%Y%m%d_%H%M%S")) \
+ ${srcdir}/gui/test_*.py
diff --git a/tests/run_gui_tests.sh b/tests/run_gui_tests.sh
deleted file mode 100755
index 547ade5..0000000
--- a/tests/run_gui_tests.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions of
-# the GNU General Public License v.2, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY expressed or implied, including the implied warranties of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details. You should have received a copy of the
-# GNU General Public License along with this program; if not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
-# source code or documentation are not subject to the GNU General Public
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-#
-# Red Hat Author(s): Chris Lumens <clumens(a)redhat.com>
-
-# TODO: If all gui tests are properly annotated with a skipIf decorator
-# this file can be dropped and the tests executed by nosetests_root.sh
-
-function doit() {
- ARGS="-s \
- -v \
- --nologcapture \
- --process-timeout=1200 \
- --processes=1 \
- --tc=resultsdir:$(mktemp -d --tmpdir=$top_srcdir/tests autogui-results-XXXXXX)"
-
- export LC_ALL=C # translations confuse Dogtail
-
- if [ -z "$1" ]; then
- nosetests-3.5 ${ARGS} ${GUI_TESTS:-$top_srcdir/tests/gui/test_*.py}
- else
- nosetests-3.5 ${ARGS} "${1}" ${GUI_TESTS:-$top_srcdir/tests/gui/test_*.py}
- fi
-}
-
-if [ -z "$top_srcdir" ]; then
- top_srcdir="$(dirname "$0")/.."
-fi
-
-# this script needs absolute paths
-export top_srcdir=`readlink -f $top_srcdir`
-if [ ! -z "$top_builddir" ]; then
- export top_builddir=`readlink -f $top_builddir`
-fi
-. ${top_srcdir}/tests/testenv.sh
-
-if ! rpm -q python3-nose-testconfig &> /dev/null; then
- echo "test_config plugin is not available; exiting."
- exit 99
-fi
-
-# Have to be root to run this test, as it requires creating disk iamges.
-if [ ${EUID} != 0 ]; then
- echo "You must be root to run the GUI tests; skipping."
- exit 77
-fi
-
-if [ -z "${DISPLAY}" ]; then
- echo "DISPLAY is not set; skipping."
- exit 77
-fi
-
-# We need SELinux Permissive or Disabled, see rhbz#1276376
-if [ `getenforce` == "Enforcing" ]; then
- echo "SELinux is in Enforcing mode; skipping."
- exit 77
-fi
-
-# in case we want coverage support configure
-# python to start coverage for all processes
-if [ ! -z "$COVERAGE_PROCESS_START" ]; then
- ROOT_SITE_PACKAGES=`python3 -m site --user-site`
- mkdir -p "$ROOT_SITE_PACKAGES"
- if [ ! -f "$ROOT_SITE_PACKAGES/usercustomize.py" ]; then
- cp "$top_srcdir/tests/usercustomize.py" "$ROOT_SITE_PACKAGES"
- fi
-fi
-
-if [[ "${TEST_ANACONDA_ARGS}" != "" ]]; then
- EXTRA="--tc=anacondaArgs:\"${TEST_ANACONDA_ARGS}\""
-elif [[ $# != 0 ]]; then
- EXTRA="--tc=anacondaArgs:\"$*\""
-else
- EXTRA=""
-fi
-
-# execute the tests
-doit "${EXTRA}"
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/0d8f86d4f4bcf627f6a2fd7341...
8 years, 1 month
Re: [rhinstaller/anaconda/pulls/562 master] Multiple Dogtail tests
improvements
by dashea
> @@ -351,11 +361,11 @@ def die(self, terminate=False):
> if terminate:
> self._proc.terminate()
>
> - # tests will click the Reboot or Quit button which will shutdown anaconda
> - # we need to make sure /mnt/sysimage/* are unmounted and device mapper devices
> - # are removed before starting the next test. ATM I have no idea if pyanaconda
> - # provides an API for this so wait for a while instead!
> - doDelay(30)
> + # Tests will click the Reboot or Quit button which will shutdown anaconda.
> + # We need to make sure /mnt/sysimage/* are unmounted and device mapper devices
> + # are removed before starting the next test.
> + subprocess.call(["%s/scripts/anaconda-cleanup" % os.environ.get("top_srcdir", "")],
If $top_srcdir isn't set set, this will mean /scripts/anaconda-cleanup will get run. You probably want ./scripts/anaconda-cleanup to get run instead. So:
os.environ.get("top_srcdir", ".")
--
To view this pull request on github, visit https://github.com/rhinstaller/anaconda/pull/562#discussion_r58061103
8 years, 1 month