Пример #1
0
def test_test_empty_config():
    """Test a property without a valid config"""

    testutils.deploy_config_raw("")

    assert prop.test_prop('info', 'sdk') == 0

    testutils.undeploy()

    return 0
Пример #2
0
def test_test_invalid_property():
    """Test a missingproperty"""

    contents = ("[Info]\n" "vmtype = arm64")

    testutils.deploy_config_raw(contents)

    assert prop.test_prop('info', 'sdk') == 0

    testutils.undeploy()

    return 0
Пример #3
0
def test_test_property():
    """Test a valid property"""

    contents = ("[Info]\n" "sdk = 23")

    testutils.deploy_config_raw(contents)

    assert prop.test_prop('info', 'sdk') == 1

    testutils.undeploy()

    return 0
Пример #4
0
def test_test_property_casing():
    """Test a prop with alternating casing"""

    sdk = '23'
    contents = ("[Info]\n" "sdk = %s" % sdk)

    testutils.deploy_config_raw(contents)

    assert prop.test_prop('info', 'sdk') == 1

    testutils.undeploy()

    return 0
Пример #5
0
    def do_test(self, args):
        """Test if a value is set or not"""

        rtn = 0

        if len(args) != 2:
            log.e(self.name, "A section and property must be specified.")
            rtn = self.usage()

        else:
            section = args[0]
            prop_name = args[1]

            rtn = test_prop(section, prop_name)

        return rtn
Пример #6
0
    def do_test(self, args):

        """Test if a value is set or not"""

        rtn = 0

        if len(args) != 2:
            log.e(self.name, "A section and property must be specified.")
            rtn = self.usage()

        else:
            section = args[0]
            prop_name = args[1]

            rtn = test_prop(section, prop_name)

        return rtn
Пример #7
0
    def get_diff_dir(cls):
        """Determine which diffing db to use"""

        # First check for a property override.
        if prop.test_prop('Local', 'diff-data-dir'):
            diff_dir = prop.get_prop('Local', 'diff-data-dir')

            if not os.path.isdir(diff_dir):
                raise DtfException("Unable to find diffing directory!")
            else:
                return diff_dir

        # Not set
        else:
            sdk = prop.get_prop("Info", "sdk")
            if pm.is_package_installed("aosp-data-%s" % sdk):

                diff_dir = ("%s/aosp-data-%s" % (DTF_PACKAGES_DIR, sdk))

                return diff_dir
            else:
                raise DtfException("AOSP data not installed for this API!")