Exemplo n.º 1
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()
    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))
Exemplo n.º 3
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()
Exemplo n.º 4
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_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])
Exemplo n.º 6
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])
 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())
Exemplo 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])
Exemplo n.º 9
0
 def test_run_command_test_not_exist(self):
     errmsg = "unknown test 'abc'"
     fake_adb(output_str='RET_CODE=0')
     self.assertRaises(SystemExit, LAVAAndroidTestDispatcher().dispatch,
                        ['run', 'abc'])
     self.assertNotEqual(None, re.search(errmsg, self.out.getvalue()),
                          re.MULTILINE)
     self.assertTrue(errmsg in self.out.getvalue())
 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])
Exemplo n.º 11
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])
Exemplo n.º 13
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)
Exemplo n.º 14
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))
 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)
Exemplo n.º 19
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)
Exemplo n.º 20
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()