Пример #1
0
def determine_test_info(test_info_file):
    """Determine what machine we are running on and extract the test
    config written by test-clm

    """
    print("Checking test info.")
    config = config_parser()
    config.read(test_info_file)

    test_info = {}
    for section in config.sections():
        for option in config.options(section):
            test_info[option] = config.get(section, option)

    print("Using test info :")
    for key in test_info:
        print("    {0} : {1}".format(key, test_info[key]))

    if 'cesm_src_dir' not in test_info:
        raise RuntimeError("cesm_src_dir key not in test config file. Please update test config file.")
    config_machines_xml = "{0}/scripts/ccsm_utils/Machines/config_machines.xml".format(test_info['cesm_src_dir'])

    machine, machine_config = read_machine_config(None, config_machines_xml)

    check_test_info(machine_config, test_info)

    return machine, test_info
def determine_test_info(test_info_file):
    """Determine what machine we are running on and extract the test
    config written by test-clm

    """
    print("Checking test info.")
    config = config_parser()
    config.read(test_info_file)

    test_info = {}
    for section in config.sections():
        for option in config.options(section):
            test_info[option] = config.get(section, option)

    print("Using test info :")
    for key in test_info:
        print("    {0} : {1}".format(key, test_info[key]))

    if "cesm_src_dir" not in test_info:
        raise RuntimeError("cesm_src_dir key not in test config file. Please update test config file.")
    config_machines_xml = "{0}/scripts/ccsm_utils/Machines/config_machines.xml".format(test_info["cesm_src_dir"])

    machine, machine_config = read_machine_config(None, config_machines_xml)

    check_test_info(machine_config, test_info)

    return machine, test_info
Пример #3
0
def main(options):
    now = datetime.datetime.now()
    timestamp, timestamp_short = get_timestamp(now)
    orig_working_dir = os.getcwd()

    src_root = find_src_root(os.path.abspath(os.getcwd()))
    if not src_root:
        raise RuntimeError("Could not determine source directory root.")
    else:
        print("Found source root = {0}".format(src_root))

    machines_dir = get_machines_dir(src_root)
    if options.debug:
        print("Found machines dir = {0}".format(machines_dir))

    config_machines_xml = os.path.join(machines_dir, 'config_machines.xml')

    cfg_file = options.config[0]
    if not cfg_file:
        home_dir = os.path.expanduser("~")
        cfg_file = "{0}/.cime/cime-tests.cfg".format(home_dir)
    suite_list = read_suite_config(cfg_file, options.test_suite[0])

    cime_version = determine_cime_version(src_root)

    machine, config = read_machine_config(cime_version, cfg_file,
                                          config_machines_xml)

    build_cprnc(config["cprnc"])

    scripts_dir = os.path.join(src_root, 'cime', 'scripts')
    if options.debug:
        print("Using cime scripts dir = {0}".format(scripts_dir))

    os.chdir(scripts_dir)
    run_test_suites(cime_version, machine, config, suite_list, timestamp,
                    timestamp_short, options.test_suite[0],
                    options.baseline[0], options.generate[0],
                    options.dry_run)
        
    os.chdir(orig_working_dir)

    return 0
Пример #4
0
def main(options):
    now = datetime.datetime.now()
    timestamp, timestamp_short = get_timestamp(now)
    orig_working_dir = os.getcwd()

    src_root = find_src_root(os.path.abspath(os.getcwd()))
    if not src_root:
        raise RuntimeError("Could not determine source directory root.")
    else:
        print("Found source root = {0}".format(src_root))

    machines_dir = get_machines_dir(src_root)
    if options.debug:
        print("Found machines dir = {0}".format(machines_dir))

    config_machines_xml = os.path.join(machines_dir, 'config_machines.xml')

    cfg_file = options.config[0]
    if not cfg_file:
        home_dir = os.path.expanduser("~")
        cfg_file = "{0}/.cime/cime-tests.cfg".format(home_dir)
    suite_list = read_suite_config(cfg_file, options.test_suite[0])

    machine, config = read_machine_config(cfg_file, config_machines_xml)

    build_cprnc(config["cprnc"])

    cime_version_major = determine_cime_version(src_root)

    scripts_dir = os.path.join(src_root, 'cime', 'scripts')
    if options.debug:
        print("Using cime scripts dir = {0}".format(scripts_dir))

    os.chdir(scripts_dir)
    run_test_suites(cime_version_major, machine, config, suite_list, timestamp,
                    timestamp_short, options.test_suite[0],
                    options.baseline[0], options.generate[0],
                    options.dry_run)
        
    os.chdir(orig_working_dir)

    return 0