def test_get_cpu_devs(self):
     fake_adb(output_str=panda_cpu_info)
     devs = lava_android_test.hwprofile.get_cpu_devs()
     clear_fake()
     cpuinfo = {
         'attributes': {
             'processor': '1',
             'cpu_features':
             'swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls',
             'cpu_variant': 1,
             'cpu_architecture': 7,
             'BogoMIPS': '1539.77',
             'Hardware': 'OMAP4 Panda board',
             'cpu_implementer': 65,
             'cpu_part': 3081,
             'cpu_revision': 2,
             'Serial': '0000000000000000',
             'Revision': '0020'
         },
         'description': 'Processor #1',
         'device_type': 'device.cpu'
     }
     self.assertEqual(cpuinfo, devs[1])
     cpuinfo = {
         'attributes': {
             'processor': '0',
             'cpu_model_name': 'ARMv7 Processor rev 2 (v7l)',
             'BogoMIPS': '1576.53'
         },
         'description': 'Processor #0',
         'device_type': 'device.cpu'
     }
     self.assertEqual(cpuinfo, devs[0])
Ejemplo n.º 2
0
 def test_bad_meminfo(self):
     errmsg = 'WARNING: Could not read memory information\n'
     fake_adb(output_str='', ret_code=255)
     devs = lava_android_test.hwprofile.get_mem_devs()
     clear_fake()
     self.assertEqual([], devs)
     self.assertEqual(errmsg, self.out.getvalue())
 def test_bad_meminfo(self):
     errmsg = 'WARNING: Could not read memory information\n'
     fake_adb(output_str='', ret_code=255)
     devs = lava_android_test.hwprofile.get_mem_devs()
     clear_fake()
     self.assertEqual([], devs)
     self.assertEqual(errmsg, self.out.getvalue())
Ejemplo n.º 4
0
 def test_run_command_test_not_install(self):
     errmsg = 'ERROR: The test (monkey) has not been installed yet.'
     fake_adb(output_str='RET_CODE=1')
     ret_code = LAVAAndroidTestDispatcher().dispatch(['run', 'monkey'])
     self.assertEqual(1, ret_code)
     self.assertTrue(errmsg in self.out.getvalue())
     clear_fake()
Ejemplo n.º 5
0
 def test_get_cpu_devs(self):
     fake_adb(output_str=panda_cpu_info)
     devs = lava_android_test.hwprofile.get_cpu_devs()
     clear_fake()
     cpuinfo = {
         'attributes': {
             'processor': '1',
             'cpu_features':
                 'swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls',
             'cpu_variant': 1,
             'cpu_architecture': 7,
             'BogoMIPS': '1539.77',
             'Hardware': 'OMAP4 Panda board',
             'cpu_implementer': 65,
             'cpu_part': 3081,
             'cpu_revision': 2,
             'Serial': '0000000000000000',
             'Revision': '0020'},
         'description': 'Processor #1',
         'device_type': 'device.cpu'}
     self.assertEqual(cpuinfo, devs[1])
     cpuinfo = {
         'attributes': {
             'processor': '0',
             'cpu_model_name': 'ARMv7 Processor rev 2 (v7l)',
             'BogoMIPS': '1576.53'},
         'description': 'Processor #0',
         'device_type': 'device.cpu'}
     self.assertEqual(cpuinfo, devs[0])
Ejemplo n.º 6
0
 def test_list_installed(self):
     # test_name must be in the BuiltInProvider._builtin_tests
     fake_adb(output_str=dir_list_info)
     test_name = "monkey"
     self._runLavaTest(['list-installed'])
     self.assertTrue(test_name in self.out.getvalue())
     clear_fake()
    def test_run(self):
        config = get_config()
        test_name = 'foo'
        clear_fake()
        testrunner = makerunner(steps_host_pre=["echo foo"])
        test = maketest(name=test_name, runner=testrunner)
        real_installed_path = '%s/%s/%s' % (test_tmp,
                                            config.installdir_android,
                                             test_name)
        test.setadb(FakeAdb())
        self.assertFalse(os.path.exists(real_installed_path))
        test.install()
        self.assertTrue(os.path.exists(real_installed_path))

        fake_adb(output_str=fake_output_str)
        result_id = test.run()
        self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue())

        result_id_pattern = "foo\d+\.\d+"
        self.assertTrue(re.match(result_id_pattern, result_id))
        self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue())

        test.uninstall()

        self.assertFalse(os.path.exists(real_installed_path))
Ejemplo n.º 8
0
 def test_get_board_devs(self):
     fake_adb(output_str=panda_cpu_info)
     devs = lava_android_test.hwprofile.get_board_devs()
     clear_fake()
     boardinfo = {
         'description': 'OMAP4 Panda board',
         'device_type': 'device.board'}
     self.assertEqual(boardinfo, devs[0])
 def test_get_board_devs(self):
     fake_adb(output_str=panda_cpu_info)
     devs = lava_android_test.hwprofile.get_board_devs()
     clear_fake()
     boardinfo = {
         'description': 'OMAP4 Panda board',
         'device_type': 'device.board'
     }
     self.assertEqual(boardinfo, devs[0])
Ejemplo n.º 10
0
    def test_get_mem_devs(self):
        fake_adb(output_str=panda_mem_info)
        devs = lava_android_test.hwprofile.get_mem_devs()
        clear_fake()

        meminfo = {
            'attributes': {
                'kind': 'RAM',
                'capacity': '943955968'},
            'description': '900MiB of RAM',
            'device_type': 'device.mem'}
        self.assertEqual(meminfo, devs[0])
    def test_get_mem_devs(self):
        fake_adb(output_str=panda_mem_info)
        devs = lava_android_test.hwprofile.get_mem_devs()
        clear_fake()

        meminfo = {
            'attributes': {
                'kind': 'RAM',
                'capacity': '943955968'
            },
            'description': '900MiB of RAM',
            'device_type': 'device.mem'
        }
        self.assertEqual(meminfo, devs[0])
Ejemplo n.º 12
0
    def test_get_package_info(self):
        fake_adb(output_str=package_list_info)
        result = swprofile.get_package_info()
        clear_fake()
        packages = {'android': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
           'com.android.musicvis': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
           'com.android.videoeditor': '1.1 (#11)',
           'com.android.vpndialogs': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
           'com.android.wallpaper': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
           'com.android.wallpaper.livepicker': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
           'com.svox.pico': '1.0 (#1)'}
        result_hash = {}
        for package in result:
            result_hash[package.get('name')] = package.get('version')

        self.assertEqual(packages, result_hash)
Ejemplo n.º 13
0
 def test_get_properties(self):
     fake_adb(output_str=getprop_info)
     result = swprofile.get_properties()
     clear_fake()
     properties = {'dalvik.vm.heapsize': '24m',
         'dalvik.vm.stack-trace-file': '/data/anr/traces.txt',
         'dev.bootcomplete': '1',
         'gsm.current.phone-type': '1',
         'ro.build.date': 'Wed Oct 12 12:35:47 PDT 2011',
         'ro.build.description': 'sdk-eng 4.0.1 ICS_MR0 202595 test-keys',
         'ro.build.display.id': 'sdk-eng 4.0.1 ICS_MR0 202595 test-keys',
         'ro.build.host': 'android-test-37.mtv.corp.google.com',
         'ro.build.id': 'ICS_MR0',
         'ro.build.product': 'generic',
         'ro.build.tags': 'test-keys',
         'ro.build.type': 'eng',
         'ro.build.version.sdk': '14'}
     self.assertEqual(properties, result)
    def test_get_package_info(self):
        fake_adb(output_str=package_list_info)
        result = swprofile.get_package_info()
        clear_fake()
        packages = {
            'android': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
            'com.android.musicvis': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
            'com.android.videoeditor': '1.1 (#11)',
            'com.android.vpndialogs': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
            'com.android.wallpaper': '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
            'com.android.wallpaper.livepicker':
            '4.0.1.2.3.4.5.6.7.8.9-3 (#14)',
            'com.svox.pico': '1.0 (#1)'
        }
        result_hash = {}
        for package in result:
            result_hash[package.get('name')] = package.get('version')

        self.assertEqual(packages, result_hash)
 def test_get_properties(self):
     fake_adb(output_str=getprop_info)
     result = swprofile.get_properties()
     clear_fake()
     properties = {
         'dalvik.vm.heapsize': '24m',
         'dalvik.vm.stack-trace-file': '/data/anr/traces.txt',
         'dev.bootcomplete': '1',
         'gsm.current.phone-type': '1',
         'ro.build.date': 'Wed Oct 12 12:35:47 PDT 2011',
         'ro.build.description': 'sdk-eng 4.0.1 ICS_MR0 202595 test-keys',
         'ro.build.display.id': 'sdk-eng 4.0.1 ICS_MR0 202595 test-keys',
         'ro.build.host': 'android-test-37.mtv.corp.google.com',
         'ro.build.id': 'ICS_MR0',
         'ro.build.product': 'generic',
         'ro.build.tags': 'test-keys',
         'ro.build.type': 'eng',
         'ro.build.version.sdk': '14'
     }
     self.assertEqual(properties, result)
    def test_run(self):
        config = get_config()
        test_name = 'foo'
        clear_fake()
        testrunner = makerunner(steps_host_pre=["echo foo"])
        test = maketest(name=test_name, runner=testrunner)
        real_installed_path = '%s/%s/%s' % (
            test_tmp, config.installdir_android, test_name)
        test.setadb(FakeAdb())
        self.assertFalse(os.path.exists(real_installed_path))
        test.install()
        self.assertTrue(os.path.exists(real_installed_path))

        fake_adb(output_str=fake_output_str)
        result_id = test.run()
        self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue())

        result_id_pattern = "foo\d+\.\d+"
        self.assertTrue(re.match(result_id_pattern, result_id))
        self.assertTrue("LAVA: (stdout) foo" in self.out.getvalue())

        test.uninstall()

        self.assertFalse(os.path.exists(real_installed_path))
Ejemplo n.º 17
0
 def setUp(self):
     self.config = self.add_fixture(ConfigImposter())
     self.out = self.add_fixture(OutputImposter())
     clear_fake()
 def tearDown(self):
     clear_fake()
 def setUp(self):
     super(TestAndroidTest, self).setUp()
     self.config = self.add_fixture(ConfigImposter())
     self.out = self.add_fixture(OutputImposter())
     clear_fake()
 def test_getimage_name_from_properties(self):
     fake_adb(output_str=getprop_info)
     image_name = swprofile.get_image_name_from_properties()
     clear_fake()
     self.assertEqual('sdk-eng 4.0.1 ICS_MR0 202595 test-keys', image_name)
Ejemplo n.º 21
0
 def test_list_devices(self):
     # test_name must be in the BuiltInProvider._builtin_tests
     fake_adb(output_str=devices_list_info)
     self._runLavaTest(['list-devices'])
     self.assertTrue('192.168.1.109:5555    device' in self.out.getvalue())
     clear_fake()
 def setUp(self):
     super(TestAndroidTest, self).setUp()
     self.config = self.add_fixture(ConfigImposter())
     self.out = self.add_fixture(OutputImposter())
     clear_fake()
Ejemplo n.º 23
0
 def setUp(self):
     super(MissingFiles, self).setUp()
     clear_fake()
     self.out = self.add_fixture(OutputImposter())
 def tearDown(self):
     clear_fake()
 def setUp(self):
     super(MissingFiles, self).setUp()
     clear_fake()
     self.out = self.add_fixture(OutputImposter())
Ejemplo n.º 26
0
 def test_getimage_name_from_properties(self):
     fake_adb(output_str=getprop_info)
     image_name = swprofile.get_image_name_from_properties()
     clear_fake()
     self.assertEqual('sdk-eng 4.0.1 ICS_MR0 202595 test-keys', image_name)