Ejemplo n.º 1
0
def run_libconcoct():
    options = parse_args()
    if not options.unittest and not options.project:
        print('No action ("unittest" or "project") chosen!')
        return
    t = Task(options.task)
    if options.solution:
        s = Solution(t, (options.solution.name, ))
    else:
        s = None
    if options.unittest:
        print('Using backend: {}'.format(options.backend))
        try:
            w = ConCoCt(backend=options.backend)
        except FileNotFoundError as e:
            sys.exit(e)
        p = t.get_test_project(s)
        r = w.check_project(p)
        print(r)
    elif options.project:
        p = t.get_main_project(s)
        if 'project-file-name' in options:
            p.create_cb_project(file_name=options['project-file-name'])
        else:
            p.create_cb_project()
Ejemplo n.º 2
0
def build_project_examples():
    try:
        w = ConCoCt()
    except FileNotFoundError as e:
        sys.exit(e)
    t = Task(os.path.join('tasks', 'greaterZero'))
    s1 = Solution(t, ('/home/christian/Programmierung/python/UpLoad2/libconcoct/solutions/greaterZero/user1/solution.c', ))
    s2 = Solution(t, ('/home/christian/Programmierung/python/UpLoad2/libconcoct/solutions/greaterZero/user2/solution.c', ))
    s3 = Solution(t, ('/home/christian/Programmierung/python/UpLoad2/libconcoct/kill_container.c', ))
    # create CodeBlocks project
    p = t.get_main_project(None)
    p.create_cb_project()
Ejemplo n.º 3
0
def test_examples():
    try:
        w = ConCoCt()
    except FileNotFoundError as e:
        sys.exit(e)
    t = Task(os.path.join('tasks', 'greaterZero'))
    s1 = Solution(t, ('/home/christian/Programmierung/python/UpLoad2/libconcoct/solutions/greaterZero/user1/solution.c', ))
    s2 = Solution(t, ('/home/christian/Programmierung/python/UpLoad2/libconcoct/solutions/greaterZero/user2/solution.c', ))
    s3 = Solution(t, ('/home/christian/Programmierung/python/UpLoad2/libconcoct/kill_container.c', ))
    # create test project and unit test it
    p = t.get_test_project(s2)
    r = w.check_project(p)
    print(r)
Ejemplo n.º 4
0
def build_and_check_task_with_solution(task_store_path, solution_file_list):
    """
    Builds a given task with a given solution by a user. The task defines unit
    tests and helper function that are used to determine, if the task has been
    sucessfully solved.

    :param task_store_path: path to the task directory containing the task
                            description, configuration file and all source
                            files necessary to build and test the task
    :param solution_file_list: list of files submitted as possible solution for
                               the given task
    """
    try:
        t = Task(task_store_path)
    except FileNotFoundError as e:
        sys.exit(e)
    s = Solution(t, solution_file_list)
    try:
        w = ConCoCt()
    except FileNotFoundError as e:
        sys.exit(e)
    p = t.get_test_project(s)
    r = w.check_project(p)
    return r.to_json()