cros-disks: Remove obsolete tests.
BUG=chromium:955858
TEST=CQ
Cq-Depend: chromium:2567296
Change-Id: I301b1c1fee748f43de1c2f7a17bde34a057737a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2567329
Reviewed-by: François Degros <fdegros@chromium.org>
Tested-by: François Degros <fdegros@chromium.org>
Tested-by: Sergei Datsenko <dats@chromium.org>
Commit-Queue: Sergei Datsenko <dats@chromium.org>
diff --git a/client/site_tests/platform_CrosDisksFormat/control b/client/site_tests/platform_CrosDisksFormat/control
deleted file mode 100644
index c6f9f86..0000000
--- a/client/site_tests/platform_CrosDisksFormat/control
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-AUTHOR = "ChromeOS Team"
-NAME = "platform_CrosDisksFormat"
-PURPOSE = "Verify that cros-disks can format supported filesystems correctly"
-
-CRITERIA = """
-"""
-ATTRIBUTES = "suite:bvt-perbuild"
-TIME = "SHORT"
-TEST_CATEGORY = "Functional"
-TEST_CLASS = "platform"
-TEST_TYPE = "client"
-
-DOC = """
-Calls cros-disks to format supported filesystems
-"""
-
-job.run_test('platform_CrosDisksFormat', timeout_s=10,
- config_file='vfat_tests', tag='vfat')
-job.run_test('platform_CrosDisksFormat', timeout_s=10,
- config_file='exfat_tests', tag='exfat')
-job.run_test('platform_CrosDisksFormat', timeout_s=10,
- config_file='ntfs_tests', tag='ntfs')
diff --git a/client/site_tests/platform_CrosDisksFormat/exfat_tests b/client/site_tests/platform_CrosDisksFormat/exfat_tests
deleted file mode 100644
index ad49e0b..0000000
--- a/client/site_tests/platform_CrosDisksFormat/exfat_tests
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "description": "exFAT filesystem",
- "filesystem_type": "exfat",
- "expected_format_status": 0,
- "format_options": []
- },
- {
- "description": "exFAT filesystem with label",
- "filesystem_type": "exfat",
- "expected_format_status": 0,
- "format_options": ["Label", "exfatname"]
- }
-]
diff --git a/client/site_tests/platform_CrosDisksFormat/ntfs_tests b/client/site_tests/platform_CrosDisksFormat/ntfs_tests
deleted file mode 100644
index e4614d6..0000000
--- a/client/site_tests/platform_CrosDisksFormat/ntfs_tests
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "description": "NTFS filesystem",
- "filesystem_type": "ntfs",
- "expected_format_status": 0,
- "format_options": []
- },
- {
- "description": "NTFS filesystem with label",
- "filesystem_type": "ntfs",
- "expected_format_status": 0,
- "format_options": ["Label", "ntfsname"]
- }
-]
diff --git a/client/site_tests/platform_CrosDisksFormat/platform_CrosDisksFormat.py b/client/site_tests/platform_CrosDisksFormat/platform_CrosDisksFormat.py
deleted file mode 100644
index cffa629..0000000
--- a/client/site_tests/platform_CrosDisksFormat/platform_CrosDisksFormat.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import logging
-import json
-
-from autotest_lib.client.bin import test
-from autotest_lib.client.common_lib import error
-from autotest_lib.client.cros.cros_disks import CrosDisksTester
-from autotest_lib.client.cros.cros_disks import VirtualFilesystemImage
-from autotest_lib.client.cros.cros_disks import DefaultFilesystemTestContent
-
-
-class CrosDisksFormatTester(CrosDisksTester):
- """A tester to verify format support in CrosDisks.
- """
- def __init__(self, test, test_configs):
- super(CrosDisksFormatTester, self).__init__(test)
- self._test_configs = test_configs
-
- def _run_test_config(self, config):
- logging.info('Testing "%s"', config['description'])
- filesystem_type = config['filesystem_type']
- format_options = config.get('format_options')
- # Create a zero-filled virtual filesystem image to help simulate
- # a removable drive.
- with VirtualFilesystemImage(
- block_size=1024,
- block_count=65536,
- filesystem_type=filesystem_type) as image:
- # Attach the zero-filled virtual filesystem image to a loop device
- # without actually formatting it.
- device_file = image.attach_to_loop_device()
-
- self.cros_disks.add_loopback_to_allowlist(device_file)
- try:
- # Format the virtual filesystem image via CrosDisks.
- self.cros_disks.format(device_file, filesystem_type,
- format_options)
- expected_format_completion = {'path': device_file}
- if 'expected_format_status' in config:
- expected_format_completion['status'] = \
- config['expected_format_status']
- result = self.cros_disks.expect_format_completion(
- expected_format_completion)
- finally:
- self.cros_disks.remove_loopback_from_allowlist(device_file)
-
- if result['status'] == 0:
- # Test creating and verifying content the formatted device.
- logging.info("Test filesystem access on formatted device")
- test_content = DefaultFilesystemTestContent()
- mount_path = image.mount()
- if not test_content.create(mount_path):
- raise error.TestFail("Failed to create test content")
- if not test_content.verify(mount_path):
- raise error.TestFail("Failed to verify test content")
-
- try:
- label_idx = format_options.index("Label") + 1
- expected_label = format_options[label_idx]
- except ValueError:
- # Label option not found in format options
- expected_label = "UNTITLED"
- if expected_label != image.get_volume_label():
- raise error.TestFail("Failed to label the drive")
-
- def test_using_virtual_filesystem_image(self):
- for config in self._test_configs:
- self._run_test_config(config)
-
- def get_tests(self):
- return [self.test_using_virtual_filesystem_image]
-
-
-class platform_CrosDisksFormat(test.test):
- version = 1
-
- def run_once(self, *args, **kwargs):
- test_configs = []
- config_file = '%s/%s' % (self.bindir, kwargs['config_file'])
- with open(config_file, 'rb') as f:
- test_configs.extend(json.load(f))
-
- tester = CrosDisksFormatTester(self, test_configs)
- tester.run(*args, **kwargs)
diff --git a/client/site_tests/platform_CrosDisksFormat/vfat_tests b/client/site_tests/platform_CrosDisksFormat/vfat_tests
deleted file mode 100644
index 1520812..0000000
--- a/client/site_tests/platform_CrosDisksFormat/vfat_tests
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "description": "VFAT filesystem",
- "filesystem_type": "vfat",
- "expected_format_status": 0,
- "format_options": []
- },
- {
- "description": "VFAT filesystem",
- "filesystem_type": "vfat",
- "expected_format_status": 0,
- "format_options": ["Label", "VFATNAME"]
- }
-]
diff --git a/client/site_tests/platform_CrosDisksSshfs/control b/client/site_tests/platform_CrosDisksSshfs/control
deleted file mode 100644
index 42b72b3..0000000
--- a/client/site_tests/platform_CrosDisksSshfs/control
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-AUTHOR = "ChromeOS Team"
-NAME = "platform_CrosDisksSshfs"
-PURPOSE = "Verify that cros-disks can mount sshfs correctly"
-
-CRITERIA = """
-"""
-ATTRIBUTES = "suite:bvt-perbuild"
-TIME = "SHORT"
-TEST_CATEGORY = "Functional"
-TEST_CLASS = "platform"
-TEST_TYPE = "client"
-
-DOC = """
-Calls cros-disks to mount sshfs
-"""
-
-job.run_test('platform_CrosDisksSshfs', timeout_s=10,
- config_file='sshfs_tests', tag='sshfs')
diff --git a/client/site_tests/platform_CrosDisksSshfs/platform_CrosDisksSshfs.py b/client/site_tests/platform_CrosDisksSshfs/platform_CrosDisksSshfs.py
deleted file mode 100644
index 9b0b3e3..0000000
--- a/client/site_tests/platform_CrosDisksSshfs/platform_CrosDisksSshfs.py
+++ /dev/null
@@ -1,182 +0,0 @@
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import base64
-import logging
-import json
-import os
-import tempfile
-
-from autotest_lib.client.bin import test
-from autotest_lib.client.bin import utils
-from autotest_lib.client.common_lib import error
-from autotest_lib.client.cros.cros_disks import CrosDisksTester
-
-
-def try_remove(filename):
- try:
- os.remove(filename)
- return True
- except OSError:
- return False
-
-
-class CrosDisksFuseTester(CrosDisksTester):
- """Common steps for all FUSE-based tests.
- """
- def __init__(self, test, test_configs):
- super(CrosDisksFuseTester, self).__init__(test)
- self._test_configs = test_configs
-
- def setup_test_case(self, config):
- pass
-
- def teardown_test_case(self, config):
- pass
-
- def verify_test_case(self, config, mount_result):
- pass
-
- def _test_case(self, config):
- logging.info('Testing "%s"', config['description'])
- self.setup_test_case(config)
- try:
- source = config['test_mount_source_uri']
- fstype = config.get('test_mount_filesystem_type')
- options = config.get('test_mount_options', [])
- expected_mount_completion = {
- 'status': config['expected_mount_status'],
- 'source_path': source,
- }
- if 'expected_mount_path' in config:
- expected_mount_completion['mount_path'] = \
- config['expected_mount_path']
-
- self.cros_disks.mount(source, fstype, options)
- result = self.cros_disks.expect_mount_completion(
- expected_mount_completion)
- try:
- self.verify_test_case(config, result)
- finally:
- self.cros_disks.unmount(source, ['lazy'])
- finally:
- self.teardown_test_case(config)
-
- def _run_all_test_cases(self):
- try:
- for config in self._test_configs:
- self._test_case(config)
- except RuntimeError:
- cmd = 'ls -la %s' % tempfile.gettempdir()
- logging.debug(utils.run(cmd))
- raise
-
- def get_tests(self):
- return [self._run_all_test_cases]
-
-
-SSH_DIR_PATH = '/home/chronos/user/.ssh'
-AUTHORIZED_KEYS = os.path.join(SSH_DIR_PATH, 'authorized_keys')
-AUTHORIZED_KEYS_BACKUP = AUTHORIZED_KEYS + '.sshfsbak'
-
-# Some discardable SSH key.
-SSH_PRIVATE_KEY = '''-----BEGIN RSA PRIVATE KEY-----
-MIIEogIBAAKCAQEAvKhQn82O9F+SzDTYgpI+qnCD6E6cYroLvflLp8/onYdqD1xK
-ES4wDTGC68DNbS9tIo1hEjwbD79UltQT9NTmJg8DERUrQbNayYXtwxqZ2tSo1Hg5
-dpAKLd3GBhwK1Eob+bNgcqEu3iIZq+QRVtlM92Uj4vBFuy8qgvGs4x+n3lACsyk8
-4GZGtiFpqTPlTZ6BOEdknZpB0K3HIZ7NjZ8uD9fXJYFuUgQhQvhp1N8aZaf7JtWr
-GLQ8Pwq6UYEVb8veHgLVAJ9p/5ko/WNVWf1h78v95pEHSYrQ0opcSDizbquW/1Fs
-Fk6elrQcKctJ1FsXMxlWYOzN31yNxcPqT6rzhQIDAQABAoIBAAcD50OZ/DfgGfBY
-ArkQQR5LYsxPqAcPzgH5dDPASnEZKPt7PhHXetfywGCN4dWujstbIIHyFDuIrNeS
-+U8AX7KIml+XPu2JgtW9kjLQGWqGv+RuuAxNnONJvORbRJfSTaoCXpLE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sv5BcYWxkhc4aAmvUJwyAzlWEhyijwFK5wSQ=
------END RSA PRIVATE KEY-----
-'''
-
-SSH_PUBLIC_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8qFCfzY' \
- '70X5LMNNiCkj6qcIPoTpxiugu9+Uunz+idh2oPXEoRLjANMYLrwM1tL' \
- '20ijWESPBsPv1SW1BP01OYmDwMRFStBs1rJhe3DGpna1KjUeDl2kAot' \
- '3cYGHArUShv5s2ByoS7eIhmr5BFW2Uz3ZSPi8EW7LyqC8azjH6feUAK' \
- 'zKTzgZka2IWmpM+VNnoE4R2SdmkHQrcchns2Nny4P19clgW5SBCFC+G' \
- 'nU3xplp/sm1asYtDw/CrpRgRVvy94eAtUAn2n/mSj9Y1VZ/WHvy/3mk' \
- 'QdJitDSilxIOLNuq5b/UWwWTp6WtBwpy0nUWxczGVZg7M3fXI3Fw+pP' \
- 'qvOF root@localhost'
-
-
-class CrosDisksSshfsTester(CrosDisksFuseTester):
- """A tester to verify sshfs support in CrosDisks.
- """
- def __init__(self, test, test_configs):
- super(CrosDisksSshfsTester, self).__init__(test, test_configs)
-
- def setup_test_case(self, config):
- if os.path.exists(AUTHORIZED_KEYS):
- # Make backup of the current authorized_keys
- utils.run('mv -f ' + AUTHORIZED_KEYS + ' ' + AUTHORIZED_KEYS_BACKUP,
- ignore_status=True)
-
- self._register_key(SSH_PUBLIC_KEY)
-
- identity = base64.b64encode(SSH_PRIVATE_KEY)
- known_hosts = base64.b64encode(self._generate_known_hosts())
-
- options = config.get('test_mount_options', [])
- options.append('IdentityBase64=' + identity)
- options.append('UserKnownHostsBase64=' + known_hosts)
- config['test_mount_options'] = options
-
- def teardown_test_case(self, config):
- if os.path.exists(AUTHORIZED_KEYS_BACKUP):
- # Restore authorized_keys from backup.
- utils.run('mv -f ' + AUTHORIZED_KEYS_BACKUP + ' ' + AUTHORIZED_KEYS,
- ignore_status=True)
-
- def verify_test_case(self, config, mount_result):
- if 'expected_file' in config:
- f = config['expected_file']
- if not os.path.exists(f):
- raise error.TestFail('Expected file "' + f + '" not found')
-
- def _register_key(self, pubkey):
- utils.run('sudo -u chronos mkdir -p ' + SSH_DIR_PATH,
- ignore_status=True)
- utils.run('sudo -u chronos touch ' + AUTHORIZED_KEYS)
- with open(AUTHORIZED_KEYS, 'wb') as f:
- f.write(pubkey)
- utils.run('sudo -u chronos chmod 0600 ' + AUTHORIZED_KEYS)
-
- def _generate_known_hosts(self):
- hostkey = '/mnt/stateful_partition/etc/ssh/ssh_host_ed25519_key.pub'
- with open(hostkey, 'rb') as f:
- keydata = f.readline().split()
- return 'localhost {} {}\n'.format(keydata[0], keydata[1])
-
-
-class platform_CrosDisksSshfs(test.test):
- version = 1
-
- def run_once(self, *args, **kwargs):
- test_configs = []
- config_file = '%s/%s' % (self.bindir, kwargs['config_file'])
- with open(config_file, 'rb') as f:
- test_configs.extend(json.load(f))
-
- tester = CrosDisksSshfsTester(self, test_configs)
- tester.run(*args, **kwargs)
diff --git a/client/site_tests/platform_CrosDisksSshfs/sshfs_tests b/client/site_tests/platform_CrosDisksSshfs/sshfs_tests
deleted file mode 100644
index 84d294d..0000000
--- a/client/site_tests/platform_CrosDisksSshfs/sshfs_tests
+++ /dev/null
@@ -1,9 +0,0 @@
-[
- {
- "description": "SSHFS filesystem with custom credentials",
- "test_mount_source_uri": "sshfs://chronos@localhost:",
- "expected_mount_status": 0,
- "expected_mount_path": "/media/fuse/chronos@localhost:",
- "expected_file": "/media/fuse/chronos@localhost:/.ssh"
- }
-]