diff --git a/checkbox-support/checkbox_support/scripts/run_watcher.py b/checkbox-support/checkbox_support/scripts/run_watcher.py index 376c159977..ede02a8ee7 100644 --- a/checkbox-support/checkbox_support/scripts/run_watcher.py +++ b/checkbox-support/checkbox_support/scripts/run_watcher.py @@ -11,7 +11,6 @@ import argparse import logging import os -import pathlib import re import select import sys @@ -21,11 +20,17 @@ from checkbox_support.helpers.timeout import timeout from checkbox_support.scripts.zapper_proxy import zapper_run +from checkbox_support.scripts.usb_read_write import ( + mount_usb_storage, + gen_random_file, + write_test, + read_test, +) -logger = logging.getLogger(__file__) +logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) -logger.addHandler(logging.StreamHandler(sys.stdout)) + ACTION_TIMEOUT = 30 @@ -67,10 +72,12 @@ class StorageWatcher(StorageInterface): function to detect the insertion and removal of storage. """ - def __init__(self, testcase, storage_type, zapper_usb_address): - self.testcase = testcase + def __init__(self, storage_type, zapper_usb_address): self.storage_type = storage_type self.zapper_usb_address = zapper_usb_address + self.testcase = None + self.test_passed = False + self.mounted_partition = None def run(self): j = journal.Reader() @@ -106,6 +113,8 @@ def run(self): self._process_lines( [e["MESSAGE"] for e in j if e and "MESSAGE" in e] ) + if self.test_passed: + return def _process_lines(self, lines): """ @@ -121,52 +130,37 @@ def _process_lines(self, lines): elif self.testcase == "removal": self._parse_journal_line(line_str) self._validate_removal() - - def _store_storage_info(self, mounted_partition=""): - """ - Store the mounted partition info to the shared directory. - """ - - plainbox_session_share = os.environ.get("PLAINBOX_SESSION_SHARE") - # TODO: Should name the file by the value of storage_type variable as - # prefix. e.g. thunderbolt_insert_info, mediacard_insert_info. - # Since usb_insert_info is used by usb_read_write script, we - # should refactor usb_read_write script to adopt different files - file_name = "usb_insert_info" - - if not plainbox_session_share: - logger.error("no env var PLAINBOX_SESSION_SHARE") - sys.exit(1) - - # backup the storage partition info - if mounted_partition: - logger.info( - "cache file {} is at: {}".format( - file_name, plainbox_session_share - ) - ) - file_path = pathlib.Path(plainbox_session_share, file_name) - with open(file_path, "w") as file_to_share: - file_to_share.write(mounted_partition + "\n") - - def _remove_storage_info(self): - """Remove the file containing the storage info from the shared - directory. - """ - - plainbox_session_share = os.environ.get("PLAINBOX_SESSION_SHARE") - file_name = "usb_insert_info" - - if not plainbox_session_share: - logger.error("no env var PLAINBOX_SESSION_SHARE") - sys.exit(1) - - file_path = pathlib.Path(plainbox_session_share, file_name) - if pathlib.Path(file_path).exists(): - os.remove(file_path) - logger.info("cache file {} removed".format(file_name)) - else: - logger.error("cache file {} not found".format(file_name)) + if self.test_passed: + return + + @timeout(ACTION_TIMEOUT) # 30 seconds timeout + def run_insertion(self): + print("\n--------- Testing insertion ---------") + self.testcase = "insertion" + self.run() + print("\n------- Insertion test passed -------") + return self.mounted_partition + + @timeout(ACTION_TIMEOUT) # 30 seconds timeout + def run_removal(self, mounted_partition): + print("\n---------- Testing removal ----------") + self.testcase = "removal" + self.mounted_partition = mounted_partition + self.run() + print("\n-------- Removal test passed --------") + + def run_storage(self, mounted_partition): + print("\n--------- Testing read/write --------") + with gen_random_file() as random_file: + # initialize the necessary tasks before performing read/write test + print("Mounting the USB storage") + print(mounted_partition) + with mount_usb_storage(mounted_partition): + # write test + write_test(random_file) + # read test + read_test(random_file) + print("\n------- Read/Write test passed -------") class USBStorage(StorageWatcher): @@ -202,17 +196,12 @@ def _validate_insertion(self): else: sys.exit("Wrong USB type detected.") - # backup the storage info - self._store_storage_info(self.mounted_partition) - sys.exit() + self.test_passed = True def _validate_removal(self): if self.action == "removal": logger.info("Removal test passed.") - - # remove the storage info - self._remove_storage_info() - sys.exit() + self.test_passed = True def _parse_journal_line(self, line_str): """ @@ -284,18 +273,12 @@ def _validate_insertion(self): ) ) logger.info("Mediacard insertion test passed.") - - # backup the storage info - self._store_storage_info(self.mounted_partition) - sys.exit() + self.test_passed = True def _validate_removal(self): if self.action == "removal": logger.info("Mediacard removal test passed.") - - # remove the storage info - self._remove_storage_info() - sys.exit() + self.test_passed = True def _parse_journal_line(self, line_str): """ @@ -344,18 +327,12 @@ def _validate_insertion(self): if self.action == "insertion" and self.mounted_partition: logger.info("usable partition: {}".format(self.mounted_partition)) logger.info("Thunderbolt insertion test passed.") - - # backup the storage info - self._store_storage_info(self.mounted_partition) - sys.exit() + self.test_passed = True def _validate_removal(self): if self.action == "removal": logger.info("Thunderbolt removal test passed.") - - # remove the storage info - self._remove_storage_info() - sys.exit() + self.test_passed = True def _parse_journal_line(self, line_str): @@ -379,12 +356,15 @@ def _parse_journal_line(self, line_str): self.action = "removal" -def launch_watcher(): +def parse_args(): parser = argparse.ArgumentParser() parser.add_argument( "testcase", - choices=["insertion", "removal"], - help=("insertion or removal"), + choices=["insertion", "storage"], + help=( + "insertion: Tests insertion and removal of storage\n" + "storage: Tests insertion, read and write, and removal\n" + ), ) parser.add_argument( "storage_type", @@ -396,27 +376,33 @@ def launch_watcher(): type=str, help="Zapper's USB switch address to use", ) - args = parser.parse_args() + return parser.parse_args() + + +def main(): + args = parse_args() watcher = None if args.storage_type == "thunderbolt": watcher = ThunderboltStorage( - args.testcase, args.storage_type, args.zapper_usb_address + args.storage_type, args.zapper_usb_address ) elif args.storage_type == "mediacard": - watcher = MediacardStorage( - args.testcase, args.storage_type, args.zapper_usb_address - ) + watcher = MediacardStorage(args.storage_type, args.zapper_usb_address) else: - watcher = USBStorage( - args.testcase, args.storage_type, args.zapper_usb_address - ) - watcher.run() - - -@timeout(ACTION_TIMEOUT) # 30 seconds timeout -def main(): - launch_watcher() + watcher = USBStorage(args.storage_type, args.zapper_usb_address) + + if args.testcase == "insertion": + mounted_partition = watcher.run_insertion() + watcher.run_removal(mounted_partition) + elif args.testcase == "storage": + mounted_partition = watcher.run_insertion() + watcher.run_storage(mounted_partition) + print("Press Enter to start removal", flush=True) + input() + watcher.run_removal(mounted_partition) + else: + raise SystemExit("Invalid test case") if __name__ == "__main__": diff --git a/checkbox-support/checkbox_support/tests/test_run_watcher.py b/checkbox-support/checkbox_support/tests/test_run_watcher.py index 1163783a18..52803efe18 100644 --- a/checkbox-support/checkbox_support/tests/test_run_watcher.py +++ b/checkbox-support/checkbox_support/tests/test_run_watcher.py @@ -20,7 +20,7 @@ import unittest from unittest.mock import patch, call, MagicMock, mock_open -import pathlib +import argparse from systemd import journal from checkbox_support.scripts.run_watcher import ( @@ -28,15 +28,17 @@ USBStorage, MediacardStorage, ThunderboltStorage, - launch_watcher, + parse_args, + main, ) +from checkbox_support.helpers.timeout import mock_timeout class TestRunWatcher(unittest.TestCase): @patch("systemd.journal.Reader") @patch("select.poll") - def test_storage_watcher_run_insertion(self, mock_poll, mock_journal): + def test_storage_watcher_run_with_insertion(self, mock_poll, mock_journal): mock_journal.return_value.process.side_effect = [journal.APPEND, None] mock_journal.return_value.__iter__.return_value = [ {"MESSAGE": "line1"} @@ -48,12 +50,20 @@ def test_storage_watcher_run_insertion(self, mock_poll, mock_journal): # Test insertion mock_storage_watcher.testcase = "insertion" + with patch("builtins.print") as mock_print: + StorageWatcher.run(mock_storage_watcher) + mock_print.assert_has_calls( + [ + call("\n\nINSERT NOW\n\n", flush=True), + call("Timeout: 30 seconds", flush=True), + ] + ) StorageWatcher.run(mock_storage_watcher) mock_storage_watcher._process_lines.assert_called_with(["line1"]) @patch("systemd.journal.Reader") @patch("select.poll") - def test_storage_watcher_run_removal(self, mock_poll, mock_journal): + def test_storage_watcher_run_with_removal(self, mock_poll, mock_journal): mock_journal.return_value.process.return_value = journal.APPEND mock_journal.return_value.__iter__.return_value = [ {"MESSAGE": "line1"} @@ -65,21 +75,30 @@ def test_storage_watcher_run_removal(self, mock_poll, mock_journal): # Test removal mock_storage_watcher.testcase = "removal" - StorageWatcher.run(mock_storage_watcher) + with patch("builtins.print") as mock_print: + StorageWatcher.run(mock_storage_watcher) + mock_print.assert_has_calls( + [ + call("\n\nREMOVE NOW\n\n", flush=True), + call("Timeout: 30 seconds", flush=True), + ] + ) mock_storage_watcher._process_lines.assert_called_with(["line1"]) def test_storage_watcher_run_invalid_testcase(self): mock_storage_watcher = MagicMock() mock_storage_watcher.testcase = "invalid" + mock_storage_watcher.zapper_usb_address = "" - with self.assertRaises(SystemExit): + with self.assertRaises(SystemExit) as cm: StorageWatcher.run(mock_storage_watcher) + self.assertEqual(cm.exception.args[0], "Invalid test case") @patch("systemd.journal.Reader") @patch("select.poll") @patch("os.environ.get") @patch("checkbox_support.scripts.run_watcher.zapper_run") - def test_storage_watcher_run_insertion_with_zapper( + def test_storage_watcher_run_with_insertion_with_zapper( self, mock_zapper_run, mock_get, mock_poll, mock_journal ): mock_journal.return_value.process.return_value = journal.APPEND @@ -104,7 +123,7 @@ def test_storage_watcher_run_insertion_with_zapper( @patch("select.poll") @patch("os.environ.get") @patch("checkbox_support.scripts.run_watcher.zapper_run") - def test_storage_watcher_run_removal_with_zapper( + def test_storage_watcher_run_with_removal_with_zapper( self, mock_zapper_run, mock_get, mock_poll, mock_journal ): mock_journal.return_value.process.return_value = journal.APPEND @@ -125,12 +144,32 @@ def test_storage_watcher_run_removal_with_zapper( ) mock_storage_watcher._process_lines.assert_called_with(["line1"]) + @patch("systemd.journal.Reader") + @patch("select.poll") + def test_storage_watcher_run_not_passed(self, mock_poll, mock_journal): + mock_journal.return_value.process.return_value = journal.APPEND + mock_journal.return_value.__iter__.return_value = [ + {"MESSAGE": "line1"} + ] + mock_poll.return_value.poll.side_effect = [True, False] + + mock_storage_watcher = MagicMock() + mock_storage_watcher.zapper_usb_address = "" + mock_storage_watcher.test_passed = False + + # Test not passed + mock_storage_watcher.testcase = "insertion" + mock_storage_watcher.test_passed = False + StorageWatcher.run(mock_storage_watcher) + mock_storage_watcher._process_lines.assert_called_with(["line1"]) + def test_storage_watcher_process_lines_insertion(self): lines = ["line1", "line2", "line3"] mock_insertion_watcher = MagicMock() mock_insertion_watcher._parse_journal_line = MagicMock() mock_insertion_watcher.testcase = "insertion" + mock_insertion_watcher.test_passed = False StorageWatcher._process_lines(mock_insertion_watcher, lines) mock_insertion_watcher._parse_journal_line.assert_has_calls( [call("line1"), call("line2"), call("line3")] @@ -142,75 +181,66 @@ def test_storage_watcher_process_lines_removal(self): mock_removal_watcher = MagicMock() mock_removal_watcher._parse_journal_line = MagicMock() mock_removal_watcher.testcase = "removal" + mock_removal_watcher.test_passed = False StorageWatcher._process_lines(mock_removal_watcher, lines) mock_removal_watcher._parse_journal_line.assert_has_calls( [call("line1"), call("line2"), call("line3")] ) - @patch("os.environ.get") - def test_storage_watcher_store_storage_info(self, mock_get): - mock_storage_watcher = MagicMock() - mock_get.return_value = "/tmp" + def test_storage_watcher_process_lines_passed(self): + lines = ["line1", "line2", "line3"] - mock_storage_watcher.storage_type = "usb2" - mounted_partition = "sda1" + mock_watcher = MagicMock() + mock_watcher._parse_journal_line = MagicMock() + mock_watcher.testcase = "insertion" + mock_watcher.test_passed = True + StorageWatcher._process_lines(mock_watcher, lines) + mock_watcher._parse_journal_line.assert_has_calls([call("line1")]) - m = mock_open() - with patch("builtins.open", m): - StorageWatcher._store_storage_info( - mock_storage_watcher, mounted_partition - ) + def test_storage_watcher_process_lines_no_testcase(self): + lines = ["line1", "line2", "line3"] - m.assert_called_with(pathlib.Path("/tmp", "usb_insert_info"), "w") - m().write.assert_called_with("sda1\n") + mock_watcher = MagicMock() + mock_watcher._parse_journal_line = MagicMock() + mock_watcher.testcase = None + StorageWatcher._process_lines(mock_watcher, lines) + self.assertEqual(mock_watcher._parse_journal_line.call_count, 0) - @patch("os.environ.get") - def test_storage_watcher_store_storage_info_no_session(self, mock_get): + @mock_timeout() + def test_storage_watcher_run_insertion(self): mock_storage_watcher = MagicMock() - mock_get.return_value = None + mock_storage_watcher.run.return_value = "mounted_partition" + StorageWatcher.run_insertion(mock_storage_watcher) + self.assertEqual(mock_storage_watcher.run.call_count, 1) + self.assertEqual(mock_storage_watcher.testcase, "insertion") - with self.assertRaises(SystemExit): - StorageWatcher._store_storage_info(mock_storage_watcher) - - @patch("pathlib.Path.exists") - @patch("os.remove") - @patch("os.environ.get") - def test_storage_watcher_remove_storage_info( - self, mock_get, mock_remove, mock_exists - ): + @mock_timeout() + def test_storage_watcher_run_removal(self): mock_storage_watcher = MagicMock() - mock_get.return_value = "/tmp" - mock_exists.return_value = True - - StorageWatcher._remove_storage_info(mock_storage_watcher) - - mock_remove.assert_called_with(pathlib.Path("/tmp", "usb_insert_info")) + mock_storage_watcher.run.return_value = "mounted_partition" + StorageWatcher.run_removal(mock_storage_watcher, "mounted_partition") + self.assertEqual(mock_storage_watcher.run.call_count, 1) + self.assertEqual(mock_storage_watcher.testcase, "removal") - @patch("pathlib.Path.exists") - @patch("os.remove") - @patch("os.environ.get") - def test_storage_watcher_remove_storage_info_no_file( - self, mock_get, mock_remove, mock_exists + @patch( + "checkbox_support.scripts.run_watcher.mount_usb_storage", MagicMock() + ) + @patch("checkbox_support.scripts.run_watcher.gen_random_file") + @patch("checkbox_support.scripts.run_watcher.write_test") + @patch("checkbox_support.scripts.run_watcher.read_test") + def test_storage_watcher_run_storage( + self, mock_read_test, mock_write_test, mock_gen_random_file ): - mock_storage_watcher = MagicMock() - mock_get.return_value = "/tmp" - mock_exists.return_value = False - - StorageWatcher._remove_storage_info(mock_storage_watcher) - - mock_remove.assert_not_called() - - @patch("os.environ.get") - def test_storage_watcher_remove_storage_info_no_session(self, mock_get): - mock_storage_watcher = MagicMock() - mock_get.return_value = None - - with self.assertRaises(SystemExit): - StorageWatcher._remove_storage_info(mock_storage_watcher) + mock_usb_storage = MagicMock() + mock_usb_storage.mounted_partition = "mounted_partition" + mock_usb_storage.testcase = "insertion" + mock_gen_random_file.return_value.__enter__.return_value = "file" + StorageWatcher.run_storage(mock_usb_storage, "mounted_partition") + mock_write_test.assert_called_with("file") + mock_read_test.assert_called_with("file") def test_usb_storage_init(self): - usb_storage = USBStorage("insertion", "usb2", "zapper_addr") - self.assertEqual(usb_storage.testcase, "insertion") + usb_storage = USBStorage("usb2", "zapper_addr") self.assertEqual(usb_storage.storage_type, "usb2") self.assertEqual(usb_storage.zapper_usb_address, "zapper_addr") self.assertIsNone(usb_storage.mounted_partition) @@ -226,9 +256,9 @@ def test_usb2_storage_validate_insertion(self): mock_usb_storage.mounted_partition = "mounted_partition" mock_usb_storage.action = "insertion" mock_usb_storage.driver = "ehci_hcd" - with self.assertRaises(SystemExit) as cm: - USBStorage._validate_insertion(mock_usb_storage) - self.assertEqual(cm.exception.code, None) + + USBStorage._validate_insertion(mock_usb_storage) + self.assertEqual(mock_usb_storage.test_passed, True) def test_usb3_storage_validate_insertion(self): mock_usb_storage = MagicMock() @@ -237,9 +267,9 @@ def test_usb3_storage_validate_insertion(self): mock_usb_storage.mounted_partition = "mounted_partition" mock_usb_storage.action = "insertion" mock_usb_storage.driver = "xhci_hcd" - with self.assertRaises(SystemExit) as cm: - USBStorage._validate_insertion(mock_usb_storage) - self.assertEqual(cm.exception.code, None) + + USBStorage._validate_insertion(mock_usb_storage) + self.assertEqual(mock_usb_storage.test_passed, True) def test_usb3_gen2x1_storage_validate_insertion(self): mock_usb_storage = MagicMock() @@ -248,9 +278,9 @@ def test_usb3_gen2x1_storage_validate_insertion(self): mock_usb_storage.mounted_partition = "mounted_partition" mock_usb_storage.action = "insertion" mock_usb_storage.driver = "xhci_hcd" - with self.assertRaises(SystemExit) as cm: - USBStorage._validate_insertion(mock_usb_storage) - self.assertEqual(cm.exception.code, None) + + USBStorage._validate_insertion(mock_usb_storage) + self.assertEqual(mock_usb_storage.test_passed, True) def test_usb_storage_validate_insertion_wrong_usb_type(self): mock_usb_storage = MagicMock() @@ -266,9 +296,9 @@ def test_usb_storage_validate_insertion_wrong_usb_type(self): def test_usb_storage_validate_removal(self): mock_usb_storage = MagicMock() mock_usb_storage.action = "removal" - with self.assertRaises(SystemExit) as cm: - USBStorage._validate_removal(mock_usb_storage) - self.assertEqual(cm.exception.code, None) + + USBStorage._validate_removal(mock_usb_storage) + self.assertEqual(mock_usb_storage.test_passed, True) def test_usb_storage_no_insertion(self): mock_usb_storage = MagicMock() @@ -341,10 +371,7 @@ def test_usb_storage_parse_journal_line(self): self.assertEqual(mock_usb_storage.action, None) def test_mediacard_storage_init(self): - mediacard_storage = MediacardStorage( - "insertion", "mediacard", "zapper_addr" - ) - self.assertEqual(mediacard_storage.testcase, "insertion") + mediacard_storage = MediacardStorage("mediacard", "zapper_addr") self.assertEqual(mediacard_storage.storage_type, "mediacard") self.assertEqual(mediacard_storage.zapper_usb_address, "zapper_addr") self.assertIsNone(mediacard_storage.mounted_partition) @@ -355,16 +382,16 @@ def test_mediacard_storage_validate_insertion(self): mock_mediacard_storage.action = "insertion" mock_mediacard_storage.device = "SD" mock_mediacard_storage.address = "123456" - with self.assertRaises(SystemExit) as cm: - MediacardStorage._validate_insertion(mock_mediacard_storage) - self.assertEqual(cm.exception.code, None) + + MediacardStorage._validate_insertion(mock_mediacard_storage) + self.assertEqual(mock_mediacard_storage.test_passed, True) def test_mediacard_storage_validate_removal(self): mock_mediacard_storage = MagicMock() mock_mediacard_storage.action = "removal" - with self.assertRaises(SystemExit) as cm: - MediacardStorage._validate_removal(mock_mediacard_storage) - self.assertEqual(cm.exception.code, None) + + MediacardStorage._validate_removal(mock_mediacard_storage) + self.assertEqual(mock_mediacard_storage.test_passed, True) def test_mediacard_storage_no_insertion(self): mock_mediacard_storage = MagicMock() @@ -402,10 +429,7 @@ def test_mediacard_storage_parse_journal_line(self): self.assertEqual(mock_mediacard_storage.action, None) def test_thunderbolt_storage_init(self): - thunderbolt_storage = ThunderboltStorage( - "insertion", "thunderbolt", "zapper_addr" - ) - self.assertEqual(thunderbolt_storage.testcase, "insertion") + thunderbolt_storage = ThunderboltStorage("thunderbolt", "zapper_addr") self.assertEqual(thunderbolt_storage.storage_type, "thunderbolt") self.assertEqual(thunderbolt_storage.zapper_usb_address, "zapper_addr") self.assertIsNone(thunderbolt_storage.mounted_partition) @@ -415,16 +439,16 @@ def test_thunderbolt_storage_validate_insertion(self): mock_thunderbolt_storage = MagicMock() mock_thunderbolt_storage.mounted_partition = "nvme0n1p1" mock_thunderbolt_storage.action = "insertion" - with self.assertRaises(SystemExit) as cm: - ThunderboltStorage._validate_insertion(mock_thunderbolt_storage) - self.assertEqual(cm.exception.code, None) + + ThunderboltStorage._validate_insertion(mock_thunderbolt_storage) + self.assertEqual(mock_thunderbolt_storage.test_passed, True) def test_thunderbolt_storage_validate_removal(self): mock_thunderbolt_storage = MagicMock() mock_thunderbolt_storage.action = "removal" - with self.assertRaises(SystemExit) as cm: - ThunderboltStorage._validate_removal(mock_thunderbolt_storage) - self.assertEqual(cm.exception.code, None) + + ThunderboltStorage._validate_removal(mock_thunderbolt_storage) + self.assertEqual(mock_thunderbolt_storage.test_passed, True) def test_thunderbolt_storage_no_insertion(self): mock_thunderbolt_storage = MagicMock() @@ -469,24 +493,69 @@ def test_thunderbolt_storage_parse_journal_line(self): ) self.assertEqual(mock_thunderbolt_storage.action, None) + def test_parse_args(self): + with patch( + "sys.argv", + ["script.py", "insertion", "usb2", "--zapper-usb-address", "addr"], + ): + args = parse_args() + self.assertEqual(args.testcase, "insertion") + self.assertEqual(args.storage_type, "usb2") + self.assertEqual(args.zapper_usb_address, "addr") + @patch("checkbox_support.scripts.run_watcher.USBStorage", spec=USBStorage) - def test_main_usb(self, mock_usb_storage): - with patch("sys.argv", ["run_watcher.py", "insertion", "usb2"]): - launch_watcher() + @patch("checkbox_support.scripts.run_watcher.parse_args") + def test_main_usb_insertion(self, mock_parse_args, mock_usb): + mock_parse_args.return_value = argparse.Namespace( + testcase="insertion", storage_type="usb2", zapper_usb_address=None + ) + main() + mock_usb.assert_called_with("usb2", None) + self.assertEqual(mock_usb.return_value.run_insertion.call_count, 1) + self.assertEqual(mock_usb.return_value.run_removal.call_count, 1) # get the watcher object from main - watcher = mock_usb_storage.return_value + watcher = mock_usb.return_value # check that the watcher is an USBStorage object self.assertIsInstance(watcher, USBStorage) + @patch("checkbox_support.scripts.run_watcher.input", MagicMock()) + @patch("checkbox_support.scripts.run_watcher.USBStorage", spec=USBStorage) + @patch("checkbox_support.scripts.run_watcher.parse_args") + def test_main_usb_storage(self, mock_parse_args, mock_usb): + mock_parse_args.return_value = argparse.Namespace( + testcase="storage", storage_type="usb2", zapper_usb_address=None + ) + main() + mock_usb.assert_called_with("usb2", None) + self.assertEqual(mock_usb.return_value.run_insertion.call_count, 1) + self.assertEqual(mock_usb.return_value.run_storage.call_count, 1) + self.assertEqual(mock_usb.return_value.run_removal.call_count, 1) + + @patch("checkbox_support.scripts.run_watcher.USBStorage", spec=USBStorage) + @patch("checkbox_support.scripts.run_watcher.parse_args") + def test_main_usb_invalid(self, mock_parse_args, mock_usb): + mock_parse_args.return_value = argparse.Namespace( + testcase="invalid", storage_type="usb2", zapper_usb_address=None + ) + with self.assertRaises(SystemExit) as cm: + main() + cm.exception.args[0] == "Invalid test case" + @patch( "checkbox_support.scripts.run_watcher.MediacardStorage", spec=MediacardStorage, ) - def test_main_mediacard(self, mock_mediacard_storage): - with patch("sys.argv", ["run_watcher.py", "insertion", "mediacard"]): - launch_watcher() + @patch("checkbox_support.scripts.run_watcher.parse_args") + def test_main_mediacard(self, mock_parse_args, mock_mediacard): + mock_parse_args.return_value = argparse.Namespace( + testcase="insertion", + storage_type="mediacard", + zapper_usb_address=None, + ) + main() + self.assertEqual(mock_mediacard.call_count, 1) # get the watcher object from main - watcher = mock_mediacard_storage.return_value + watcher = mock_mediacard.return_value # check that the watcher is an MediacardStorage object self.assertIsInstance(watcher, MediacardStorage) @@ -494,10 +563,16 @@ def test_main_mediacard(self, mock_mediacard_storage): "checkbox_support.scripts.run_watcher.ThunderboltStorage", spec=ThunderboltStorage, ) - def test_main_thunderbolt(self, mock_thunderbolt_storage): - with patch("sys.argv", ["run_watcher.py", "insertion", "thunderbolt"]): - launch_watcher() + @patch("checkbox_support.scripts.run_watcher.parse_args") + def test_main_thunderbolt(self, mock_parse_args, mock_thunderbolt): + mock_parse_args.return_value = argparse.Namespace( + testcase="insertion", + storage_type="thunderbolt", + zapper_usb_address=None, + ) + main() + self.assertEqual(mock_thunderbolt.call_count, 1) # get the watcher object from main - watcher = mock_thunderbolt_storage.return_value + watcher = mock_thunderbolt.return_value # check that the watcher is an ThunderboltStorage object self.assertIsInstance(watcher, ThunderboltStorage) diff --git a/providers/base/units/dock/jobs.pxu b/providers/base/units/dock/jobs.pxu index 8a862790e5..667beb1f7f 100644 --- a/providers/base/units/dock/jobs.pxu +++ b/providers/base/units/dock/jobs.pxu @@ -2079,57 +2079,27 @@ _verification: Are all kinds of discs properly written? plugin: user-interact -id: dock/thunderbolt3-insert +id: dock/thunderbolt3-storage-manual category_id: dock -estimated_duration: 40.0 +estimated_duration: 120 depends: dock/cold-plug imports: from com.canonical.plainbox import manifest requires: manifest.has_thunderbolt3 == 'True' flags: also-after-suspend -command: checkbox-support-run_watcher insertion thunderbolt -_summary: Thunderbolt3 storage insertion detection +command: checkbox-support-run_watcher storage thunderbolt +_summary: Thunderbolt3 storage insertion + read/write + removal _purpose: - This test will check if the connection of a Thunderbolt3 HDD to the dock could be detected + This test will check if the connection of a Thunderbolt3 HDD to the dock could be detected, + then performs read/write operations on the attached Thunderbolt3 storage and + checks if the removal of the Thunderbolt3 HDD can be detected. _steps: 1. Click 'Test' to begin the test. This test will - timeout and fail if the insertion has not been detected within 40 seconds. - 2. Plug a Thunderbolt3 HDD into an available Thunderbolt3 port on the dock; - if it's not mounted automatically, please click the HDD icon to mount it. -_verification: - The verification of this test is automated. Do not change the automatically - selected result - -plugin: shell -id: dock/thunderbolt3-storage-test -category_id: dock -estimated_duration: 45.0 -user: root -depends: dock/thunderbolt3-insert -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -flags: also-after-suspend -command: checkbox-support-usb_read_write -_summary: Thunderbolt3 storage test -_purpose: - This is an automated test which performs read/write operations on an attached - Thunderbolt3 HDD - -plugin: user-interact -id: dock/thunderbolt3-remove -category_id: dock -estimated_duration: 20.0 -depends: dock/thunderbolt3-insert -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -flags: also-after-suspend -command: checkbox-support-run_watcher removal thunderbolt -_summary: Thunderbolt3 storage removal detection -_purpose: - This test will check the system can detect the removal of a Thunderbolt3 HDD -_steps: - 1. Click 'Test' to begin the test. This test will timeout and fail if - the removal has not been detected within 20 seconds. - 2. Remove the previously attached Thunderbolt3 HDD from the Thunderbolt3 port. + timeout and fail if the insertion has not been detected within 30 seconds. + 2. Plug a Thunderbolt3 HDD into an available Thunderbolt3 port on the dock. + If it's not mounted automatically, please click the HDD icon to mount it. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the previously attached Thunderbolt3 HDD from the Thunderbolt3 port. _verification: The verification of this test is automated. Do not change the automatically selected result @@ -2649,83 +2619,36 @@ _siblings: {"id": "dock/all-suspend-networking-ntp"}, {"id": "dock/all-poweroff-networking-ntp"}] -id: dock/all-init-thunderbolt3-insert + +id: dock/all-init-thunderbolt3-storage-manual category_id: dock -estimated_duration: 40.0 +estimated_duration: 120 plugin: user-interact imports: from com.canonical.plainbox import manifest requires: manifest.has_thunderbolt3 == 'True' flags: also-after-suspend -command: checkbox-support-run_watcher insertion thunderbolt -_summary: Thunderbolt3 storage insertion detection +command: checkbox-support-run_watcher storage thunderbolt +_summary: Thunderbolt3 storage insertion + read/write + removal _purpose: - This test will check if the connection of a Thunderbolt3 HDD to the dock could be detected + This test will check if the connection of a Thunderbolt3 HDD to the dock could be detected, + then performs read/write operations on the attached Thunderbolt3 storage and + checks if the removal of the Thunderbolt3 HDD can be detected. _steps: 1. Click 'Test' to begin the test. This test will - timeout and fail if the insertion has not been detected within 40 seconds. + timeout and fail if the insertion has not been detected within 30 seconds. 2. Plug a Thunderbolt3 HDD into an available Thunderbolt3 port on the dock. If it's not mounted automatically, please click the HDD icon to mount it. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the previously attached Thunderbolt3 HDD from the Thunderbolt3 port. _verification: The verification of this test is automated. Do not change the automatically selected result. _siblings: - [{"id": "dock/all-reboot-thunderbolt3-insert"}, - {"id": "dock/all-hotplug-thunderbolt3-insert"}, - {"id": "dock/all-suspend-thunderbolt3-insert"}, - {"id": "dock/all-poweroff-thunderbolt3-insert"}] - -id: dock/all-init-thunderbolt3-storage-automated -category_id: dock -estimated_duration: 45.0 -user: root -plugin: shell -depends: dock/all-init-thunderbolt3-insert -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -flags: also-after-suspend -command: checkbox-support-usb_read_write -_summary: Thunderbolt3 storage test -_description: - This is an automated test which performs read/write operations on an attached - Thunderbolt storage. -_siblings: - [{"id": "dock/all-reboot-thunderbolt3-storage-automated", - "depends": "dock/all-reboot-thunderbolt3-insert"}, - {"id": "dock/all-hotplug-thunderbolt3-storage-automated", - "depends": "dock/all-hotplug-thunderbolt3-insert"}, - {"id": "dock/all-suspend-thunderbolt3-storage-automated", - "depends": "dock/all-suspend-thunderbolt3-insert"}, - {"id": "dock/all-poweroff-thunderbolt3-storage-automated", - "depends": "dock/all-poweroff-thunderbolt3-insert"}] - -id: dock/all-init-thunderbolt3-remove -category_id: dock -estimated_duration: 20.0 -plugin: user-interact -depends: dock/all-init-thunderbolt3-insert -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -flags: also-after-suspend -command: checkbox-support-run_watcher removal thunderbolt -_summary: Thunderbolt3 storage removal detection -_purpose: - This test will check the system can detect the removal of a Thunderbolt3 storage. -_steps: - 1. Click 'Test' to begin the test. This test will timeout and fail if - the removal has not been detected within 20 seconds. - 2. Remove the previously attached Thunderbolt3 HDD from the Thunderbolt3 port. -_verification: - The verification of this test is automated. Do not change the automatically - selected result -_siblings: - [{"id": "dock/all-reboot-thunderbolt3-remove", - "depends": "dock/all-reboot-thunderbolt3-insert"}, - {"id": "dock/all-hotplug-thunderbolt3-remove", - "depends": "dock/all-hotplug-thunderbolt3-insert"}, - {"id": "dock/all-suspend-thunderbolt3-remove", - "depends": "dock/all-suspend-thunderbolt3-insert"}, - {"id": "dock/all-poweroff-thunderbolt3-remove", - "depends": "dock/all-poweroff-thunderbolt3-insert"}] + [{"id": "dock/all-reboot-thunderbolt3-storage-manual"}, + {"id": "dock/all-hotplug-thunderbolt3-storage-manual"}, + {"id": "dock/all-suspend-thunderbolt3-storage-manual"}, + {"id": "dock/all-poweroff-thunderbolt3-storage-manual"}] id: dock/all-init-usb-c/insert diff --git a/providers/base/units/dock/test-plan.pxu b/providers/base/units/dock/test-plan.pxu index 626b30d0aa..bc15142e77 100644 --- a/providers/base/units/dock/test-plan.pxu +++ b/providers/base/units/dock/test-plan.pxu @@ -22,9 +22,7 @@ include: dock/all-init-monitor-multi-head-audio-playback certification-status=blocker dock/all-init-networking-gateway-ping certification-status=blocker dock/all-init-networking-ntp certification-status=blocker - dock/all-init-thunderbolt3-insert certification-status=blocker - dock/all-init-thunderbolt3-storage-automated certification-status=blocker - dock/all-init-thunderbolt3-remove certification-status=blocker + dock/all-init-thunderbolt3-storage-manual certification-status=blocker dock/all-init-usb-c/insert certification-status=blocker dock/all-init-usb-c/storage-automated certification-status=blocker dock/all-init-usb-c/remove certification-status=blocker @@ -47,9 +45,7 @@ include: dock/all-reboot-monitor-multi-head-audio-playback certification-status=blocker dock/all-reboot-networking-gateway-ping certification-status=blocker dock/all-reboot-networking-ntp certification-status=blocker - dock/all-reboot-thunderbolt3-insert certification-status=blocker - dock/all-reboot-thunderbolt3-storage-automated certification-status=blocker - dock/all-reboot-thunderbolt3-remove certification-status=blocker + dock/all-reboot-thunderbolt3-storage-manual certification-status=blocker dock/all-reboot-usb-c/insert certification-status=blocker dock/all-reboot-usb-c/storage-automated certification-status=blocker dock/all-reboot-usb-c/remove certification-status=blocker @@ -72,9 +68,7 @@ include: dock/all-hotplug-monitor-multi-head-audio-playback certification-status=blocker dock/all-hotplug-networking-gateway-ping certification-status=blocker dock/all-hotplug-networking-ntp certification-status=blocker - dock/all-hotplug-thunderbolt3-insert certification-status=blocker - dock/all-hotplug-thunderbolt3-storage-automated certification-status=blocker - dock/all-hotplug-thunderbolt3-remove certification-status=blocker + dock/all-hotplug-thunderbolt3-storage-manual certification-status=blocker dock/all-hotplug-usb-c/insert certification-status=blocker dock/all-hotplug-usb-c/storage-automated certification-status=blocker dock/all-hotplug-usb-c/remove certification-status=blocker @@ -97,9 +91,7 @@ include: dock/all-suspend-monitor-multi-head-audio-playback certification-status=blocker dock/all-suspend-networking-gateway-ping certification-status=blocker dock/all-suspend-networking-ntp certification-status=blocker - dock/all-suspend-thunderbolt3-insert certification-status=blocker - dock/all-suspend-thunderbolt3-storage-automated certification-status=blocker - dock/all-suspend-thunderbolt3-remove certification-status=blocker + dock/all-suspend-thunderbolt3-storage-manual certification-status=blocker dock/all-suspend-usb-c/insert certification-status=blocker dock/all-suspend-usb-c/storage-automated certification-status=blocker dock/all-suspend-usb-c/remove certification-status=blocker @@ -122,9 +114,7 @@ include: dock/all-poweroff-monitor-multi-head-audio-playback certification-status=blocker dock/all-poweroff-networking-gateway-ping certification-status=blocker dock/all-poweroff-networking-ntp certification-status=blocker - dock/all-poweroff-thunderbolt3-insert certification-status=blocker - dock/all-poweroff-thunderbolt3-storage-automated certification-status=blocker - dock/all-poweroff-thunderbolt3-remove certification-status=blocker + dock/all-poweroff-thunderbolt3-storage-manual certification-status=blocker dock/all-poweroff-usb-c/insert certification-status=blocker dock/all-poweroff-usb-c/storage-automated certification-status=blocker dock/all-poweroff-usb-c/remove certification-status=blocker @@ -196,9 +186,7 @@ include: dock/battery-charging certification-status=blocker dock/monitor-thunderbolt3 dock/audio-playback-thunderbolt3 - dock/thunderbolt3-insert - dock/thunderbolt3-storage-test - dock/thunderbolt3-remove + dock/thunderbolt3-storage-manual dock/thunderbolt3-daisy-chain dock/network-before-suspend certification-status=blocker dock/audio-before-suspend certification-status=blocker diff --git a/providers/base/units/mediacard/jobs.pxu b/providers/base/units/mediacard/jobs.pxu index 4b466cb468..244f9173fb 100644 --- a/providers/base/units/mediacard/jobs.pxu +++ b/providers/base/units/mediacard/jobs.pxu @@ -1,363 +1,164 @@ +### MMC ### + plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/mmc-insert -estimated_duration: 30.0 +id: mediacard/mmc-storage-manual +estimated_duration: 120 command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard imports: from com.canonical.plainbox import manifest requires: manifest.has_card_reader == 'True' user: root _purpose: This test will check that the system's media card reader can - detect the insertion of a Multimedia Card (MMC) media + detect the insertion of a Multimedia Card (MMC) media. Then it + performs a read and write test on the MMC card. Finally, it + checks that the system correctly detects the removal of the MMC card. _steps: 1. Commence the test and then insert an MMC card into the reader. - (Note: this test will time-out after 20 seconds.) + (Note: this test will time-out after 30 seconds.) 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the MMC card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. -_summary: Test the system's media card reader for MMC insertion detection. +_summary: Test Multimedia Card (MMC) insertion + read/write + removal. -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/mmc-storage -estimated_duration: 30.0 -depends: mediacard/mmc-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_purpose: - This test is automated and executes after the mediacard/mmc-insert - test is run. It tests reading and writing to the MMC card. -_summary: - Test automated execution for reading and writing to the MMC card. +### SDHC Card ### plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/mmc-remove -estimated_duration: 30.0 -depends: mediacard/mmc-insert -command: - checkbox-support-run_watcher removal mediacard -user: root -_purpose: - This test will check that the system correctly detects - the removal of the MMC card from the system's card reader. -_steps: - 1. Commence the test and then remove the MMC card from the reader. - (Note: this test will time out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Test the detection of MMC card removal from the system's card reader. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/sd-insert +id: mediacard/sdhc-storage-manual +flags: also-after-suspend estimated_duration: 30.0 command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard imports: from com.canonical.plainbox import manifest requires: manifest.has_card_reader == 'True' user: root -_summary: Test that insertion of an SD card is detected +_summary: Test SDHC card insertion + read/write + removal. _purpose: - This test will check that the system's media card reader can - detect the insertion of an UNLOCKED Secure Digital (SD) media card -_steps: - 1. Commence the test and then insert an UNLOCKED SD card into the reader. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. - -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/sd-storage -estimated_duration: 30.0 -depends: mediacard/sd-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_summary: Test reading & writing to an SD Card -_purpose: - This test is automated and executes after the mediacard/sd-insert - test is run. It tests reading and writing to the SD card. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/sd-remove -estimated_duration: 30.0 -depends: mediacard/sd-insert -command: - checkbox-support-run_watcher removal mediacard -user: root -_summary: Test that removal of an SD card is detected -_purpose: - This test will check that the system correctly detects - the removal of an SD card from the system's card reader. + This test will check that the system's media card reader can + detect the insertion of a UNLOCKED Secure Digital High-Capacity + (SDHC) media card + Then it performs a read and write test on the SDHC card. + Finally, it checks that the system detects the removal of the SDHC card. _steps: - 1. Commence the test and then remove the SD card from the reader. - (Note: this test will time-out after 20 seconds.) + 1. Commence the test and then insert an UNLOCKED SDHC card into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the SDHC card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/sd-preinserted -estimated_duration: 30.0 -user: root -flags: preserve-cwd -command: removable_storage_test.py -s 268400000 --memorycard -l sdio usb scsi && removable_storage_test.py --memorycard sdio usb scsi -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -_summary: Automated test of SD Card reading & writing (udisks2) -_description: -_purpose: - This is a fully automated version of mediacard/sd-automated and assumes that the - system under test has a memory card device plugged in prior to checkbox execution. - It is intended for SRU automated testing. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/sdhc-insert -flags: also-after-suspend -estimated_duration: 30.0 -command: - checkbox-support-run_watcher insertion mediacard -imports: from com.canonical.plainbox import manifest -requires: - manifest.has_card_reader == 'True' -user: root -_summary: Test that insertion of an SDHC card is detected -_purpose: - This test will check that the system's media card reader can - detect the insertion of a UNLOCKED Secure Digital High-Capacity - (SDHC) media card -_steps: - 1. Commence the test and then insert an UNLOCKED SDHC card into the reader. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. - -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/sdhc-storage -estimated_duration: 30.0 -depends: mediacard/sdhc-insert -user: root -flags: preserve-cwd reset-locale also-after-suspend -command: - checkbox-support-usb_read_write -_summary: Test reading & writing to a SDHC Card -_description: - This test is automated and executes after the mediacard/sdhc-insert - test is run. It tests reading and writing to the SDHC card. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/sdhc-remove -flags: also-after-suspend -estimated_duration: 30.0 -depends: mediacard/sdhc-insert -command: - checkbox-support-run_watcher removal mediacard -user: root -_summary: Test that removal of an SDHC card is detected -_purpose: - This test will check that the system correctly detects - the removal of an SDHC card from the system's card reader. -_steps: - 1. Commence the test and then remove the SDHC card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. +### CF Card ### plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/cf-insert -estimated_duration: 30.0 +id: mediacard/cf-storage-manual +estimated_duration: 120 command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard imports: from com.canonical.plainbox import manifest requires: manifest.has_card_reader == 'True' user: root _purpose: - This test will check that the system's media card reader can - detect the insertion of a Compact Flash (CF) media card + This test will check that the system's media card reader can + detect the insertion of a Compact Flash (CF) media card + Then it performs a read and write test on the CF card. + Finally, it checks that the system detects the removal of the CF card. _steps: - 1. Commence the test and then insert a CF card into the reader. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. + 1. Commence the test and then insert a CF card into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the MMC card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. -_summary: Verify the system's media card reader can detect a Compact Flash card insertion. - -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/cf-storage -estimated_duration: 30.0 -depends: mediacard/cf-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_purpose: - This test is automated and executes after the mediacard/cf-insert - test is run. It tests reading and writing to the CF card. -_summary: Automate testing for reading and writing to the CF card after mediacard/cf-insert test. +_summary: Test Compact Flash (CF) card insertion + read/write + removal. -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/cf-remove -depends: mediacard/cf-insert -estimated_duration: 30.0 -command: - checkbox-support-run_watcher removal mediacard -user: root -_purpose: - This test will check that the system correctly detects - the removal of a CF card from the system's card reader. -_steps: - 1. Commence the test and then remove the CF card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Ensure the system detects CF card removal from the card reader correctly. +### SDXC Card ### plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/sdxc-insert -estimated_duration: 30.0 +id: mediacard/sdxc-storage-manual +estimated_duration: 120 command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard imports: from com.canonical.plainbox import manifest requires: manifest.has_card_reader == 'True' user: root -_summary: Test that insertion of an SDXC card is detected +_summary: Test SDXC card insertion + read/write + removal. _purpose: - This test will check that the system's media card reader can - detect the insertion of a Secure Digital Extended Capacity (SDXC) media card + This test will check that the system's media card reader can + detect the insertion of a Secure Digital Extended Capacity (SDXC) media card + Then it performs a read and write test on the SDXC card. + Finally, it checks that the system detects the removal of the SDXC card. _steps: - 1. Commence the test and then insert an UNLOCKED SDXC card into the reader. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. + 1. Commence the test and then insert an UNLOCKED SDXC card into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the SDXC card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/sdxc-storage -estimated_duration: 30.0 -depends: mediacard/sdxc-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_summary: Test reading & writing to an SDXC Card -_purpose: - This test is automated and executes after the mediacard/sdxc-insert - test is run. It tests reading and writing to the SDXC card. +### MS Card ### plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/sdxc-remove -estimated_duration: 30.0 -depends: mediacard/sdxc-insert +id: mediacard/ms-storage-manual +estimated_duration: 120 command: - checkbox-support-run_watcher removal mediacard -user: root -_summary: Test that removal of an SDXC card is detected -_purpose: - This test will check that the system correctly detects - the removal of a SDXC card from the system's card reader. -_steps: - 1. Commence the test and then remove the SDXC card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/ms-insert -estimated_duration: 30.0 -command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard imports: from com.canonical.plainbox import manifest requires: manifest.has_card_reader == 'True' user: root _purpose: - This test will check that the system's media card reader can - detect the insertion of a Memory Stick (MS) media card + This test will check that the system's media card reader can + detect the insertion of a Memory Stick (MS) media card + Then it performs a read and write test on the MS card. + Finally, it checks that the system detects the removal of the MS card. _steps: - 1. Commence the test and then insert a MS card into the reader. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. + 1. Commence the test and then insert a MS card into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the MS card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. _summary: - Verify the detection of Memory Stick (MS) card insertion by the system's media card reader. + Test Memory Stick (MS) card insertion + read/write + removal. -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/ms-storage -estimated_duration: 30.0 -depends: mediacard/ms-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_purpose: - This test is automated and executes after the mediacard/ms-insert - test is run. It tests reading and writing to the MS card. -_summary: Automated test for reading and writing to the MS card after mediacard/ms-insert test. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/ms-remove -estimated_duration: 30.0 -depends: mediacard/ms-insert -command: - checkbox-support-run_watcher removal mediacard -user: root -_description: -_purpose: - This test will check that the system correctly detects - the removal of an MS card from the system's card reader. -_steps: - 1. Commence the test and then remove the MS card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Test if the system detects the removal of an MS card correctly. +### MSP Card ### plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/msp-insert -estimated_duration: 30.0 +id: mediacard/msp-storage-manual +estimated_duration: 120 command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard user: root imports: from com.canonical.plainbox import manifest requires: @@ -366,102 +167,72 @@ _description: _purpose: This test will check that the system's media card reader can detect the insertion of a Memory Stick Pro (MSP) media card + Then it performs a read and write test on the MSP card. + Finally, it checks that the system detects the removal of the MSP card. _steps: 1. Commence the test and then insert a MSP card into the reader. - (Note: this test will time-out after 20 seconds.) + (Note: this test will time-out after 30 seconds.) 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the MSP card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. -_summary: Verify the system's media card reader can detect a Memory Stick Pro (MSP) card insertion. +_summary: + Test Memory Stick Pro (MSP) card insertion + read/write + removal. -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/msp-storage -estimated_duration: 30.0 -depends: mediacard/msp-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_purpose: - This test is automated and executes after the mediacard/msp-insert - test is run. It tests reading and writing to the MSP card. -_summary: Automated test for reading and writing to the MSP card after mediacard/msp-insert test. +### xD Card ### plugin: user-interact category_id: com.canonical.plainbox::mediacard -id: mediacard/msp-remove -estimated_duration: 30.0 -depends: mediacard/msp-insert +id: mediacard/xd-storage-manual +estimated_duration: 120 command: - checkbox-support-run_watcher removal mediacard -user: root -_description: -_purpose: - This test will check that the system correctly detects - the removal of a MSP card from the system's card reader. -_steps: - 1. Commence the test and remove the MSP card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Ensure MSP card removal is correctly detected by the system. - -plugin: user-interact -category_id: com.canonical.plainbox::mediacard -id: mediacard/xd-insert -estimated_duration: 30.0 -command: - checkbox-support-run_watcher insertion mediacard + checkbox-support-run_watcher storage mediacard imports: from com.canonical.plainbox import manifest requires: manifest.has_card_reader == 'True' user: root _purpose: - This test will check that the system's media card reader can - detect the insertion of an Extreme Digital (xD) media card. + This test will check that the system's media card reader can + detect the insertion of an Extreme Digital (xD) media card. + Then it performs a read and write test on the XD card. + Finally, it checks that the system detects the removal of the XD card. _steps: - 1. Commence the test and then insert an xD card into the reader. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. + 1. Commence the test and then insert an xD card into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the MS card from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. -_summary: Ensure the system's media card reader detects the insertion of an xD media card. +_summary: + Test Extreme Digital (xD) card insertion + read/write + removal. -plugin: shell -category_id: com.canonical.plainbox::mediacard -id: mediacard/xd-storage -estimated_duration: 30.0 -depends: mediacard/xd-insert -user: root -flags: preserve-cwd reset-locale -command: - checkbox-support-usb_read_write -_purpose: - This test is automated and executes after the mediacard/xd-insert test is run. It tests reading and writing to the xD card. -_summary: Automated test to verify reading and writing functionality of the xD card after mediacard/xd-insert test. +### GENERAL ### -plugin: user-interact +plugin: shell category_id: com.canonical.plainbox::mediacard -id: mediacard/xd-remove +id: mediacard/sd-preinserted estimated_duration: 30.0 -depends: mediacard/xd-insert -command: - checkbox-support-run_watcher removal mediacard user: root +flags: preserve-cwd +command: removable_storage_test.py -s 268400000 --memorycard -l sdio usb scsi && removable_storage_test.py --memorycard sdio usb scsi +imports: from com.canonical.plainbox import manifest +requires: + package.name == 'udisks2' or snap.name == 'udisks2' + manifest.has_card_reader == 'True' +_summary: Automated test of SD Card reading & writing (udisks2) +_description: _purpose: - This test will check that the system correctly detects - the removal of a xD card from the system's card reader. -_steps: - 1. Commence the test and then remove the xD card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Automated test for detecting the removal of a xD card from the system's card reader. + This is a fully automated version of mediacard/sd-automated and assumes that the + system under test has a memory card device plugged in prior to checkbox execution. + It is intended for SRU automated testing. unit: template template-resource: removable_partition diff --git a/providers/base/units/mediacard/test-plan.pxu b/providers/base/units/mediacard/test-plan.pxu index 026a159930..b2563509fb 100644 --- a/providers/base/units/mediacard/test-plan.pxu +++ b/providers/base/units/mediacard/test-plan.pxu @@ -14,9 +14,7 @@ _name: Mediacard tests (Manual) _description: Mediacard tests (Manual) include: - mediacard/sdhc-insert certification-status=blocker - mediacard/sdhc-storage certification-status=blocker - mediacard/sdhc-remove certification-status=blocker + mediacard/sdhc-storage-manual certification-status=blocker id: mediacard-cert-automated unit: test plan @@ -31,27 +29,21 @@ unit: test plan _name: Mediacard tests (after suspend) _description: Mediacard tests (after suspend) include: - after-suspend-mediacard/sdhc-insert certification-status=blocker - after-suspend-mediacard/sdhc-storage certification-status=blocker - after-suspend-mediacard/sdhc-remove certification-status=blocker + after-suspend-mediacard/sdhc-storage-manual certification-status=blocker id: mediacard-cert-blockers unit: test plan _name: Mediacard tests (certification blockers only) _description: Mediacard tests (certification blockers only) include: - mediacard/sdhc-insert certification-status=blocker - mediacard/sdhc-storage certification-status=blocker - mediacard/sdhc-remove certification-status=blocker + mediacard/sdhc-storage-manual certification-status=blocker id: after-suspend-mediacard-cert-blockers unit: test plan _name: Mediacard tests (after suspend, certification blockers only) _description: Mediacard tests (after suspend, certification blockers only) include: - suspend/sdhc-insert-after-suspend certification-status=blocker - suspend/sdhc-storage-after-suspend certification-status=blocker - suspend/sdhc-remove-after-suspend certification-status=blocker + suspend/sdhc-storage-manual-after-suspend certification-status=blocker id: mediacard-full unit: test plan @@ -68,30 +60,14 @@ unit: test plan _name: Manual mediacard tests _description: Manual mediacard tests for Snappy Ubuntu Core devices include: - mediacard/cf-insert - mediacard/cf-storage - mediacard/cf-remove - mediacard/mmc-insert - mediacard/mmc-storage - mediacard/mmc-remove - mediacard/ms-insert - mediacard/ms-storage - mediacard/ms-remove - mediacard/msp-insert - mediacard/msp-storage - mediacard/msp-remove - mediacard/sd-insert - mediacard/sd-storage - mediacard/sd-remove - mediacard/sdhc-insert - mediacard/sdhc-storage - mediacard/sdhc-remove - mediacard/sdxc-insert - mediacard/sdxc-storage - mediacard/sdxc-remove - mediacard/xd-insert - mediacard/xd-storage - mediacard/xd-remove + mediacard/cf-storage-manual + mediacard/mmc-storage-manual + mediacard/ms-storage-manual + mediacard/msp-storage-manual + mediacard/sd-storage-manual + mediacard/sdhc-storage-manual + mediacard/sdxc-storage-manual + mediacard/xd-storage-manual id: mediacard-automated unit: test plan diff --git a/providers/base/units/suspend/suspend.pxu b/providers/base/units/suspend/suspend.pxu index 80325eb455..731f7f13ea 100644 --- a/providers/base/units/suspend/suspend.pxu +++ b/providers/base/units/suspend/suspend.pxu @@ -1519,556 +1519,6 @@ _verification: Did the WLAN/Bluetooth LED light as expected after resuming from suspend? _summary: Validate that the LED indicators for Wireless (WLAN + Bluetooth) function correctly after resuming from suspend. -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/usb_insert_after_suspend -estimated_duration: 30.0 -depends: - suspend/suspend_advanced_auto -command: removable_storage_watcher.py insert usb -_purpose: - This test will check that the system correctly detects the insertion of - a USB storage device after suspend and resume. - NOTE: Make sure the USB storage device has a partition before starting - the test. -_steps: - 1. Click "Test" and insert a USB storage device (pen-drive/HDD). - (Note: this test will time out after 20 seconds.) - 2. Do not unplug the device after the test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify automatic detection of a USB storage device insertion after system suspend and resume. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/usb3_insert_after_suspend -estimated_duration: 30.0 -requires: - usb.usb3 == 'supported' -depends: - suspend/suspend_advanced_auto -command: removable_storage_watcher.py -m 500000000 insert usb -_purpose: - This test will check that the system correctly detects the insertion of - a USB 3.0 storage device after suspend and resume. - NOTE: Make sure the USB storage device has a partition before starting - the test. -_steps: - 1. Click "Test" and insert a USB 3.0 storage device (pen-drive/HDD) in - a USB 3.0 port. (Note: this test will time out after 20 seconds.) - 2. Do not unplug the device after the test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify USB 3.0 device detection after system suspend and resume. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/usb_remove_after_suspend -estimated_duration: 30.0 -depends: - suspend/usb_insert_after_suspend -command: removable_storage_watcher.py remove usb -_purpose: - This test will check that the system correctly detects the removal of - a USB storage device after suspend. -_steps: - 1. Click "Test" and remove the USB device. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not manually change the - automatically selected result. -_summary: Automated test for checking USB device removal detection after system suspend. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/usb3_remove_after_suspend -estimated_duration: 30.0 -depends: - suspend/usb3_insert_after_suspend -requires: - usb.usb3 == 'supported' -command: removable_storage_watcher.py -m 500000000 remove usb -_purpose: - This test will check that the system correctly detects the removal of - a USB 3.0 storage device after suspend -_steps: - 1. Click "Test" and remove the USB 3.0 device. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify system detects removal of a USB 3.0 storage device post-suspend. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/usb_storage_automated_after_suspend -estimated_duration: 1.2 -depends: suspend/usb_insert_after_suspend -user: root -command: removable_storage_test.py -s 268400000 usb -_purpose: - This test is automated and executes after the suspend/usb_insert_after_suspend test is run. -_summary: An automated test that runs after the suspend/usb_insert_after_suspend test, focusing on USB storage. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/usb3_storage_automated_after_suspend -estimated_duration: 1.2 -requires: - usb.usb3 == 'supported' -depends: suspend/usb3_insert_after_suspend -user: root -command: removable_storage_test.py -s 268400000 -m 500000000 usb --driver xhci_hcd -_purpose: - This test is automated and executes after the suspend/usb3_insert_after_suspend - test is run. -_summary: Automated USB3 storage test after system suspend. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/usb_performance_after_suspend -depends: suspend/usb_insert_after_suspend -user: root -estimated_duration: 45.00 -command: removable_storage_test.py -s 268400000 -p 15 usb -_purpose: - This test will check that your USB 2.0 port transfers data at a - minimum expected speed. -_summary: Verify USB 2.0 port's data transfer speed after suspend. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/usb3_superspeed_performance_after_suspend -requires: - usb.usb3 == 'supported' -depends: suspend/usb3_insert_after_suspend -user: root -estimated_duration: 45.00 -command: removable_storage_test.py -s 268400000 -m 500000000 usb --driver xhci_hcd -_purpose: - This test will check that your USB 3.0 port can be recognized - as a SuperSpeed USB device using the xhci_hcd driver and transfers data correctly. -_summary: Verify USB 3.0 port's SuperSpeed performance with xhci_hcd driver after suspend. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/mmc-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of an MMC card after the system has been suspended -_steps: - 1. Click "Test" and insert an MMC card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: - Automated check for MMC card detection post system suspend. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/mmc-storage-after-suspend -depends: suspend/mmc-insert-after-suspend -estimated_duration: 10.0 -user: root -command: removable_storage_test.py -s 67120000 --memorycard sdio usb scsi -_purpose: This test is automated and executes after the mediacard/mmc-insert-after-suspend test is run. It tests reading and writing to the MMC card after the system has been suspended. -_summary: Automated test for MMC card read/write operations post system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/mmc-remove-after-suspend -depends: suspend/mmc-insert-after-suspend -estimated_duration: 30.0 -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of an MMC card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the MMC card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify the system detects MMC card removal after suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/sd-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of an UNLOCKED SD card after the system - has been suspended -_steps: - 1. Click "Test" and insert an UNLOCKED SD card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Automated check for SD card detection post system suspension. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/sd-storage-after-suspend -estimated_duration: 10.0 -depends: suspend/sd-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: - This test is automated and executes after the mediacard/sd-insert-after-suspend test - is run. It tests reading and writing to the SD card after the system has been suspended. -_summary: Test reading and writing to the SD card after system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/sd-remove-after-suspend -estimated_duration: 30.0 -depends: suspend/sd-insert-after-suspend -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects - the removal of an SD card from the system's card reader - after the system has been suspended. -_steps: - 1. Click "Test" and remove the SD card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Check that the system detects SD card removal after suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/sdhc-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of an UNLOCKED SDHC media card after the - system has been suspended -_steps: - 1. Click "Test" and insert an UNLOCKED SDHC card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: - Verify the media card reader's ability to detect an UNLOCKED SDHC media after system suspension. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/sdhc-storage-after-suspend -estimated_duration: 10.0 -depends: suspend/sdhc-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: - This test is automated and executes after the mediacard/sdhc-insert-after-suspend test - is run. It tests reading and writing to the SDHC card after the system has been suspended. -_summary: Automated test for SDHC card read/write after system suspend. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: suspend/sdhc-remove-after-suspend -estimated_duration: 30.0 -depends: suspend/sdhc-insert-after-suspend -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of an SDHC card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the SDHC card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Check the system's ability to detect the removal of an SDHC card from the card reader after suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/cf-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of a CF card after the system has been suspended -_steps: - 1. Click "Test" and insert a CF card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify that a CF card is detected after the system resumes from suspension. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: mediacard/cf-storage-after-suspend -estimated_duration: 10.0 -depends: mediacard/cf-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: - This test is automated and executes after the mediacard/cf-insert-after-suspend test is run. It tests reading and writing to the CF card after the system has been suspended. -_summary: Automate reading and writing test on the CF card after system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/cf-remove-after-suspend -estimated_duration: 30.0 -depends: mediacard/cf-insert-after-suspend -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of a CF card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the CF card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify system detects CF card removal after suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/sdxc-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of a SDXC card after the system has been suspended -_steps: - 1. Click "Test" and insert a SDXC card into the reader. - If a file browser opens up, you can safely close it. - (Note: This test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Automate the verification of SDXC card detection post system suspension. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: mediacard/sdxc-storage-after-suspend -estimated_duration: 10.0 -depends: mediacard/sdxc-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: - This test is automated and executes after the mediacard/sdxc-insert-after-suspend test - is run. It tests reading and writing to the SDXC card after the system has been suspended. -_summary: Automate testing of SDXC card read/write operations post system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/sdxc-remove-after-suspend -depends: mediacard/sdxc-insert-after-suspend -estimated_duration: 30.0 -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of a SDXC card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the SDXC card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify the detection of SDXC card removal post-system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/ms-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of a MS card after the system has been suspended -_steps: - 1. Click "Test" and insert a MS card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Ensure the system's media card reader detects a MS card insertion post system suspension. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: mediacard/ms-storage-after-suspend -estimated_duration: 10.0 -depends: mediacard/ms-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: This test is automated and executes after the mediacard/ms-insert-after-suspend test is run. It tests reading and writing to the MS card after the system has been suspended. -_summary: Execute reading and writing test on MS card after system suspension and following the mediacard/ms-insert-after-suspend test. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/ms-remove-after-suspend -estimated_duration: 30.0 -depends: mediacard/ms-insert-after-suspend -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of a MS card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the MS card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify the system detects the removal of a MS card after suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/msp-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of a MSP card after the system has been suspended -_steps: - 1. Click "Test" and insert a MSP card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify detection of a MSP card insertion into a media card reader after system suspension. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: mediacard/msp-storage-after-suspend -estimated_duration: 10.0 -depends: mediacard/msp-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: - This test is automated and executes after the mediacard/msp-insert-after-suspend test - is run. It tests reading and writing to the MSP card after the system has been suspended. -_summary: Automated test for reading and writing to the MSP card after system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/msp-remove-after-suspend -estimated_duration: 30.0 -depends: mediacard/msp-insert-after-suspend -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of a MSP card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the MSP card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Check the system's detection of MSP card removal after suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/xd-insert-after-suspend -estimated_duration: 30.0 -depends: suspend/suspend_advanced_auto -imports: from com.canonical.plainbox import manifest -requires: - package.name == 'udisks2' or snap.name == 'udisks2' - manifest.has_card_reader == 'True' -command: removable_storage_watcher.py --memorycard insert sdio usb scsi -_purpose: - This test will check that the system's media card reader can - detect the insertion of a xD card after the system has been suspended -_steps: - 1. Click "Test" and insert a xD card into the reader. - If a file browser opens up, you can safely close it. - (Note: this test will time-out after 20 seconds.) - 2. Do not remove the device after this test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: Verify media card reader functionality post-suspension by detecting xD card insertion. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: mediacard/xd-storage-after-suspend -estimated_duration: 10.0 -depends: mediacard/xd-insert-after-suspend -user: root -command: removable_storage_test.py -s 268400000 --memorycard sdio usb scsi -_purpose: - This test is automated and executes after the mediacard/xd-insert-after-suspend test - is run. It tests reading and writing to the xD card after the system has been suspended. -_summary: Test reading and writing to xD card after system suspension. - -plugin: user-interact -category_id: com.canonical.plainbox::suspend -id: mediacard/xd-remove-after-suspend -estimated_duration: 30.0 -depends: mediacard/xd-insert-after-suspend -command: removable_storage_watcher.py --memorycard remove sdio usb scsi -_purpose: - This test will check that the system correctly detects the removal - of a xD card from the system's card reader after the system has been suspended. -_steps: - 1. Click "Test" and remove the xD card from the reader. - (Note: this test will time-out after 20 seconds.) -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -_summary: - Verifies system detection of xD card removal from the card reader after suspension. - plugin: shell category_id: com.canonical.plainbox::suspend id: touchpad/touchpad_after_suspend diff --git a/providers/base/units/thunderbolt/jobs.pxu b/providers/base/units/thunderbolt/jobs.pxu index ce19c1f70f..979ef79382 100644 --- a/providers/base/units/thunderbolt/jobs.pxu +++ b/providers/base/units/thunderbolt/jobs.pxu @@ -1,72 +1,29 @@ plugin: user-interact category_id: com.canonical.plainbox::disk -id: thunderbolt/insert -user: root -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt == 'True' -estimated_duration: 20.0 -command: - checkbox-support-run_watcher insertion thunderbolt -_siblings: [ - { "id": "after-suspend-thunderbolt/insert", - "_summary": "thunderbolt/insert after suspend", - "depends": "suspend/suspend_advanced_auto"} - ] -_summary: Storage insert detection on Thunderbolt -_purpose: - This test will check if the insertion of a Thunderbolt HDD could be detected -_steps: - 1. Click 'Test' to begin the test. This test will - timeout and fail if the insertion has not been detected within 40 seconds. - 2. Plug a Thunderbolt HDD into an available Thunderbolt port, if it's not - mounted automatically, please click the HDD icon to mount it. -_verification: - The verification of this test is automated. Do not change the automatically - selected result - -plugin: shell -category_id: com.canonical.plainbox::disk -id: thunderbolt/storage-test -user: root -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt == 'True' -depends: thunderbolt/insert -estimated_duration: 45.0 -command: - checkbox-support-usb_read_write -_siblings: [ - { "id": "after-suspend-thunderbolt/storage-test", - "_summary": "thunderbolt/storage-test after suspend", - "depends": "after-suspend-thunderbolt/insert"} - ] -_summary: Storage test on Thunderbolt -_purpose: This is an automated test which performs read/write operations on an attached Thunderbolt HDD - -plugin: user-interact -category_id: com.canonical.plainbox::disk -id: thunderbolt/remove +id: thunderbolt/storage-manual +flags: also-after-suspend user: root imports: from com.canonical.plainbox import manifest requires: manifest.has_thunderbolt == 'True' -depends: thunderbolt/insert -estimated_duration: 10.0 +estimated_duration: 120.0 command: - checkbox-support-run_watcher insertion thunderbolt -_summary: Storage removal detection on Thunderbolt -_siblings: [ - { "id": "after-suspend-thunderbolt/remove", - "_summary": "Thunderbolt/remove after suspend", - "depends": "after-suspend-thunderbolt/insert"} - ] + checkbox-support-run_watcher storage thunderbolt +_summary: Thunderbolt HDD storage insertion + read/write + removal _purpose: - This test will check the system can detect the removal of a Thunderbolt HDD + This test will check if the connection of a Thunderbolt HDD could be detected, + then performs read/write operations on the attached Thunderbolt HDD storage and + checks if the removal of the Thunderbolt HDD can be detected. _steps: - 1. Click 'Test' to begin the test. This test will timeout and fail if - the removal has not been detected within 20 seconds. - 2. Remove the previously attached Thunderbolt HDD from the Thunderbolt port. + 1. Click 'Test' to begin the test. This test will + timeout and fail if the insertion has not been detected within 30 seconds. + 2. Plug a Thunderbolt HDD into an available Thunderbolt port, if it's not + mounted automatically, please click the HDD icon to mount it. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the previously attached Thunderbolt HDD. _verification: - The verification of this test is automated. Do not change the automatically - selected result + The verification of this test is automated. Do not change the automatically + selected result plugin: user-interact-verify category_id: com.canonical.plainbox::disk @@ -92,74 +49,30 @@ _verification: plugin: user-interact category_id: com.canonical.plainbox::disk -id: thunderbolt3/insert -flags: also-after-suspend -user: root -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -estimated_duration: 20.0 -command: - checkbox-support-run_watcher insertion thunderbolt -_summary: Storage insert detection on Thunderbolt 3 port -_purpose: - This test will check if the insertion of a Thunderbolt 3 HDD could be detected -_steps: - 1. Click 'Test' to begin the test. This test will - timeout and fail if the insertion has not been detected within 40 seconds. - 2. Plug a Thunderbolt HDD into an available Thunderbolt 3 port, if it's not - mounted automatically, please click the HDD icon to mount it. -_verification: - The verification of this test is automated. Do not change the automatically - selected result - -plugin: shell -category_id: com.canonical.plainbox::disk -id: thunderbolt3/storage-test +id: thunderbolt3/storage-manual flags: also-after-suspend user: root imports: from com.canonical.plainbox import manifest requires: manifest.has_thunderbolt3 == 'True' -depends: thunderbolt3/insert -estimated_duration: 45.0 -command: - checkbox-support-usb_read_write -_summary: Storage test on Thunderbolt 3 -_purpose: This is an automated test which performs read/write operations on an attached Thunderbolt HDD - -plugin: shell -category_id: com.canonical.plainbox::disk -id: thunderbolt3/storage-preinserted -user: root -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -estimated_duration: 45.0 -command: removable_storage_test.py -s 268400000 scsi -flags: also-after-suspend -_summary: Storage test on Thunderbolt 3 pre-inserted -_purpose: - This is an automated test which performs read/write operations on a preinserted Thunderbolt HDD - -plugin: user-interact -category_id: com.canonical.plainbox::disk -id: thunderbolt3/remove -user: root -flags: also-after-suspend -imports: from com.canonical.plainbox import manifest -requires: manifest.has_thunderbolt3 == 'True' -depends: thunderbolt3/insert -estimated_duration: 10.0 +estimated_duration: 120.0 command: - checkbox-support-run_watcher removal thunderbolt -_summary: Storage removal detection on Thunderbolt 3 port + checkbox-support-run_watcher storage thunderbolt +_summary: Thunderbolt 3 HDD storage insertion + read/write + removal _purpose: - This test will check if the system can detect the removal of a Thunderbolt 3 HDD + This test will check if the connection of a Thunderbolt 3 HDD could be detected, + then performs read/write operations on the attached Thunderbolt 3 HDD storage and + checks if the removal of the Thunderbolt 3 HDD can be detected. _steps: - 1. Click 'Test' to begin the test. This test will timeout and fail if - the removal has not been detected within 20 seconds. - 2. Remove the previously attached Thunderbolt HDD from the Thunderbolt port. + 1. Click 'Test' to begin the test. This test will + timeout and fail if the insertion has not been detected within 30 seconds. + 2. Plug a Thunderbolt 3 HDD into an available Thunderbolt 3 port, if it's not + mounted automatically, please click the HDD icon to mount it. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the previously attached Thunderbolt 3 HDD. _verification: - The verification of this test is automated. Do not change the automatically - selected result + The verification of this test is automated. Do not change the automatically + selected result plugin: user-interact-verify category_id: com.canonical.plainbox::disk diff --git a/providers/base/units/thunderbolt/test-plan.pxu b/providers/base/units/thunderbolt/test-plan.pxu index d876201e1a..0b6bc7f170 100644 --- a/providers/base/units/thunderbolt/test-plan.pxu +++ b/providers/base/units/thunderbolt/test-plan.pxu @@ -23,9 +23,7 @@ _name: Thunderbolt tests (Manual) _description: Thunderbolt tests (Manual) include: - thunderbolt3/insert certification-status=blocker - thunderbolt3/storage-test certification-status=blocker - thunderbolt3/remove certification-status=blocker + thunderbolt3/storage-manual certification-status=blocker id: thunderbolt-cert-automated unit: test plan @@ -40,9 +38,7 @@ unit: test plan _name: Thunderbolt tests (certification blockers only) _description: Thunderbolt tests (certification blockers only) include: - thunderbolt3/insert certification-status=blocker - thunderbolt3/storage-test certification-status=blocker - thunderbolt3/remove certification-status=blocker + thunderbolt3/storage-manual certification-status=blocker id: after-suspend-thunderbolt-cert-manual unit: test plan @@ -50,15 +46,11 @@ _name: Thunderbolt tests (after suspend Manual) _description: Thunderbolt tests (after suspend Manual) include: - after-suspend-thunderbolt3/insert certification-status=blocker - after-suspend-thunderbolt3/storage-test certification-status=blocker - after-suspend-thunderbolt3/remove certification-status=blocker + after-suspend-thunderbolt3/storage-manual certification-status=blocker id: after-suspend-thunderbolt-cert-blockers unit: test plan _name: Thunderbolt tests (after suspend - certification blockers only) _description: Thunderbolt tests (after suspend - certification blockers only) include: - after-suspend-thunderbolt3/insert certification-status=blocker - after-suspend-thunderbolt3/storage-test certification-status=blocker - after-suspend-thunderbolt3/remove certification-status=blocker + after-suspend-thunderbolt3/storage-manual certification-status=blocker diff --git a/providers/base/units/usb/test-plan.pxu b/providers/base/units/usb/test-plan.pxu index 0f34c41e4c..b35949c314 100644 --- a/providers/base/units/usb/test-plan.pxu +++ b/providers/base/units/usb/test-plan.pxu @@ -14,10 +14,8 @@ _name: USB tests (Manual) _description: USB tests (Manual) include: - usb/HID certification-status=blocker - usb/insert certification-status=blocker - usb/storage-automated certification-status=blocker - usb/remove certification-status=blocker + usb/hid certification-status=blocker + usb/storage-manual certification-status=blocker id: usb-cert-automated unit: test plan @@ -51,9 +49,7 @@ _name: USB3 tests (Manual) _description: USB3 tests (Manual) include: - usb3/insert certification-status=blocker - usb3/storage-automated certification-status=blocker - usb3/remove certification-status=blocker + usb3/storage-manual certification-status=blocker id: usb3-cert-automated unit: test plan @@ -62,20 +58,15 @@ _description: USB3 tests (Automated) include: - id: usb-c-cert-full unit: test plan _name: USB Type-C tests _description: USB Type-C tests include: usb-c/c-to-a-adapter/hid certification-status=blocker - usb-c/c-to-a-adapter/insert certification-status=blocker - usb-c/c-to-a-adapter/storage-automated certification-status=blocker - usb-c/c-to-a-adapter/remove certification-status=blocker + usb-c/c-to-a-adapter/storage-manual certification-status=blocker usb-c/hid certification-status=blocker - usb-c/insert certification-status=blocker - usb-c/storage-automated certification-status=blocker - usb-c/remove certification-status=blocker + usb-c/storage-manual certification-status=blocker usb-c/c-to-ethernet-adapter-insert id: after-suspend-usb-cert-full @@ -83,19 +74,15 @@ unit: test plan _name: USB tests (after suspend) _description: USB tests (after suspend) include: - after-suspend-usb/HID certification-status=blocker - after-suspend-usb/insert certification-status=blocker - after-suspend-usb/storage-automated certification-status=blocker - after-suspend-usb/remove certification-status=blocker + after-suspend-usb/hid certification-status=blocker + after-suspend-usb/storage-manual certification-status=blocker id: after-suspend-usb3-cert-full unit: test plan _name: USB3 tests (after suspend) _description: USB3 tests (after suspend) include: - after-suspend-usb3/insert certification-status=blocker - after-suspend-usb3/storage-automated certification-status=blocker - after-suspend-usb3/remove certification-status=blocker + after-suspend-usb3/storage-manual certification-status=blocker id: after-suspend-usb-c-cert-full unit: test plan @@ -103,13 +90,9 @@ _name: USB Type-C tests (after suspend) _description: USB Type-C tests (after suspend) include: after-suspend-usb-c/c-to-a-adapter/hid certification-status=blocker - after-suspend-usb-c/c-to-a-adapter/insert certification-status=blocker - after-suspend-usb-c/c-to-a-adapter/storage-automated certification-status=blocker - after-suspend-usb-c/c-to-a-adapter/remove certification-status=blocker + after-suspend-usb-c/c-to-a-adapter/storage-manual certification-status=blocker after-suspend-usb-c/hid certification-status=blocker - after-suspend-usb-c/insert certification-status=blocker - after-suspend-usb-c/storage-automated certification-status=blocker - after-suspend-usb-c/remove certification-status=blocker + after-suspend-usb-c/storage-manual certification-status=blocker after-suspend-usb-c/c-to-ethernet-adapter-insert id: usb-cert-blockers @@ -118,19 +101,15 @@ _name: USB tests (certification blockers only) _description: USB tests (certification blockers only) include: usb/detect certification-status=blocker - usb/HID certification-status=blocker - usb/insert certification-status=blocker - usb/storage-automated certification-status=blocker - usb/remove certification-status=blocker + usb/hid certification-status=blocker + usb/storage-manual certification-status=blocker id: usb3-cert-blockers unit: test plan _name: USB3 tests (certification blockers only) _description: USB3 tests (certification blockers only) include: - usb3/insert certification-status=blocker - usb3/storage-automated certification-status=blocker - usb3/remove certification-status=blocker + usb3/storage-manual certification-status=blocker id: usb-c-cert-blockers unit: test plan @@ -138,31 +117,24 @@ _name: USB Type-C tests (certification blockers only) _description: USB Type-C tests (certification blockers only) include: usb-c/c-to-a-adapter/hid certification-status=blocker - usb-c/c-to-a-adapter/insert certification-status=blocker - usb-c/c-to-a-adapter/storage-automated certification-status=blocker - usb-c/c-to-a-adapter/remove certification-status=blocker + usb-c/c-to-a-adapter/storage-manual certification-status=blocker usb-c/hid certification-status=blocker - usb-c/insert certification-status=blocker - usb-c/storage-automated certification-status=blocker - usb-c/remove certification-status=blocker + usb-c/storage-manual certification-status=blocker id: after-suspend-usb-cert-blockers unit: test plan _name: USB tests (after suspend, certification blockers only) _description: USB tests (after suspend, certification blockers only) include: - suspend/usb_insert_after_suspend certification-status=blocker - suspend/usb_storage_automated_after_suspend certification-status=blocker - suspend/usb_remove_after_suspend certification-status=blocker + after-suspend-usb/hid certification-status=blocker + after-suspend-usb/storage-manual certification-status=blocker id: after-suspend-usb3-cert-blockers unit: test plan _name: USB3 tests (after suspend, certification blockers only) _description: USB3 tests (after suspend, certification blockers only) include: - suspend/usb3_insert_after_suspend certification-status=blocker - suspend/usb3_storage_automated_after_suspend certification-status=blocker - suspend/usb3_remove_after_suspend certification-status=blocker + after-suspend-usb3/storage-manual certification-status=blocker id: after-suspend-usb-c-cert-blockers unit: test plan @@ -170,13 +142,9 @@ _name: USB Type-C tests (after suspend, certification blockers only) _description: USB Type-C tests (after suspend, certification blockers only) include: after-suspend-usb-c/c-to-a-adapter/hid certification-status=blocker - after-suspend-usb-c/c-to-a-adapter/insert certification-status=blocker - after-suspend-usb-c/c-to-a-adapter/storage-automated certification-status=blocker - after-suspend-usb-c/c-to-a-adapter/remove certification-status=blocker + after-suspend-usb-c/c-to-a-adapter/storage-manual certification-status=blocker after-suspend-usb-c/hid certification-status=blocker - after-suspend-usb-c/insert certification-status=blocker - after-suspend-usb-c/storage-automated certification-status=blocker - after-suspend-usb-c/remove certification-status=blocker + after-suspend-usb-c/storage-manual certification-status=blocker id: usb-preinserted unit: test plan @@ -221,9 +189,7 @@ _name: Manual USB tests _description: Manual USB tests for Ubuntu Core devices include: usb/hid certification-status=blocker - usb/insert certification-status=blocker - usb/storage-automated certification-status=blocker # depends on manual one, so not automated - usb/remove certification-status=blocker + usb/storage-manual certification-status=blocker id: usb-automated unit: test plan @@ -248,9 +214,7 @@ unit: test plan _name: Manual USB3 tests _description: Manual USB3 tests for Ubuntu Core devices include: - usb3/insert - usb3/storage-automated # depends on manual one, so not automated - usb3/remove + usb3/storage-manual id: usb3-automated unit: test plan @@ -273,13 +237,9 @@ _name: Manual USB-C tests _description: Manual USB-C tests for Ubuntu Core devices include: usb-c/c-to-a-adapter/hid - usb-c/c-to-a-adapter/insert - usb-c/c-to-a-adapter/storage-automated - usb-c/c-to-a-adapter/remove + usb-c/c-to-a-adapter/storage-manual usb-c/hid - usb-c/insert - usb-c/storage-automated - usb-c/remove + usb-c/storage-manual usb-c-otg/g_serial usb-c-otg/g_serial-cleanup usb-c-otg/g_mass_storage @@ -307,9 +267,7 @@ _name: Manual USB tests (after suspend) _description: Manual USB tests for Ubuntu Core devices include: after-suspend-usb/hid - after-suspend-usb/insert - after-suspend-usb/storage-automated # depends on manual one, so not automated - after-suspend-usb/remove + after-suspend-usb/storage-manual id: after-suspend-usb3-full unit: test plan @@ -324,9 +282,7 @@ unit: test plan _name: Manual USB3 tests (after suspend) _description: Manual USB3 tests for Ubuntu Core devices include: - after-suspend-usb3/insert - after-suspend-usb3/storage-automated # depends on manual one, so not automated - after-suspend-usb3/remove + after-suspend-usb3/storage-manual id: after-suspend-usb3-automated unit: test plan @@ -348,13 +304,9 @@ _name: Manual USB-C tests (after suspend) _description: Manual USB-C tests for Ubuntu Core devices include: after-suspend-usb-c/c-to-a-adapter/hid - after-suspend-usb-c/c-to-a-adapter/insert - after-suspend-usb-c/c-to-a-adapter/storage-automated - after-suspend-usb-c/c-to-a-adapter/remove + after-suspend-usb-c/c-to-a-adapter/storage-manual after-suspend-usb-c/hid - after-suspend-usb-c/insert - after-suspend-usb-c/storage-automated - after-suspend-usb-c/remove + after-suspend-usb-c/storage-manual after-suspend-usb-c-otg/g_serial after-suspend-usb-c-otg/g_serial-cleanup after-suspend-usb-c-otg/g_mass_storage diff --git a/providers/base/units/usb/usb-c.pxu b/providers/base/units/usb/usb-c.pxu index cf386f7717..0cce4cc9d9 100644 --- a/providers/base/units/usb/usb-c.pxu +++ b/providers/base/units/usb/usb-c.pxu @@ -16,76 +16,40 @@ imports: from com.canonical.plainbox import manifest requires: manifest.has_usbc_data == 'True' estimated_duration: 60 -id: usb-c/c-to-a-adapter/insert +id: usb-c/c-to-a-adapter/storage-manual +_summary: + Test USB 3 storage device insertion + read/write + removal using a "Type-C to Type-A" adapter. _purpose: - This test will check that the system correctly detects the insertion of - a USB 3 storage device in a USB Type-C connector using a "Type-C to Type-A" - adapter. - NOTE: Make sure the USB storage device has a partition before starting - the test. + This test will check that the system correctly detects the insertion of + a USB 3 storage device in a USB Type-C connector using a "Type-C to Type-A" + adapter. + Then it performs a read and write test on the device. Finally, it + checks that the system correctly detects the removal of the USB 3 storage. + NOTE: Make sure the USB 3 storage device has a partition before starting + the test. _steps: - 1. Commence the test - 2. Connect a USB 3 storage device to a USB Type-C port using a - "Type-C to Type-A" adapter. - 3. Do not unplug the device after the test. + 1. Commence and then insert a USB 3 storage device to a USB Type-C port + using a "Type-C to Type-A" adapter. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the USB 3 storage from the reader. + (Note: this test will time-out after 30 seconds.) _verification: - The verification of this test is automated. Do not change the - automatically selected result. + The verification of this test is automated. Do not change the + automatically selected result. plugin: user-interact flags: also-after-suspend user: root command: - checkbox-support-run_watcher insertion usb3 + checkbox-support-run_watcher storage usb3 category_id: com.canonical.plainbox::usb imports: from com.canonical.plainbox import manifest requires: - usb.usb3 == 'supported' - manifest.has_usbc_data == 'True' -estimated_duration: 30 -_summary: Verify that the system detects a USB 3 storage device using a "Type-C to Type-A" adapter. - -id: usb-c/c-to-a-adapter/storage-automated -_description: - This test is automated and executes after the usb-c/c-to-a-adapter/insert test - is run. -plugin: shell -flags: also-after-suspend -user: root -command: - checkbox-support-usb_read_write -category_id: com.canonical.plainbox::usb -imports: from com.canonical.plainbox import manifest -requires: - manifest.has_usbc_data == 'True' -depends: usb-c/c-to-a-adapter/insert -estimated_duration: 60 -_purpose: This test is automated and executes after the usb-c/c-to-a-adapter/insert test is run. -_summary: Automate the execution process post usb-c/c-to-a-adapter/insert test. - -id: usb-c/c-to-a-adapter/remove -_purpose: - This test will check that the system correctly detects the removal of - a USB 3 storage device connected to a USB Type-C port using a "USB Type-C - to Type-A" adapter. -_steps: - 1. Begin the test - 2. Disconnect a USB 3 storage device from a USB Type-C port using a - "Type-C to Type-A" adapter -_verification: - The verification of this test is automated. Do not modify the - automatically selected result. -plugin: user-interact -flags: also-after-suspend -user: root -command: - checkbox-support-run_watcher removal usb3 -category_id: com.canonical.plainbox::usb -depends: usb-c/c-to-a-adapter/insert -imports: from com.canonical.plainbox import manifest -requires: - manifest.has_usbc_data == 'True' -estimated_duration: 30 -_summary: Check the detection of a USB 3 storage device removal, connected via a "Type-C to Type-A" adapter. + usb.usb3 == 'supported' + manifest.has_usbc_data == 'True' +estimated_duration: 120 id: usb-c/hid _summary: USB HID work on USB Type-C port @@ -105,71 +69,37 @@ imports: from com.canonical.plainbox import manifest requires: manifest.has_usbc_data == 'True' estimated_duration: 60 -id: usb-c/insert -_summary: USB 3.0 storage device insertion detected on USB Type-C port -_purpose: - This test will check that the system correctly detects the insertion of - a USB 3.0 storage device in a USB Type-C connector. - NOTE: Make sure the USB storage device has a partition before starting - the test. -_steps: - 1. Commence the test. - 2. Connect a USB 3.0 storage device to a USB Type-C port. - 3. Do not unplug the device after the test. -_verification: - The verification of this test is automated. Do not change the - automatically selected result. -plugin: user-interact -flags: also-after-suspend -user: root -command: - checkbox-support-run_watcher insertion usb3 -category_id: com.canonical.plainbox::usb -imports: from com.canonical.plainbox import manifest -requires: - usb.usb3 == 'supported' - manifest.has_usbc_data == 'True' -estimated_duration: 30 - -id: usb-c/storage-automated -_summary: USB 3.0 storage device read & write works on USB Type-C port -_purpose: - This test is automated and executes after the usb-c/insert test is run. -plugin: shell -flags: also-after-suspend -user: root -command: - checkbox-support-usb_read_write -category_id: com.canonical.plainbox::usb -imports: from com.canonical.plainbox import manifest -requires: - manifest.has_usbc_data == 'True' -depends: usb-c/insert -estimated_duration: 60 - -id: usb-c/remove -_summary: USB 3.0 storage device removal detected on USB Type-C port +id: usb-c/storage-manual +_summary: USB 3.0 storage device insertion + read/write + removal on USB Type-C port _purpose: - This test will check that the system correctly detects the removal of - a USB 3.0 storage device connected to a USB Type-C port. + This test will check that the system correctly detects the insertion of + a USB 3.0 storage device in a USB Type-C connector. + Then it performs a read and write test on the device. Finally, it + checks that the system correctly detects the removal of the USB 3 storage. + NOTE: Make sure the USB 3 storage device has a partition before starting + the test. _steps: - 1. Commence the test - 2. Connect a USB 3.0 storage device to a USB Type-C port - 3. Disconnect the USB 3.0 storage device from the USB Type-C port + 1. Commence the test and then insert a USB 3.0 storage device to a USB Type-C port. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the USB 3 storage from the reader. + (Note: this test will time-out after 30 seconds.) _verification: - The system should automatically detect the removal of the USB 3.0 storage device. The verification of this test is automated. Do not change the - automatically selected result. + The verification of this test is automated. Do not change the + automatically selected result. plugin: user-interact flags: also-after-suspend user: root command: - checkbox-support-run_watcher removal usb3 + checkbox-support-run_watcher storage usb3 category_id: com.canonical.plainbox::usb -depends: usb-c/insert imports: from com.canonical.plainbox import manifest requires: - manifest.has_usbc_data == 'True' -estimated_duration: 30 + usb.usb3 == 'supported' + manifest.has_usbc_data == 'True' +estimated_duration: 120 id: usb-c/c-to-ethernet-adapter-insert plugin: user-interact diff --git a/providers/base/units/usb/usb.pxu b/providers/base/units/usb/usb.pxu index 7d181e7704..82c0d56084 100644 --- a/providers/base/units/usb/usb.pxu +++ b/providers/base/units/usb/usb.pxu @@ -51,94 +51,65 @@ _verification: Did the device work as expected? _summary: Verify USB HID devices functionality by performing specified actions. -id: usb/insert +id: usb/storage-manual flags: also-after-suspend fail-on-resource -_summary: USB 2.0 storage device insertion detected +_summary: Test USB 2.0 storage device insertion + read/write + removal. _purpose: - Check system can detect USB 2.0 storage when inserted. - NOTE: Make sure the USB storage device has a partition before starting - the test. + Check system can detect insertion of a USB 2.0 storage device. + Then it performs a read and write test on the USB 2.0. Finally, it + checks that the system correctly detects the removal of the USB 2.0. + NOTE: Make sure the USB storage device has a partition before starting + the test. _steps: - 1. Press continue - 2. Wait until the message "INSERT NOW" is printed on the screen - 3. Connect USB 2.0 storage device + 1. Commence the test and then insert an USB 2.0 into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the USB 2.0 from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. plugin: user-interact user: root command: - checkbox-support-run_watcher insertion usb2 + checkbox-support-run_watcher storage usb2 category_id: com.canonical.plainbox::usb estimated_duration: 120 -id: usb3/insert +id: usb3/storage-manual flags: also-after-suspend requires: usb.usb3 == 'supported' -_summary: USB 3.0 storage device insertion detected +_summary: Test USB 3.0 storage device insertion + read/write + removal. _purpose: - Check system can detect insertion of a USB 3.0 storage device. - NOTE: Make sure the USB storage device has a partition before starting - the test. + Check system can detect insertion of a USB 3.0 storage device. + Then it performs a read and write test on the USB 3.0. Finally, it + checks that the system correctly detects the removal of the USB 3.0. + NOTE: Make sure the USB storage device has a partition before starting + the test. _steps: - 1. Press continue. - 2. Wait until the message "INSERT NOW" is displayed on the screen. - 3. Connect USB 3.0 storage device. + 1. Commence the test and then insert an USB 3.0 into the reader. + (Note: this test will time-out after 30 seconds.) + 2. Do not remove the device after this test. + 3. Wait for the read/write operations to complete. + 4. Press Enter to start the removal test. + 5. Remove the USB 3.0 from the reader. + (Note: this test will time-out after 30 seconds.) _verification: The verification of this test is automated. Do not change the automatically selected result. plugin: user-interact user: root command: - checkbox-support-run_watcher insertion usb3 -category_id: com.canonical.plainbox::usb -estimated_duration: 120 - -id: usb/remove -flags: also-after-suspend -_summary: USB 2.0 storage device removal detected -_purpose: - Check system can detect removal of a USB 2.0 storage device -_steps: - 1. Press continue - 2. Wait until the message "REMOVE NOW" is printed on the screen - 3. Disconnect USB 2.0 storage device -_verification: - The verification of this test is automated. - Do not change the automatically selected result. -plugin: user-interact -depends: usb/insert -user: root -command: - checkbox-support-run_watcher removal usb2 -category_id: com.canonical.plainbox::usb -estimated_duration: 120 - -id: usb3/remove -flags: also-after-suspend -_summary: USB 3.0 storage device removal detected -_purpose: - Check system can detect removal of a USB 3.0 storage device -_steps: - 1. Press continue - 2. Wait until the message "REMOVE NOW" is printed on the screen - 3. Disconnect USB 3.0 storage device -_verification: - The verification of this test is automated. - Do not change the automatically selected result. -plugin: user-interact -depends: usb3/insert -user: root -command: - checkbox-support-run_watcher removal usb3 + checkbox-support-run_watcher storage usb3 category_id: com.canonical.plainbox::usb estimated_duration: 120 plugin: user-interact-verify category_id: com.canonical.plainbox::usb id: usb/storage-transfer -depends: usb/insert user: root estimated_duration: 45.0 command: removable_storage_test.py -s 268400000 usb @@ -159,7 +130,6 @@ category_id: com.canonical.plainbox::usb id: usb3/storage-transfer requires: usb.usb3 == 'supported' -depends: usb3/insert user: root estimated_duration: 45.0 command: removable_storage_test.py -s 268400000 -m 500000000 usb @@ -175,39 +145,7 @@ _verification: automatically selected result. _summary: Check the USB 3.0 connection and data transfer capability. -id: usb/storage-automated -flags: also-after-suspend -_summary: USB 2.0 storage device read & write works -_purpose: - Check system can read/write to USB 2.0 storage correctly -_steps: - 1. This task is fully automatic and need USB 2.0 insertion test was applied first. -_verification: - This task is fully automatic and will verify the result for you. -plugin: shell -depends: usb/insert -user: root -command: - checkbox-support-usb_read_write -category_id: com.canonical.plainbox::usb -estimated_duration: 300 -id: usb3/storage-automated -flags: also-after-suspend -_summary: USB 3.0 storage device read & write works -_purpose: - Check system can read/write to USB 3.0 storage devices correctly -_steps: - 1. This task is fully automatic and need USB 3.0 insertion test was applied first. -_verification: - This task is fully automatic and will verify the result for you. -plugin: shell -depends: usb3/insert -user: root -command: - checkbox-support-usb_read_write -category_id: com.canonical.plainbox::usb -estimated_duration: 300 plugin: shell category_id: com.canonical.plainbox::usb @@ -273,13 +211,16 @@ _summary: Test USB connectivity by connecting a USB storage device to all extern plugin: shell category_id: com.canonical.plainbox::usb id: usb/performance -depends: usb/insert +flags: also-after-suspend user: root estimated_duration: 45.00 command: removable_storage_test.py -s 268400000 -p 15 usb _purpose: This test will check that your USB 2.0 port transfers data at a minimum expected speed. +_steps: + 1. Plug a USB 2.0 HDD or thumbdrive into the computer. + 2. Start the test. _summary: Verify USB 2.0 port data transfer speeds meet minimum expectations. id: usb/storage-detect diff --git a/providers/base/units/zapper/jobs.pxu b/providers/base/units/zapper/jobs.pxu index 59ca4727a1..e4657142ad 100644 --- a/providers/base/units/zapper/jobs.pxu +++ b/providers/base/units/zapper/jobs.pxu @@ -18,18 +18,16 @@ category_id: com.canonical.plainbox::usb id: usb/zapper-usb-insert-{{ port_alias }} template-id: usb/zapper-usb-insert-port_alias template-engine: jinja2 -_summary: Zapper-driven USB insertion test on port {{ port_alias }} +_summary: Zapper-driven USB insertion + removal test on port {{ port_alias }} +_purpose: + Check the insertion and removal of a USB 2.0 storage device using zapper. requires: usb.usb2 == 'supported' plugin: shell user: root environ: ZAPPER_HOST command: - {%- if __on_ubuntucore__ %} - checkbox-support-run_watcher --zapper-usb-address={{ port_alias }} insertion usb2 - {%- else %} - removable_storage_watcher.py --unmounted --zapper-usb-address={{ port_alias }} insert usb - {% endif -%} -estimated_duration: 20 + checkbox-support-run_watcher --zapper-usb-address={{ port_alias }} insertion usb2 +estimated_duration: 30 unit: template template-resource: zapper_capabilities @@ -38,58 +36,16 @@ category_id: com.canonical.plainbox::usb id: usb3/zapper-usb-insert-{{ port_alias }} template-id: usb3/zapper-usb-insert-port_alias template-engine: jinja2 -_summary: Zapper-driven USB 3.0 insertion test on port {{ port_alias }} +_summary: Zapper-driven USB 3 insertion + removal test test on port {{ port_alias }} +_purpose: + Check the insertion and removal of a USB 3.0 storage device using zapper. requires: usb.usb3 == 'supported' plugin: shell user: root environ: ZAPPER_HOST command: - {%- if __on_ubuntucore__ %} - checkbox-support-run_watcher --zapper-usb-address={{ port_alias }} insertion usb3 - {%- else %} - removable_storage_watcher.py --unmounted -m 500000000 --zapper-usb-address={{ port_alias }} insert usb - {% endif -%} -estimated_duration: 20 - -unit: template -template-resource: zapper_capabilities -template-filter: zapper_capabilities.capability == 'USB hotplug' and zapper_capabilities.usb_version == '2' -category_id: com.canonical.plainbox::usb -id: usb/zapper-usb-remove-{{ port_alias }} -template-id: usb/zapper-usb-remove-port_alias -template-engine: jinja2 -_summary: Zapper-driven USB removal test on port {{ port_alias }} -requires: usb.usb2 == 'supported' -plugin: shell -user: root -environ: ZAPPER_HOST -command: - {%- if __on_ubuntucore__ %} - checkbox-support-run_watcher --zapper-usb-address={{ port_alias }} removal usb2 - {%- else %} - removable_storage_watcher.py --unmounted --zapper-usb-address={{ port_alias }} remove usb - {% endif -%} -estimated_duration: 20 - -unit: template -template-resource: zapper_capabilities -template-filter: zapper_capabilities.capability == 'USB hotplug' and zapper_capabilities.usb_version == '3' -category_id: com.canonical.plainbox::usb -id: usb3/zapper-usb-remove-{{ port_alias }} -template-id: usb3/zapper-usb-remove-port_alias -template-engine: jinja2 -_summary: Zapper-driven USB 3.0 removal test on port {{ port_alias }} -requires: usb.usb3 == 'supported' -plugin: shell -user: root -environ: ZAPPER_HOST -command: - {%- if __on_ubuntucore__ %} - checkbox-support-run_watcher --zapper-usb-address={{ port_alias }} removal usb3 - {%- else %} - removable_storage_watcher.py --unmounted -m 500000000 --zapper-usb-address={{ port_alias }} remove usb - {% endif -%} -estimated_duration: 20 + checkbox-support-run_watcher --zapper-usb-address={{ port_alias }} insertion usb3 +estimated_duration: 30 id: bluetooth/zapper-a2dp requires: zapper_capabilities.capability == 'bluetooth' and 'a2dp' in zapper_capabilities.profiles diff --git a/providers/base/units/zapper/test-plan.pxu b/providers/base/units/zapper/test-plan.pxu index bbfafe182f..03892f1b15 100644 --- a/providers/base/units/zapper/test-plan.pxu +++ b/providers/base/units/zapper/test-plan.pxu @@ -15,9 +15,7 @@ include: input/zapper-keyboard monitor/zapper-edid usb/zapper-usb-insert-.* - usb/zapper-usb-remove-.* usb3/zapper-usb-insert-.* - usb3/zapper-usb-remove-.* bootstrap_include: desktop_session graphics_card diff --git a/providers/certification-client/units/client-cert-desktop-regression.pxu b/providers/certification-client/units/client-cert-desktop-regression.pxu index ea36e28527..7431fe72ab 100644 --- a/providers/certification-client/units/client-cert-desktop-regression.pxu +++ b/providers/certification-client/units/client-cert-desktop-regression.pxu @@ -58,9 +58,7 @@ include: touchpad/vertical usb/detect usb/HID - usb/insert - usb/storage-automated - usb/remove + usb/storage-manual wireless/wireless_scanning suspend/suspend-time-check suspend/suspend-single-log-attach