コード例 #1
0
ファイル: viewTestSuitePlugin.py プロジェクト: lanl/Pavilion
    def cmd(self, args):

        if args['verbose']:
            print "Command args -> %s" % args
            #print "input test suite file -> %s\n" % args['testSuite']
        
        if (os.path.isfile(args['testSuite'])):
            with open(args['testSuite']) as file:
                # Build the test configuration
                tc = YamlTestConfig(args['testSuite'])
                
            if args['dict']:
                
                print "\nUser test suite configuration (dict style):"
                print tc.user_config_doc
                
                print "\nDefault test suite configuration (dict style):"
                print tc.default_config_doc
  
                print "\nEffective test configuration (dict style, combined User and Default):"
                print tc.get_effective_config_file()

            else:

                print "\nUser test suite configuration (yaml style):"
                tc.show_user_test_config()
    
                print "\nDefault test suite configuration (yaml style):"
                tc.show_default_config()
    
                print "\nEffective test suite configuration (yaml style, combined User and Default):"
                tc.show_effective_config_file()

        else:
            print "  Error: could not find test suite %s" % args['testSuite']
            sys.exit()
コード例 #2
0
    def cmd(self, args):

        if args['verbose']:
            print "Command args -> %s" % args
            #print "input test suite file -> %s\n" % args['testSuite']

        tc = YamlTestConfig(args['testSuite'],
                            testname=args['testname'],
                            hostname=args['name'],
                            modelist=args['mode'])

        if args['dict']:

            print "\nUser test suite configuration (dict style):"
            print tc.user_config_doc

            print "\nDefault test suite configuration (dict style):"
            print tc.default_config_doc

            print "\nEffective test configuration (dict style, combined User and Default):"

            # Check if custom arguments are specified to change individual parameters
            my_test_suite = tc.get_effective_config_file()
            if args['custom'] != []:
                custom_list = []
                for custom in args['custom']:
                    if custom[0] == '*':
                        for key, val in my_test_suite.iteritems():
                            self.logger.info(
                                'Expanding custom parameter to %s' %
                                (key + custom[1:]))
                            custom_list.append(key + custom[1:])
                for custom in custom_list:
                    if '.' in custom:
                        custom_dict = decompose_str(custom)
                        modify_dict(my_test_suite,
                                    custom_dict.keys()[0],
                                    custom_dict.values()[0])
                    else:
                        my_test_suite[custom.split('=')[0]] = custom.split(
                            '=')[1]
            print my_test_suite

        else:

            print "\nUser test suite configuration (yaml style):"
            tc.show_user_test_config()

            print "\nDefault test suite configuration (yaml style):"
            tc.show_default_config()

            print "\nEffective test suite configuration (yaml style, combined User and Default):"

            # Check if custom arguments are specified to change individual parameters
            my_test_suite = tc.get_effective_config_file()
            if args['custom'] != []:
                custom_list = []
                for custom in args['custom']:
                    if custom[0] == '*':
                        for key, val in my_test_suite.iteritems():
                            self.logger.info(
                                'Expanding custom parameter to %s' %
                                (key + custom[1:]))
                            custom_list.append(key + custom[1:])
                for custom in custom_list:
                    if '.' in custom:
                        custom_dict = decompose_str(custom)
                        modify_dict(my_test_suite,
                                    custom_dict.keys()[0],
                                    custom_dict.values()[0])
                    else:
                        my_test_suite[custom.split('=')[0]] = custom.split(
                            '=')[1]
            print json.dumps(my_test_suite, sort_keys=True, indent=4)