Example #1
0
def DoSaneChecks(lab_path, labname, logger):
    labutils.is_valid_lab(lab_path)

    VerifyHomeTar(lab_path, labname, logger)
    VerifySysTar(lab_path, labname, logger)
    VerifyDockerVsStartConfig(lab_path, labname, logger)
    VerifyBashScriptExecutable(lab_path, labname, logger)
Example #2
0
def DoValidate(lab_path, labname, validatetestsets, validatetestsets_path,
               logger):
    labutils.is_valid_lab(lab_path)

    lab_instance_seed, container_list, email_labname = setup_to_validate(
        lab_path, labname, validatetestsets, validatetestsets_path, logger)
    logger.debug("container_list (%s)" % container_list)

    LabDirName = os.path.join(TEMPDIR, email_labname)
    # Just validating - not actual parsing
    actual_parsing = False
    configfilelines, resultidlist, bool_results = ResultParser.ParseValidateResultConfig(
        actual_parsing, TEMPDIR, LabDirName, container_list, labname, logger)

    # Validate resultidlist for 'system' in 'treataslocal'
    ValidateTreataslocal(labname, lab_path, resultidlist, logger)

    parameter_list = GoalsParser.ParseGoals(TEMPDIR, TEMPDIR, logger)
    # GoalsParser created goals.json in parent directory
    parent_dir = os.path.dirname(TEMPDIR)
    goalsjsonfname = os.path.join(parent_dir, '.local', 'result', 'goals.json')
    goalsjson = open(goalsjsonfname, "r")
    goals = json.load(goalsjson)
    goalsjson.close()
    #logger.debug("Goals JSON config is")
    #logger.debug(goals)

    return validate_goals(parameter_list, resultidlist, goals, bool_results)
def RegressTest(lab_path, standard, logger):
    labname = os.path.basename(lab_path)
    labtainer_config_dir = os.path.join(os.path.dirname(os.path.dirname(lab_path)), 'config', 'labtainer.config')
    labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(labtainer_config_dir, logger)

    labutils.is_valid_lab(lab_path)
    regresstest_lab_path = os.path.join(labtainer_config.testsets_root, labname, standard)
    host_home_xfer = os.path.join(labtainer_config.host_home_xfer, labname)
    logger.debug("Host Xfer directory for labname %s is %s" % (labname, host_home_xfer))
    logger.debug("Regression Test path for labname %s is %s" % (labname, regresstest_lab_path))

    GradesGold = "%s/%s.grades.txt" % (regresstest_lab_path, labname)
    username = getpass.getuser()
    Grades = "/home/%s/%s/%s.grades.txt" % (username, host_home_xfer, labname)
    logger.debug("GradesGold is %s - Grades is %s" % (GradesGold, Grades))

    is_regress_test = standard
    check_watermark = False
    auto_grade = True
    debug_grade = False
    gradelab.doGrade(labname, False, False, True, False, regress_test=GradesGold)

#    for name, container in start_config.containers.items():
#        mycontainer_name       = container.full_name
#        container_user         = container.user
#
#        if mycontainer_name == start_config.grade_container:
#            logger.debug('about to RunInstructorCreateDradeFile for container %s' % start_config.grade_container)
#            RunInstructorCreateGradeFile(start_config.grade_container, container_user, labname, check_watermark)

    # Pass 'True' to ignore_stop_error (i.e., ignore stop error)

    CompareResult = False
    # GradesGold and Grades must exist
    logger.debug('compare %s to %s' % (GradesGold, Grades))
    if not os.path.exists(GradesGold):
        logger.error("GradesGold %s file does not exist!" % GradesGold)
    elif not os.path.exists(Grades):
        logger.error("Grades %s file does not exist!" % Grades)
    else:
        CompareResult = compareGrades(GradesGold, Grades)
    return CompareResult