[PATCH rhel7-branch 1/7] Remove the automated GUI tests.
Chris Lumens
clumens at redhat.com
Wed Jun 3 13:55:38 UTC 2015
These will never work in RHEL7 - they don't yet work on master, we won't
find the time to work on them after this rebase, and dogtail's not even
part of the distribution.
Related: rhbz#1196721
---
tests/Makefile.am | 5 -
tests/gui/anaconda-autogui-testing.ks | 45 -----
tests/gui/inside/__init__.py | 182 --------------------
tests/gui/inside/date_time.py | 59 -------
tests/gui/inside/keyboard.py | 127 --------------
tests/gui/inside/network.py | 49 ------
tests/gui/inside/progress.py | 122 --------------
tests/gui/inside/rootpassword.py | 66 --------
tests/gui/inside/storage.py | 101 -----------
tests/gui/inside/summary.py | 81 ---------
tests/gui/inside/user.py | 74 ---------
tests/gui/inside/welcome.py | 64 -------
tests/gui/make_livecd.sh | 89 ----------
tests/gui/outside/__init__.py | 294 ---------------------------------
tests/gui/outside/template.py | 77 ---------
tests/gui/outside/test_simplelivecd.py | 39 -----
tests/gui/run_gui_tests.sh | 81 ---------
17 files changed, 1555 deletions(-)
delete mode 100644 tests/gui/anaconda-autogui-testing.ks
delete mode 100644 tests/gui/inside/__init__.py
delete mode 100644 tests/gui/inside/date_time.py
delete mode 100644 tests/gui/inside/keyboard.py
delete mode 100644 tests/gui/inside/network.py
delete mode 100644 tests/gui/inside/progress.py
delete mode 100644 tests/gui/inside/rootpassword.py
delete mode 100644 tests/gui/inside/storage.py
delete mode 100644 tests/gui/inside/summary.py
delete mode 100644 tests/gui/inside/user.py
delete mode 100644 tests/gui/inside/welcome.py
delete mode 100755 tests/gui/make_livecd.sh
delete mode 100644 tests/gui/outside/__init__.py
delete mode 100644 tests/gui/outside/template.py
delete mode 100644 tests/gui/outside/test_simplelivecd.py
delete mode 100755 tests/gui/run_gui_tests.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2803481..dac5d92 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,10 +50,6 @@ dist_check_SCRIPTS = $(srcdir)/glade/*/*.py \
gettext/gettext_potfiles.py \
storage/run_storage_tests.py \
ostree/run_ostree_tests.sh \
- $(srcdir)/gui/*.ks \
- $(srcdir)/gui/*.sh \
- $(srcdir)/gui/inside/*.py \
- $(srcdir)/gui/outside/*.py \
$(srcdir)/storage/cases/*.py \
$(srcdir)/*_tests/*.py
@@ -63,7 +59,6 @@ TESTS = nosetests.sh \
gettext/gettext_warnings.sh \
gettext/gettext_potfiles.py \
storage/run_storage_tests.py \
- gui/run_gui_tests.sh \
glade/run_glade_tests.sh \
ostree/run_ostree_tests.sh
diff --git a/tests/gui/anaconda-autogui-testing.ks b/tests/gui/anaconda-autogui-testing.ks
deleted file mode 100644
index e54e711..0000000
--- a/tests/gui/anaconda-autogui-testing.ks
+++ /dev/null
@@ -1,45 +0,0 @@
-%include /usr/share/spin-kickstarts/fedora-livecd-desktop.ks
-
-url --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=rawhide&arch=x86_64
-
-shutdown
-network --bootproto=dhcp --activate --device=link
-rootpw qweqwe
-
-# Override dumb values from the spin-kickstarts.
-bootloader --location=mbr
-zerombr
-clearpart --all
-part / --fstype="ext4" --size=4400
-
-%post
-cat >> /etc/rc.d/init.d/livesys << EOF
-# Mount the attached disk containing test suite information.
-mkdir /mnt/anactest
-mount -L ANACTEST /mnt/anactest
-chown -R liveuser.liveuser /mnt/anactest
-
-if [ -f /usr/share/applications/anaconda.desktop ]; then
- # Make anaconda start automatically.
- if [ -f ~liveuser/.config/autostart/fedora-welcome.desktop ]; then
- rm ~liveuser/.config/autostart/fedora-welcome.desktop
- fi
-
- cp /usr/share/applications/anaconda.desktop ~liveuser/.config/autostart/
- sed -i -e '/Exec=/ s|/usr/bin/liveinst|python /mnt/anactest/suite.py|' ~liveuser/.config/autostart/anaconda.desktop
-
- # Enable accessibility needed for testing.
- cat >> /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.override << FOE
-[org.gnome.desktop.interface]
-toolkit-accessibility=true
-FOE
-fi
-
-EOF
-%end
-
-%packages
-dogtail
-- at libreoffice
--java*
-%end
diff --git a/tests/gui/inside/__init__.py b/tests/gui/inside/__init__.py
deleted file mode 100644
index cf4cf90..0000000
--- a/tests/gui/inside/__init__.py
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-from dogtail.config import config
-from dogtail.predicate import GenericPredicate
-from dogtail.tree import SearchError, root
-from dogtail.utils import doDelay, screenshot
-
-import glob
-import os
-import unittest
-
-class UITestCase(unittest.TestCase):
- """A UITestCase is a class that incorporates all the test functions for a
- single anaconda Hub or Spoke window. Moving to the window, and dealing
- with what happens after we move away is left up to whatever wraps up
- all the test cases. A single Hub or Spoke may have multiple instances
- of this class - one may test the assumption that everything works as it
- should, while another may test that a specific initial setup fails in
- an expected way, and another may attempt fuzz testing on all entries on
- the screen. However, a single TestSuite will only have one instance
- for each anaconda window.
-
- Some basic assumptions about the existence of UI elements are made in
- UITestCase subclasses. If an element is required to be there (for
- instance, a button we are going to click) we simply grab the element
- with the exception-raising dogtail functions and call click on it.
- If the element does not exist, the exception will be propagated up and
- fail the test. If we are testing for the existence of some element
- (for instance, that a dialog was displayed after a button was clicked)
- then we use UITestCase.find and the unittest.assert* functions.
-
- This is kind of subtle, but look at existing test cases for examples.
-
- Due to the unusual nature of running such a large program as anaconda
- in a test suite, combined with the special environment, tests are
- organized inside a UITestCase as follows:
-
- * Testing one little piece of the window is handled by a check_*
- function. These are explicitly not named test_* as that is special
- to unittest.
-
- * Multiple check_* functions are called linearly in the _run method,
- which is used instead of runTest for error handling purposes.
- """
-
- ###
- ### OVERRIDES OF THINGS FROM TestCase
- ###
-
- def runTest(self):
- """A version of TestCase.runTest that attempts to take a screenshot of
- anaconda should a test fail. Subclasses should not override this.
- See the documentation for _run.
- """
- config.load({"scratchDir": "/mnt/anactest/result/"})
-
- try:
- self._run()
- except (AssertionError, SearchError):
- # Try to take a screenshot of whatever screen anaconda's on, so
- # we can attempt to figure out what went wrong.
- screenshot()
- raise
-
- def _run(self):
- """Do all the tests for this test case. This is like the TestCase.runTest
- method, but we've overridden that to do more specialized error handling.
- Thus, all testing should be done in this method.
- """
- pass
-
- def setUp(self):
- self.ana = root.application("anaconda")
-
- ###
- ### METHODS FOR FINDING WIDGETS
- ###
-
- def find(self, name, roleName=None):
- """Wrap findChild, returning None if no widget is found instead of
- raising an exception. This method also allows for checking if
- anaconda has hit a traceback and if so, fails the test
- immediately.
- """
- if len(glob.glob("/tmp/anaconda-tb-*")) > 0:
- self.fail("anaconda encountered a traceback")
-
- try:
- return self.ana.child(name=name, roleName=roleName)
- except SearchError:
- return None
-
- ###
- ### METHODS FOR CHECKING A SINGLE WIDGET
- ###
-
- def check_window_displayed(self, name):
- """Verify that a window (such as a hub or spoke) given by the
- provided name is currently displayed on the screen. If not,
- the current test case will be failed.
- """
- w = self.find(name)
- self.assertIsNotNone(w, msg="%s not found" % name)
- self.assertTrue(w.showing, msg="%s is not displayed" % name)
-
- def check_dialog_displayed(self, name):
- """Verify that a dialog given by the provided name is currently
- displayed on the screen. If not, the current test case will
- be failed.
- """
- w = self.find(name, "dialog")
- self.assertIsNotNone(w, msg="%s not found" % name)
- self.assertTrue(w.showing, msg="%s is not displayed" % name)
-
- def check_keyboard_layout_indicator(self, layout):
- """Verify that the keyboard layout indicator is present and that
- the currently enabled layout is what we expect. If not, the
- current test case will be failed.
- """
- indicator = self.find("Keyboard Layout")
- self.assertIsNotNone(indicator, msg="keyboard layout indicator not found")
- self.assertEqual(indicator.description, layout,
- msg="keyboard layout indicator not set to %s" % layout)
-
- def check_no_warning_bar(self):
- """Verify that the warning bar is not currently displayed."""
- self.assertIsNone(self.find("Warning"), msg="Warning bar should not be displayed")
-
- def check_warning_bar(self, msg=None):
- """Verify that the warning bar is currently displayed. If msg is given,
- verify that it is contained in whatever message the warning bar is
- showing.
- """
- bar = self.find("Warning")
- self.assertTrue(bar.showing, msg="Warning bar should be displayed")
- if msg:
- self.assertIn(msg, bar.child(roleName="label").text)
-
- def click_button(self, name):
- """Verify that a button with the given name exists and is sensitive,
- and then click it.
- """
- b = self.find(name, "push button")
- self.assertIsNotNone(b, msg="%s button not found" % name)
- self.assertTrue(b.sensitive, msg="%s button should be sensitive" % name)
- b.click()
-
- def enter_spoke(self, spokeSelectorName):
- """Click on the spoke selector for the given spoke, then wait a moment
- to make sure it has appeared.
- """
- selector = self.find(spokeSelectorName, "spoke selector")
- self.assertIsNotNone(selector, msg="Selector %s not found" % spokeSelectorName)
- selector.click()
-
- def exit_spoke(self, hubName="INSTALLATION SUMMARY"):
- """Leave a spoke by clicking the Done button in the upper left corner,
- then verify we have returned to the proper hub. Since most spokes
- are off the summary hub, that's the default. If we are not back
- on the hub, the current test case will be failed.
- """
- button = self.find("_Done", "push button")
- self.assertIsNotNone(button, msg="Done button not found")
- button.click()
- doDelay(5)
- self.check_window_displayed(hubName)
diff --git a/tests/gui/inside/date_time.py b/tests/gui/inside/date_time.py
deleted file mode 100644
index b7cc72e..0000000
--- a/tests/gui/inside/date_time.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from . import UITestCase
-
-class LiveCDDateTimeTestCase(UITestCase):
- def check_region_city(self):
- # FIXME: This encodes default information.
- entry = self.find("Region", "text")
- self.assertIsNotNone(entry, "Region entry does not exist")
- self.assertEqual(entry.text, "Americas", msg="Region should be set to default")
-
- entry = self.find("City", "text")
- self.assertIsNotNone(entry, "City entry does not exist")
- self.assertEqual(entry.text, "New York", msg="City should be set to default")
-
- def check_ntp(self):
- # NTP should be enabled given that we started up with networking.
- # FIXME: This encodes default information.
- button = self.find("Use Network Time", "toggle button")
- self.assertIsNotNone(button, msg="Use Network Time button not found")
- self.assertTrue(button.checked, msg="NTP should be enabled")
-
- button = self.find("Configure NTP", "push button")
- self.assertIsNotNone(button, msg="Configure NTP button not found")
- self.assertTrue(button.sensitive, msg="Configure NTP button should be sensitive")
-
- area = self.find("Set Date & Time")
- self.assertIsNotNone(area, msg="Set Date & Time not found")
- self.assertFalse(area.sensitive, msg="Date & Time region should not be sensitive")
-
- def _run(self):
- # First, we need to click on the network spoke selector.
- self.enter_spoke("DATE & TIME")
-
- # Now verify we are on the right screen.
- self.check_window_displayed("DATE & TIME")
-
- # And now we can check everything else on the screen.
- self.check_region_city()
- self.check_ntp()
-
- # And then we click the Done button to go back to the hub, verifying
- # that's where we ended up.
- self.exit_spoke()
diff --git a/tests/gui/inside/keyboard.py b/tests/gui/inside/keyboard.py
deleted file mode 100644
index b57773b..0000000
--- a/tests/gui/inside/keyboard.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from dogtail.predicate import GenericPredicate
-
-from . import UITestCase
-
-class BasicKeyboardTestCase(UITestCase):
- def _get_enabled_layouts(self, view):
- return [child.text for child in view.findChildren(GenericPredicate(roleName="table cell"))]
-
- def check_options_dialog(self):
- # Click the options button.
- self.click_button("Options")
- self.check_dialog_displayed("Layout Options")
- self.click_button("Cancel")
-
- def check_num_layouts(self):
- # There ought to be only one layout enabled right now.
- # FIXME: This encodes default information.
- view = self.find("Selected Layouts")
- self.assertIsNotNone(view, "Selected Layouts view not found")
- self.assertEqual(len(self._get_enabled_layouts(view)), 1, msg="An unexpected number of keyboard layouts are enabled")
-
- def check_layout_buttons_initial(self):
- button = self.find("Add layout", "push button")
- self.assertIsNotNone(button, msg="Add layout button not found")
- self.assertTrue(button.sensitive, msg="Add layout button should be sensitive")
-
- # When no layouts are selected in the view, none of these buttons mean anything.
- button = self.find("Remove layout", "push button")
- self.assertIsNotNone(button, msg="Remove layout button not found")
- self.assertFalse(button.sensitive, msg="Remove layout button should not be sensitive")
-
- button = self.find("Move selected layout up", "push button")
- self.assertIsNotNone(button, msg="Move layout up button not found")
- self.assertFalse(button.sensitive, msg="Move layout up button should not be sensitive")
-
- button = self.find("Move selected layout down", "push button")
- self.assertIsNotNone(button, msg="Move layout down button not found")
- self.assertFalse(button.sensitive, msg="Move layout down button should not be sensitive")
-
- button = self.find("Preview layout", "push button")
- self.assertIsNotNone(button, msg="Preview layout button not found")
- self.assertFalse(button.sensitive, msg="Preview layout button should not be sensitive")
-
- def check_add_layout_dialog(self):
- self.click_button("Add layout")
- self.check_dialog_displayed("Add Layout")
- self.click_button("Cancel")
-
- def check_layout_buttons_after_click(self):
- # Click on the first (and only) layout shown in the view. This
- # ensures buttons change sensitivity.
- # FIXME: This encodes default information.
- view = self.find("Selected Layouts")
- self.assertIsNotNone(view, msg="Selected Layouts view not found")
- view.children[1].click()
-
- button = self.find("Add layout", "push button")
- self.assertIsNotNone(button, msg="Add layout button not found")
- self.assertTrue(button.sensitive, msg="Add layout button should be sensitive")
-
- button = self.find("Remove layout", "push button")
- self.assertIsNotNone(button, msg="Remove layout button not found")
- self.assertTrue(button.sensitive, msg="Remove layout button should be sensitive")
-
- # These two should still not be sensitive - we've only got one layout.
- # We ensured that with check_num_layouts.
- # FIXME: This encodes default information.
- button = self.find("Move selected layout up", "push button")
- self.assertIsNotNone(button, msg="Move layout up button not found")
- self.assertFalse(button.sensitive, msg="Move layout up button should not be sensitive")
-
- button = self.find("Move selected layout down", "push button")
- self.assertIsNotNone(button, msg="Move layout down button not found")
- self.assertFalse(button.sensitive, msg="Move layout down button should not be sensitive")
-
- button = self.find("Preview layout", "push button")
- self.assertIsNotNone(button, msg="Preview layout button not found")
- self.assertTrue(button.sensitive, msg="Preview layout button should be sensitive")
-
- def check_preview_dialog(self):
- self.click_button("Preview layout")
-
- # Verify the preview dialog is displayed. The dialog out to be titled
- # with the name of the current layout. We happen to know that - it's
- # the default.
- # FIXME: This encodes default information.
- self.check_dialog_displayed("English (US)")
-
- self.click_button("Close")
-
- def _run(self):
- # First, we need to click on the network spoke selector.
- self.enter_spoke("KEYBOARD")
-
- # Now verify we are on the right screen.
- self.check_window_displayed("KEYBOARD")
-
- # And now we can check everything else on the screen.
- self.check_options_dialog()
- self.check_num_layouts()
- self.check_layout_buttons_initial()
- self.check_add_layout_dialog()
-
- # Once a layout has been selected in the view, we can test these other buttons.
- self.check_layout_buttons_after_click()
- self.check_preview_dialog()
-
- # And then we click the Done button to go back to the hub, verifying
- # that's where we ended up.
- self.exit_spoke()
diff --git a/tests/gui/inside/network.py b/tests/gui/inside/network.py
deleted file mode 100644
index 6398230..0000000
--- a/tests/gui/inside/network.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from . import UITestCase
-
-class LiveCDNetworkTestCase(UITestCase):
- def check_hostname_entry(self):
- # Only the live install hint and hostname box should be visible.
- self.assertTrue(self.find("Please use the live desktop environment's tools for customizing your network configuration. You can set the hostname here.").showing)
-
- box = self.find("Network Config Box")
- self.assertIsNotNone(box, "Network Config box not found")
- self.assertFalse(box.showing, msg="Network Config box should not be displayed")
-
- box = self.find("More Network Config Box")
- self.assertIsNotNone(box, "More Network Config box not found")
- self.assertFalse(box.showing, msg="More Network Config box should not be displayed")
-
- entry = self.find("Hostname", "text")
- self.assertIsNotNone(entry , "Hostname entry not found")
- self.assertTrue(entry.showing, msg="Hostname entry should be displayed")
-
- def _run(self):
- # First, we need to click on the network spoke selector.
- self.enter_spoke("NETWORK & HOSTNAME")
-
- # Now verify we are on the right screen.
- self.check_window_displayed("NETWORK & HOSTNAME")
-
- # And now we can check everything else on the screen.
- self.check_hostname_entry()
-
- # And then we click the Done button to go back to the hub, verifying
- # that's where we ended up.
- self.exit_spoke()
diff --git a/tests/gui/inside/progress.py b/tests/gui/inside/progress.py
deleted file mode 100644
index 5d9976b..0000000
--- a/tests/gui/inside/progress.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-import signal
-
-from dogtail.predicate import GenericPredicate
-from dogtail.utils import doDelay
-from . import UITestCase
-
-class LiveCDProgressTestCase(UITestCase):
- def check_begin_installation_button(self):
- button = self.find("Begin Installation", "push button")
- self.assertIsNotNone(button, msg="Begin Installation button does not exist")
- self.assertTrue(button.sensitive, msg="Begin Installation button should be sensitive")
-
- def check_shown_spoke_selectors(self):
- # FIXME: This forces English.
- validSelectors = ["ROOT PASSWORD", "USER CREATION"]
- selectors = self.ana.findChildren(GenericPredicate(roleName="spoke selector"))
-
- self.assertEqual(len(selectors), len(validSelectors), msg="Incorrect number of spoke selectors shown")
-
- # Validate that only the spoke selectors we expect are shown. At the same time,
- # we can also validate the status of each selector. This only validates the
- # initial state of everything. Once we start clicking on spokes, things are
- # going to change.
- # FIXME: This encodes default information.
- for selector in selectors:
- if selector.name == "ROOT PASSWORD":
- self.assertEqual(selector.description, "Root password is not set")
- elif selector.name == "USER CREATION":
- self.assertEqual(selector.description, "No user will be created")
- else:
- self.fail("Invalid spoke selector shown on livecd: %s" % selector.name)
-
- def _timer_expired(self, signum, frame):
- self.fail("anaconda did not finish in 30 minutes")
-
- def _run(self):
- # Before doing anything, verify we are still on the summary hub.
- self.check_window_displayed("INSTALLATION SUMMARY")
- # All spokes should have been visited and satisfied now.
- self.check_no_warning_bar()
- self.check_begin_installation_button()
-
- # Click the begin installation button, wait a moment, and now we should
- # be on the progress hub.
- self.click_button("Begin Installation")
- self.check_window_displayed("CONFIGURATION")
-
- self.check_shown_spoke_selectors()
- self.check_warning_bar()
-
- # Now we need to wait for installation to finish. We're doing that two ways:
- # (1) Set a 30 minute timeout. Should we hit that, anaconda's clearly not
- # going to finish (or is hung or something) and we should fail.
- # (2) Poll the UI waiting for the "Complete!" message to pop up. Once
- # that happens, we know it's time to test the user settings stuff and
- # the end of the UI.
- signal.signal(signal.SIGALRM, self._timer_expired)
- signal.alarm(30*60)
-
- while True:
- label = self.find("Complete!")
- if label:
- signal.alarm(0)
- break
-
- doDelay(20)
-
- # If we got here, installation completed successfully. Since we've not
- # done a password or created a user yet, we still have to do that. The
- # finish configuration button should still be insensitive.
- button = self.find("Finish configuration", "push button")
- self.assertIsNotNone(button, msg="Finish configuration button not found")
- self.assertFalse(button.sensitive, msg="Finish Configuration button should not be sensitive")
-
-class LiveCDFinishTestCase(UITestCase):
- def check_finish_config_button(self):
- # Click the Finish Configuration button.
- self.click_button("Finish configuration")
-
- def _timer_expired(self, signum, frame):
- self.fail("anaconda did not finish in 5 minutes")
-
- def _run(self):
- # Before doing anything, verify we are still on the progress hub.
- self.check_window_displayed("CONFIGURATION")
-
- self.check_finish_config_button()
- # We've completed configuration, so the warning bar should be gone.
- self.check_no_warning_bar()
-
- # And now we wait for configuration to finish. Then we check the
- # reboot button, but don't click it. The end of the test case shuts
- # down the system for us.
- signal.signal(signal.SIGALRM, self._timer_expired)
- signal.alarm(5*60)
-
- while True:
- button = self.find("Quit", "push button")
- if button:
- signal.alarm(0)
- break
-
- doDelay(20)
-
- self.click_button("Quit")
diff --git a/tests/gui/inside/rootpassword.py b/tests/gui/inside/rootpassword.py
deleted file mode 100644
index c703e8a..0000000
--- a/tests/gui/inside/rootpassword.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from dogtail.utils import doDelay
-
-from . import UITestCase
-
-class BasicRootPasswordTestCase(UITestCase):
- def check_enter_password(self):
- # The warning bar starts off telling us there's no password set.
- self.check_warning_bar("The password is empty")
-
- entry = self.find("Password", "text")
- self.assertIsNotNone(entry, msg="Password entry should be displayed")
- entry.grabFocus()
- entry.text = "asdfasdf"
-
- # That wasn't a very good password and we haven't confirmed it, so the
- # bar is still displayed at the bottom.
- doDelay(1)
- self.check_warning_bar("it does not contain enough DIFFERENT characters")
-
- # Let's confirm that terrible password.
- entry = self.find("Confirm Password", "text")
- self.assertIsNotNone(entry, msg="Confirm password should be displayed")
- entry.grabFocus()
- entry.text = "asdfasdf"
-
- # But of course it's still a terrible password, so the bar is still
- # displayed at the bottom.
- doDelay(1)
- self.check_warning_bar("it does not contain enough DIFFERENT characters")
-
- def check_click_done(self):
- # Press the Done button once, which won't take us anywhere but will change the
- # warning label at the bottom.
- self.click_button("_Done")
- self.check_warning_bar("Press Done again")
-
- # Pressing Done again should take us back to the progress hub.
- self.exit_spoke(hubName="CONFIGURATION")
-
- def _run(self):
- # First, we need to click on the spoke selector.
- self.enter_spoke("ROOT PASSWORD")
-
- # Now, verify we are on the right screen.
- self.check_window_displayed("ROOT PASSWORD")
-
- # And now we can check everything else on the screen.
- self.check_enter_password()
- self.check_click_done()
diff --git a/tests/gui/inside/storage.py b/tests/gui/inside/storage.py
deleted file mode 100644
index 28768dd..0000000
--- a/tests/gui/inside/storage.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from dogtail.predicate import GenericPredicate
-
-from . import UITestCase
-
-class BasicStorageTestCase(UITestCase):
- def check_select_disks(self):
- # FIXME: This is a really roundabout way of determining whether a disk is
- # selected or not. For some reason when a DiskOverview is selected, its icon
- # loses the name "Hard Disk". For now, we can use this to check.
- def _selected(do):
- return len(do.findChildren(GenericPredicate(name="Hard Disk"))) == 0
-
- # A real disk is any disk attached to the VM that's not the special 10 MB
- # one used for communicating in and out of the VM. Therefore, scan all
- # children of the DiskOverview looking for one whose name contains that
- # size.
- def _real_disk(do):
- for child in do.findChildren(GenericPredicate()):
- if child.name.startswith("10."):
- return False
-
- return True
-
- # There should be some disks displayed on the screen.
- overviews = self.ana.findChildren(GenericPredicate(roleName="disk overview"))
- self.assertGreater(len(overviews), 0, msg="No disks are displayed")
-
- if len(overviews) == 1:
- # Only one disk was given to this test case, so anaconda selected it
- # by default. Verify. Not sure how this would happen with how
- # testing is currently done, but it's good to be prepared.
- self.assertTrue(_selected(overviews[0]))
- else:
- # More than one disk was provided, so anaconda did not select any.
- # Let's select all disks and proceed.
- for overview in filter(_real_disk, overviews):
- self.assertFalse(_selected(overview))
- overview.click()
- self.assertTrue(_selected(overview))
-
- def check_shopping_cart(self):
- pass
-
- def check_storage_options(self):
- button = self.find("Automatically configure partitioning.", "radio button")
- self.assertIsNotNone(button, msg="Autopart button not found")
- self.assertTrue(button.checked, msg="Autopart should be selected")
-
- button = self.find("I would like to make additional space available.", "check box")
- self.assertIsNotNone(button, msg="Reclaim button not found")
- self.assertFalse(button.checked, msg="Reclaim button should not be selected")
-
- button = self.find("Encrypt my data.", "check box")
- self.assertIsNotNone(button, msg="Encrypt button not found")
- self.assertFalse(button.checked, msg="Encrypt button should not be selected")
-
- def _run(self):
- # First, we need to click on the network spoke selector.
- self.enter_spoke("INSTALLATION DESTINATION")
-
- # Now verify we are on the right screen.
- self.check_window_displayed("INSTALLATION DESTINATION")
-
- # Given that we attach a second disk to the system (for storing the test
- # suite and results), anaconda will not select disks by default. Thus,
- # the storage options panel should currently be insensitive.
- area = self.find("Storage Options")
- self.assertIsNotNone(area, "Storage Options not found")
- self.assertFalse(area.sensitive, msg="Storage options should be insensitive")
-
- # Select disk overviews. In the basic case, this means uninitialized
- # disks that we're going to do autopart on.
- self.check_select_disks()
-
- # And now with disks selected, the storage options should be sensitive.
- self.assertTrue(area.sensitive, msg="Storage options should be sensitive")
-
- self.check_shopping_cart()
- self.check_storage_options()
-
- # And then we click the Done button which should take the user right back to
- # the hub. There's no need to display any other dialogs given that this is
- # an install against empty disks and no other options were checked.
- self.exit_spoke()
diff --git a/tests/gui/inside/summary.py b/tests/gui/inside/summary.py
deleted file mode 100644
index 46c25ab..0000000
--- a/tests/gui/inside/summary.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-from dogtail.predicate import GenericPredicate
-from dogtail.utils import doDelay
-
-from . import UITestCase
-
-# This test case handles the livecd case on the summary hub where everything
-# works as intended. On this spoke, we are testing the following:
-#
-# * Clicking the Quit button brings up a dialog asking if you're sure, though
-# we're not going to test that confirming actually quits.
-# * The Begin Installation button is insensitive, since no disks have yet
-# been selected.
-# * Only the Date & Time, Keyboard, Installation Destination, and Network Config
-# spoke selectors are visible.
-
-class LiveCDSummaryTestCase(UITestCase):
- def check_quit_button(self):
- self.click_button("Quit")
- self.check_dialog_displayed("Quit")
- self.click_button("No")
-
- def check_begin_installation_button(self):
- button = self.find("Begin Installation", "push button")
- self.assertIsNotNone(button, msg="Begin Installation button not found")
- self.assertTrue(button.showing, msg="Begin Installation button should be displayed")
- self.assertFalse(button.sensitive, msg="Begin Installation button should not be sensitive")
-
- def check_shown_spoke_selectors(self):
- # FIXME: This forces English.
- validSelectors = ["DATE & TIME", "KEYBOARD", "INSTALLATION DESTINATION", "NETWORK & HOSTNAME"]
- selectors = self.ana.findChildren(GenericPredicate(roleName="spoke selector"))
-
- self.assertEqual(len(selectors), len(validSelectors), msg="Incorrect number of spoke selectors shown")
-
- # Validate that only the spoke selectors we expect are shown. At the same time,
- # we can also validate the status of each selector. This only validates the
- # initial state of everything. Once we start clicking on spokes, things are
- # going to change.
- # FIXME: This encodes default information.
- for selector in selectors:
- if selector.name == "DATE & TIME":
- self.assertEqual(selector.description, "Americas/New York timezone")
- elif selector.name == "KEYBOARD":
- self.assertEqual(selector.description, "English (US)")
- elif selector.name == "INSTALLATION DESTINATION":
- # We don't know how many disks are going to be involved - if there's
- # just one, anaconda selects it by default. If there's more than
- # one, it selects none.
- self.assertIn(selector.description, ["Automatic partitioning selected",
- "No disks selected"])
- elif selector.name == "NETWORK & HOSTNAME":
- self.assertRegexpMatches(selector.description, "Wired (.+) connected")
- else:
- self.fail("Invalid spoke selector shown on livecd: %s" % selector.name)
-
- def _run(self):
- # Before doing anything, verify we are on the right screen.
- doDelay(5)
- self.check_window_displayed("INSTALLATION SUMMARY")
-
- # And now we can check everything else on the screen.
- self.check_quit_button()
- self.check_begin_installation_button()
- self.check_shown_spoke_selectors()
- self.check_warning_bar()
diff --git a/tests/gui/inside/user.py b/tests/gui/inside/user.py
deleted file mode 100644
index 137ed90..0000000
--- a/tests/gui/inside/user.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from . import UITestCase
-
-class BasicUserTestCase(UITestCase):
- def check_enter_name(self):
- entry = self.find("Full Name", "text")
- self.assertIsNotNone(entry, msg="Full name entry not found")
- entry.grabFocus()
- entry.text = "Bobby Good User"
-
- # We base the username on the full name entered
- entry = self.find("Username", "text")
- self.assertIsNotNone(entry, msg="Username entry not found")
- self.assertEqual(entry.text, "buser", msg="Generated username does not match expectation")
-
- def check_enter_password(self):
- # The warning bar starts off telling us there's no password set.
- self.check_warning_bar("The password is empty")
-
- entry = self.find("Password", "text")
- self.assertIsNotNone(entry, msg="Password entry should be displayed")
- entry.grabFocus()
- entry.text = "asdfasdf"
-
- # That wasn't a very good password and we haven't confirmed it, so the
- # bar is still displayed at the bottom.
- self.check_warning_bar("it does not contain enough DIFFERENT characters")
-
- # Let's confirm that terrible password.
- entry = self.find("Confirm Password", "text")
- self.assertIsNotNone(entry, msg="Confirm password should be displayed")
- entry.grabFocus()
- entry.text = "asdfasdf"
-
- # But of course it's still a terrible password, so the bar is still
- # displayed at the bottom.
- self.check_warning_bar("it does not contain enough DIFFERENT characters")
-
- def check_click_done(self):
- # Press the Done button once, which won't take us anywhere but will change the
- # warning label at the bottom.
- self.click_button("_Done")
- self.check_warning_bar("Press Done again")
-
- # Pressing Done again should take us back to the progress hub.
- self.exit_spoke(hubName="CONFIGURATION")
-
- def _run(self):
- # First, we need to click on the spoke selector.
- self.enter_spoke("USER CREATION")
-
- # Now, verify we are on the right screen.
- self.check_window_displayed("CREATE USER")
-
- # And now we can check everything else on the screen.
- self.check_enter_name()
- self.check_enter_password()
- self.check_click_done()
diff --git a/tests/gui/inside/welcome.py b/tests/gui/inside/welcome.py
deleted file mode 100644
index 86dae38..0000000
--- a/tests/gui/inside/welcome.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-from . import UITestCase
-
-# This test case handles the basic case on the welcome language spoke where
-# everything works as intended. On this spoke, we are testing the following:
-#
-# * The default language and locale are selected and displayed at the top
-# of their views.
-# * Clicking the Quit button brings up a dialog asking if you're sure, though
-# we're not going to test that confirming actually quits.
-# * Clicking the Continue button brings up the betanag dialog, though we're
-# not going to test the quit button there either.
-#
-# TODO:
-# * Entering text into the search box should result in narrowing down the
-# contents of the left hand view.
-
-class BasicWelcomeTestCase(UITestCase):
- def check_lang_locale_views(self):
- # FIXME: This encodes default information.
-# lang = "English"
-# locale = "English (United States)"
-
- return
-# self.assertEqual(ldtp.verifytablecell("frmWelcome", "tblLanguages", 0, 0, lang), 1,
-# msg="Default language (%s) is not selected" % lang)
-# self.assertEqual(ldtp.verifytablecell("frmWelcome", "tblLocales", 0, 0, locale), 1,
-# msg="Default locale (%s) is not selected")
-
- def check_quit_button(self):
- self.click_button("_Quit")
- self.check_dialog_displayed("Quit")
- self.click_button("No")
-
- def check_continue_button(self):
- self.click_button("_Continue")
- self.check_dialog_displayed("Beta Warn")
- self.click_button("I accept my fate.")
-
- def _run(self):
- # Before doing anything, verify we are on the right screen.
- self.check_window_displayed("WELCOME")
-
- # And now we can check everything else on the screen.
- self.check_keyboard_layout_indicator("us")
- self.check_lang_locale_views()
- self.check_quit_button()
- self.check_continue_button()
diff --git a/tests/gui/make_livecd.sh b/tests/gui/make_livecd.sh
deleted file mode 100755
index 0709a11..0000000
--- a/tests/gui/make_livecd.sh
+++ /dev/null
@@ -1,89 +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 at redhat.com>
-
-if [[ $# != 3 ]]; then
- echo "usage: $0 <boot.iso> <resultdir> <repo URL>"
- exit 1
-fi
-
-if [ ! -f "$1" ]; then
- echo "Required boot.iso does not exist."
- exit 2
-fi
-
-if [ -d "$2" ]; then
- echo "results dir should not already exist."
- exit 3
-fi
-
-if [ ! -e /usr/share/lorax ]; then
- echo "Required lorax templates do not exist. Install the lorax package?"
- exit 4
-fi
-
-if [ ! -e anaconda-autogui-testing.ks ]; then
- echo "anaconda-autogui-testing.ks not found."
- exit 5
-fi
-
-ISO="$1"
-RESULTSDIR="$2"
-REPO="$3"
-
-# While we can remove a lot of the dumb defaults we inherit from the spin
-# kickstart files by overriding them with other kickstart commands, some
-# things we can't. The following sed lines take care of these:
-#
-# (1) Remove the first two / partitions we inherit.
-# (2) Remove rawhide as a repo because it's already the installation source.
-# (3) Don't remove /boot/initramfs*. Do what now?
-ksflatten -c anaconda-autogui-testing.ks | sed -e '\|part /.*--size=3.*|,+1 d' \
- -e '/repo --name="rawhide"/ d' \
- -e '/^# save a little/,+1 d' > livecd.ks
-
-# Add a repo location for the updated anaconda RPMs.
-echo -e "\nrepo --name=updated-anaconda --baseurl=${REPO}\n" >> livecd.ks
-
-# And then we want to use our own lorax template files in order to adjust
-# the boot configuration:
-#
-# (1) Shorten the timeout by a bunch.
-# (2) Change the default boot target away from media check.
-TEMPLATES=$(mktemp -d)
-cp -r /usr/share/lorax/* ${TEMPLATES}
-sed -i -e 's/timeout 600/timeout 60/' \
- -e '/label linux/ a\
- menu default' \
- -e '/menu default/ d' ${TEMPLATES}/live/config_files/x86/isolinux.cfg
-
-livemedia-creator --make-iso \
- --iso "${ISO}" \
- --title Fedora \
- --project Fedora \
- --releasever 21 \
- --tmp /var/tmp \
- --resultdir "${RESULTSDIR}" \
- --ks livecd.ks \
- --vnc vnc \
- --lorax-templates ${TEMPLATES} \
- --ram 2048 \
- --vcpus 2
-rm livecd.ks
-rm -r ${TEMPLATES}
diff --git a/tests/gui/outside/__init__.py b/tests/gui/outside/__init__.py
deleted file mode 100644
index 4a1d9fc..0000000
--- a/tests/gui/outside/__init__.py
+++ /dev/null
@@ -1,294 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-__all__ = ["Creator", "OutsideMixin"]
-
-import blivet
-
-from contextlib import contextmanager
-import os
-import shutil
-import subprocess
-import tempfile
-import unittest
-import errno
-
-# Copied from python's subprocess.py
-def eintr_retry_call(func, *args):
- """Retry an interruptible system call if interrupted."""
- while True:
- try:
- return func(*args)
- except (OSError, IOError) as e:
- if e.errno == errno.EINTR:
- continue
- raise
-
-class Creator(object):
- """A Creator subclass defines all the parameters for making a VM to run a
- test against as well as handles creating and running that VM, inspecting
- results, and managing temporary data.
-
- Most Creator subclasses will only need to define the following four
- attributes:
-
- drives -- A list of tuples describing disk images to create. Each
- tuple is the name and size, in GB.
- environ -- A dictionary of environment variables that should be added
- to the environment the test suite will run under.
- name -- A unique string that names a Creator. This name will
- be used in creating the results directory (and perhaps
- other places in the future) so make sure it doesn't
- conflict with another object.
- reqMemory -- The amount of memory this VM needs, in MB. The default
- is 2048, which seems to be the minimum required to
- make things run quickly. Redefine if you need more.
- tests -- A list of tuples describing which test cases make up
- this test. Each tuple is the name of the module
- containing the test case (minus the leading "inside."
- and the name of the test case class. Tests will be
- run in the order provided.
- """
- drives = []
- environ = {}
- name = "Creator"
- reqMemory = 2048
- tests = []
-
- def __init__(self):
- self._drivePaths = {}
- self._mountpoint = None
- self._proc = None
- self._tempdir = None
-
- def archive(self):
- """Copy all log files and other test results to a subdirectory of the
- given resultsdir. If logs are no longer available, this method
- does nothing. It is up to the caller to make sure logs are available
- beforehand and clean up afterwards.
- """
- from testconfig import config
-
- if not os.path.ismount(self.mountpoint):
- return
-
- shutil.copytree(self.mountpoint + "/result", config["resultsdir"] + "/" + self.name)
-
- def cleanup(self):
- """Remove all disk images used during this test case and the temporary
- directory they were stored in.
- """
- shutil.rmtree(self.tempdir, ignore_errors=True)
- os.unlink(self._drivePaths["suite"])
-
- def die(self):
- """Kill any running qemu process previously started by this test."""
- if self._proc:
- self._proc.kill()
- self._proc = None
-
- def makeDrives(self):
- """Create all hard drive images associated with this test. Images
- must be listed in Creator.drives and will be stored in a temporary
- directory this method creates. It is up to the caller to remove
- everything later by calling Creator.cleanup.
- """
- for (drive, size) in self.drives:
- (fd, diskimage) = tempfile.mkstemp(dir=self.tempdir)
- eintr_retry_call(os.close, fd)
-
- subprocess.call(["/usr/bin/qemu-img", "create", "-f", "qcow2", diskimage, "%sG" % size],
- stdout=open("/dev/null", "w"))
- self._drivePaths[drive] = diskimage
-
- @property
- def template(self):
- with open("outside/template.py", "r") as f:
- return f.read()
-
- def makeSuite(self):
- """The suite is a small disk image attached to every test VM automatically
- by the test framework. It includes all the inside/ stuff, a special
- suite.py file that will be automatically run by the live CD (and is
- what actually runs the test), and a directory structure for reporting
- results.
-
- It is mounted under Creator.mountpoint as needed.
-
- This method creates the suite image and adds it to the internal list of
- images associated with this test.
-
- Note that because this image is attached to the VM, anaconda will always
- see two hard drives and thus will never automatically select disks.
- Note also that this means tests must be careful to not select this
- disk.
- """
- from testconfig import config
-
- # First, create a disk image and put a filesystem on it.
- b = blivet.Blivet()
-
- # pylint: disable=undefined-variable
- disk1_path = blivet.util.create_sparse_tempfile("suite", blivet.size.Size("11 MB"))
- b.config.diskImages["suite"] = disk1_path
-
- b.reset()
-
- try:
- disk1 = b.devicetree.getDeviceByName("suite")
- b.initializeDisk(disk1)
-
- part = b.newPartition(size=blivet.size.Size("10 MB"), parents=[disk1])
- b.createDevice(part)
-
- fmt = blivet.formats.getFormat("ext4", label="ANACTEST", mountpoint=self.mountpoint)
- b.formatDevice(part, fmt)
-
- blivet.partitioning.doPartitioning(b)
- b.doIt()
-
- fmt.mount()
-
- # Create the directory structure needed for storing results.
- os.makedirs(self.mountpoint + "/result/anaconda")
-
- # Copy all the inside stuff into the mountpoint.
- shutil.copytree("inside", self.mountpoint + "/inside")
-
- # Create the suite file, which contains all the test cases to run and is how
- # the VM will figure out what to run.
- with open(self.mountpoint + "/suite.py", "w") as f:
- imports = map(lambda (path, cls): " from inside.%s import %s" % (path, cls), self.tests)
- addtests = map(lambda (path, cls): " s.addTest(%s())" % cls, self.tests)
-
- f.write(self.template % {"environ": " os.environ.update(%s)" % self.environ,
- "imports": "\n".join(imports),
- "addtests": "\n".join(addtests),
- "anacondaArgs": config.get("anacondaArgs", "").strip('"')})
- finally:
- # pylint: disable=undefined-variable
- b.devicetree.teardownDiskImages()
- shutil.rmtree(self.mountpoint)
-
- # This ensures it gets passed to qemu-kvm as a disk arg.
- self._drivePaths["suite"] = disk1_path
-
- @contextmanager
- def suiteMounted(self):
- """This context manager allows for wrapping code that needs to access the
- suite. It mounts the disk image beforehand and unmounts it afterwards.
- """
- if self._drivePaths.get("suite", "") == "":
- return
-
- b = blivet.Blivet()
- b.config.diskImages["suite"] = self._drivePaths["suite"]
- b.reset()
-
- disk = b.devicetree.getDeviceByName("suite")
- part = b.devicetree.getChildren(disk)[0]
- part.format.mountpoint = self.mountpoint
- part.format.mount()
-
- try:
- yield
- except:
- raise
- finally:
- part.format.unmount()
- # pylint: disable=undefined-variable
- b.devicetree.teardownDiskImages()
-
- def run(self):
- """Given disk images previously created by Creator.makeDrives and
- Creator.makeSuite, start qemu and wait for it to terminate.
- """
- from testconfig import config
-
- args = ["/usr/bin/qemu-kvm",
- "-vnc", "localhost:2",
- "-m", str(self.reqMemory),
- "-boot", "d",
- "-drive", "file=%s,media=cdrom" % config["liveImage"]]
-
- for drive in self._drivePaths.values():
- args += ["-drive", "file=%s,media=disk" % drive]
-
- # Save a reference to the running qemu process so we can later kill
- # it if necessary. For now, the only reason we'd want to kill it is
- # an expired timer.
- self._proc = subprocess.Popen(args)
- self._proc.wait()
- self._proc = None
-
- @property
- def mountpoint(self):
- """The directory where the suite is mounted. This is a subdirectory of
- Creator.tempdir, and it is assumed the mountpoint directory (though not
- the mount itself) exists throughout this test.
- """
- if not self._mountpoint:
- self._mountpoint = tempfile.mkdtemp(dir=self.tempdir)
-
- return self._mountpoint
-
- @property
- def tempdir(self):
- """The temporary directory used to store disk images and other data
- this test requires. This directory will be removed by Creator.cleanup.
- It is up to the caller to call that method, though.
- """
- if not self._tempdir:
- self._tempdir = tempfile.mkdtemp(prefix="%s-" % self.name, dir="/var/tmp")
-
- return self._tempdir
-
-class OutsideMixin(object):
- """A BaseOutsideTestCase subclass is the interface between the unittest framework
- and a running VM. It interfaces with an associated Creator object to create
- devices and fire up a VM, and also handles actually reporting a result that
- unittest knows how to process.
-
- Each subclass will likely only want to define a single attribute:
-
- creatorClass -- A Creator subclass that goes with this test.
- """
- creatorClass = None
-
- def archive(self):
- self.creator.archive()
-
- def runTest(self):
- self.creator.run()
-
- with self.creator.suiteMounted():
- self.assertTrue(os.path.exists(self.creator.mountpoint + "/result"),
- msg="results directory does not exist")
- self.archive()
- self.assertFalse(os.path.exists(self.creator.mountpoint + "/result/unittest-failures"),
- msg="automated UI test %s failed" % self.creator.name)
-
- def setUp(self):
- # pylint: disable=not-callable
- self.creator = self.creatorClass()
- self.creator.makeDrives()
- self.creator.makeSuite()
-
- def tearDown(self):
- self.creator.cleanup()
diff --git a/tests/gui/outside/template.py b/tests/gui/outside/template.py
deleted file mode 100644
index 9ef47b3..0000000
--- a/tests/gui/outside/template.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# pylint: skip-file
-#
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-# This code template ends up being the special suite.py file referred to in the
-# Creator.makeSuite documentation. It lives in the suite disk image and is
-# automatically started by the live CD on boot (see the kickstart file for where
-# this happens). Basically, this is responsible for doing everything inside the
-# VM - it runs the test suite, figures out whether it failed or not, puts results
-# in place, and reboots.
-
-from dogtail import utils
-utils.enableA11y()
-
-import glob
-import os
-import shlex
-import shutil
-import traceback
-import unittest
-
-class UITestSuite(unittest.TestSuite):
- def run(self, *args, **kwargs):
- utils.run("liveinst %(anacondaArgs)s")
- unittest.TestSuite.run(self, *args, **kwargs)
-
-def suite():
-%(imports)s
-
- s = UITestSuite()
-%(addtests)s
- return s
-
-if __name__ == "__main__":
-%(environ)s
-
- s = suite()
- result = unittest.TextTestRunner(verbosity=2, failfast=True).run(s)
-
- try:
- if not result.wasSuccessful():
- with open("/mnt/anactest/result/unittest-failures", "w") as f:
- for (where, what) in result.errors + result.failures:
- f.write(str(where) + "\n" + str(what) + "\n")
-
- f.close()
-
- for log in glob.glob("/tmp/*.log"):
- shutil.copy(log, "/mnt/anactest/result/anaconda/")
-
- # anaconda writes out traceback files with restricted permissions, so
- # we have to go out of our way to grab them.
- for tb in glob.glob("/tmp/anaconda-tb-*"):
- os.system("sudo cp " + tb + " /mnt/anactest/result/anaconda/")
- except:
- # If anything went wrong with the above, log it and quit. We need
- # this VM to always turn off so we can inspect what happened.
- with open("/mnt/anactest/result/unittest-failures", "w+") as f:
- traceback.print_exc(file=f)
- f.close()
-
- os.system("poweroff")
diff --git a/tests/gui/outside/test_simplelivecd.py b/tests/gui/outside/test_simplelivecd.py
deleted file mode 100644
index 7f9c485..0000000
--- a/tests/gui/outside/test_simplelivecd.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2014 Red Hat, Inc.
-#
-# This program 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-__all__ = ["SimpleLiveCDCreator", "SimpleLiveCD_OutsideTest"]
-
-from . import Creator, OutsideMixin
-import unittest
-
-class SimpleLiveCDCreator(Creator):
- drives = [("one", 8)]
- name = "simplelivecd"
- tests = [("welcome", "BasicWelcomeTestCase"),
- ("summary", "LiveCDSummaryTestCase"),
- ("date_time", "LiveCDDateTimeTestCase"),
- ("keyboard", "BasicKeyboardTestCase"),
- ("storage", "BasicStorageTestCase"),
- ("network", "LiveCDNetworkTestCase"),
- ("progress", "LiveCDProgressTestCase"),
- ("rootpassword", "BasicRootPasswordTestCase"),
- ("progress", "LiveCDFinishTestCase")]
-
-class SimpleLiveCD_OutsideTest(OutsideMixin, unittest.TestCase):
- creatorClass = SimpleLiveCDCreator
diff --git a/tests/gui/run_gui_tests.sh b/tests/gui/run_gui_tests.sh
deleted file mode 100755
index b170f4b..0000000
--- a/tests/gui/run_gui_tests.sh
+++ /dev/null
@@ -1,81 +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 at redhat.com>
-
-function doit() {
- ARGS="-s \
- -v \
- --nologcapture \
- --tc=resultsdir:$(mktemp -d --tmpdir=$(pwd) autogui-results-XXXXXX) \
- --tc=liveImage:$1"
-
- if [ -z "$2" ]; then
- nosetests ${ARGS} outside
- else
- nosetests ${ARGS} "${2}" outside
- fi
-}
-
-# We require the test_config plugin for nose, which is not currently packaged
-# but is installable via pip.
-if [ -z "$(nosetests -p | grep test_config)" ]; then
- exit 99
-fi
-
-# Have to be root to run this test, as it requires creating disk iamges.
-if [ ${EUID} != 0 ]; then
- exit 77
-fi
-
-# The livecd location can come from one of two different places:
-# (1) $TEST_LIVECD, if this script is being called from "make check"
-# (2) The command line, if this script is being called directly.
-if [[ "${TEST_LIVECD}" != "" ]]; then
- LIVECD=${TEST_LIVECD}
-elif [[ $# != 0 ]]; then
- LIVECD=$1
- shift
-else
- echo "usage: $0 <livecd.iso> [anaconda args...]"
- exit 1
-fi
-
-if [ ! -e "${LIVECD}" ]; then
- echo "Required live CD image does not exist."
- exit 2
-fi
-
-if [[ "${TEST_ANACONDA_ARGS}" != "" ]]; then
- EXTRA="--tc=anacondaArgs:\"${TEST_ANACONDA_ARGS}\""
-elif [[ $# != 0 ]]; then
- EXTRA="--tc=anacondaArgs:\"$*\""
-else
- EXTRA=""
-fi
-
-# If we're being called from "make check", we will be outside the gui test directory.
-# Unfortunately, everything is written assuming that's where we will be. So cd there.
-if [ -d gui ]; then
- ( cd gui && doit ${LIVECD} "${EXTRA}" )
-elif [ -d outside ]; then
- doit ${LIVECD} "${EXTRA}"
-else
- echo "Could not find test contents"
- exit 3
-fi
--
2.2.2
More information about the anaconda-patches
mailing list