Beispiel #1
0
  def Prepare(self, args):
    """Load, apply defaults, and perform validation on test arguments.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        gcloud command invocation (i.e. group and command arguments combined).
        Arg values from an optional arg-file and/or arg default values may be
        added to this argparse namespace.

    Raises:
      InvalidArgumentException: If an argument name is unknown, an argument does
        not contain a valid value, or an argument is not valid when used with
        the given type of test.
      RequiredArgumentException: If a required arg is missing.
    """
    all_test_args_set = arg_util.GetSetOfAllTestArgs(self._typed_arg_rules,
                                                     self._shared_arg_rules)
    args_from_file = arg_file.GetArgsFromArgFile(args.argspec,
                                                 all_test_args_set)
    arg_util.ApplyLowerPriorityArgs(args, args_from_file, True)

    test_type = self.GetTestTypeOrRaise(args)
    typed_arg_defaults = self._typed_arg_rules[test_type]['defaults']
    shared_arg_defaults = self._shared_arg_rules['defaults']
    arg_util.ApplyLowerPriorityArgs(args, typed_arg_defaults)
    arg_util.ApplyLowerPriorityArgs(args, shared_arg_defaults)

    arg_validate.ValidateArgsForTestType(args, test_type, self._typed_arg_rules,
                                         self._shared_arg_rules,
                                         all_test_args_set)
    arg_validate.ValidateIosDeviceList(args, self._catalog_mgr)
    arg_validate.ValidateResultsBucket(args)
    arg_validate.ValidateResultsDir(args)
Beispiel #2
0
    def Prepare(self, args):
        """Load, apply defaults, and perform validation on test arguments.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        gcloud command invocation (i.e. group and command arguments combined).
        Arg values from an optional arg-file and/or arg default values may be
        added to this argparse namespace.

    Raises:
      InvalidArgumentException: If an argument name is unknown, an argument does
        not contain a valid value, or an argument is not valid when used with
        the given type of test.
      RequiredArgumentException: If a required arg is missing.
    """
        all_test_args_set = arg_util.GetSetOfAllTestArgs(
            self._typed_arg_rules, self._shared_arg_rules)
        args_from_file = arg_file.GetArgsFromArgFile(args.argspec,
                                                     all_test_args_set)
        arg_util.ApplyLowerPriorityArgs(args, args_from_file, True)

        test_type = self.GetTestTypeOrRaise(args)
        self._CheckForConflictingArgs(args)

        typed_arg_defaults = self._typed_arg_rules[test_type]['defaults']
        shared_arg_defaults = self._shared_arg_rules['defaults']
        arg_util.ApplyLowerPriorityArgs(args, typed_arg_defaults)
        arg_util.ApplyLowerPriorityArgs(args, shared_arg_defaults)
        self._ApplyLegacyMatrixDimensionDefaults(args)

        arg_validate.ValidateArgsForTestType(args, test_type,
                                             self._typed_arg_rules,
                                             self._shared_arg_rules,
                                             all_test_args_set)
        arg_validate.ValidateOsVersions(args, self._catalog_mgr)
        arg_validate.ValidateDeviceList(args, self._catalog_mgr)
        arg_validate.ValidateResultsBucket(args)
        arg_validate.ValidateResultsDir(args)
        arg_validate.NormalizeAndValidateObbFileNames(args.obb_files)
        arg_validate.ValidateRoboDirectivesList(args)
        arg_validate.ValidateEnvironmentVariablesList(args)
        arg_validate.ValidateTestTargetsForShard(args)
        arg_validate.NormalizeAndValidateDirectoriesToPullList(
            args.directories_to_pull)
        arg_validate.ValidateScenarioNumbers(args)
Beispiel #3
0
def AllArgsSet():
    """Returns a set containing the names of every Android test arg."""
    return arg_util.GetSetOfAllTestArgs(TypedArgRules(), SharedArgRules())
 def testGetSetOfAllTestArgs_OnTestRules(self):
   all_args = arg_util.GetSetOfAllTestArgs(fake_args.TypedArgRules(),
                                           fake_args.SharedArgRules())
   self.assertEquals(fake_args.AllArgsSet(), all_args)