Ejemplo n.º 1
0
def test_check_hal_api(hal):
    '''
        This test checks the HAL API against the include files that our Jenkins
        buildbot zips up when it builds our HAL shared library. If they don't
        match, then it may result in memory corruption or segfaults.
        
        This test ensures that the HAL shared library can be downloaded, and 
        also checks our HAL against the one that we claim to be compiled against.
    '''
    
    _download_hal_includes()
    
    from spec_scanners.hal_scanner import (
        Class,
        collect_headers,
        compare,
        get_hal_dirs,
        print_outputs
    ) 

    hal_dirs = get_hal_dirs(hal_dir)
    for tree in hal_dirs:
        assert exists(tree), "Invalid HAL include directory"

    c_data = collect_headers(hal_dirs)
    
    py_data = Class.from_py("hal", hal)
    
    outputs, num_errors, _, _ = compare(c_data, py_data, True)

    if num_errors > 0:
        outputs = [o for o in outputs if o.errors]
        print_outputs(outputs, errors_only=True)
        
        assert False, "Check stdout for failure details"
def test_check_hal_api(hal):
    '''
        This test checks the HAL API against the include files that our Jenkins
        buildbot zips up when it builds our HAL shared library. If they don't
        match, then it may result in memory corruption or segfaults.
        
        This test ensures that the HAL shared library can be downloaded, and 
        also checks our HAL against the one that we claim to be compiled against.
    '''
    
    _download_hal_includes()
    
    from spec_scanners.hal_scanner import (
        Class,
        collect_headers,
        compare,
        get_hal_dirs,
        print_outputs
    ) 

    hal_dirs = get_hal_dirs(hal_dir)
    for tree in hal_dirs:
        assert exists(tree), "Invalid HAL include directory"

    c_data = collect_headers(hal_dirs)
    
    py_data = Class.from_py("hal", hal)
    
    outputs, num_errors, _, _ = compare(c_data, py_data, True)

    if num_errors > 0:
        outputs = [o for o in outputs if o.errors]
        print_outputs(outputs, errors_only=True)
        
        assert False, "Check stdout for failure details"
Ejemplo n.º 3
0
def test_check_hal_api(hal):

    from spec_scanners import hal_scanner

    hal_dirs = hal_scanner.get_hal_dirs(os.environ['HAL_DIR'])
    for tree in hal_dirs:
        assert exists(tree), "HAL_DIR does not point to hal tree dir"

    frontend_output = hal_scanner.compare_header_dirs(hal, hal_dirs)
    backend_output = hal_scanner.scan_c_end(hal, frontend_output)
    for item in backend_output["methods"]:
        if item["errors"] > 0:
            assert False, "Error: method call to {} doesn't match c++ spec.".format(item["name"])
    for item in backend_output["classes"]:
        if item["errors"] > 0:
            assert False, "Error: class {} doesn't match c++ spec, and is not ignored.".format(item["name"])
Ejemplo n.º 4
0
def test_check_hal_api(hal):

    from spec_scanners import hal_scanner

    hal_dirs = hal_scanner.get_hal_dirs(os.environ['HAL_DIR'])
    for tree in hal_dirs:
        assert exists(tree), "HAL_DIR does not point to hal tree dir"

    frontend_output = hal_scanner.compare_header_dirs(hal, hal_dirs)
    backend_output = hal_scanner.scan_c_end(hal, frontend_output)
    for item in backend_output["methods"]:
        if item["errors"] > 0:
            assert False, "Error: method call to {} doesn't match c++ spec.".format(
                item["name"])
    for item in backend_output["classes"]:
        if item["errors"] > 0:
            assert False, "Error: class {} doesn't match c++ spec, and is not ignored.".format(
                item["name"])
def test_check_hal_api(hal):
    '''
        This test checks the HAL API against the include files that our Jenkins
        buildbot zips up when it builds our HAL shared library. If they don't
        match, then it may result in memory corruption or segfaults.
        
        This test ensures that the HAL shared library can be downloaded, and 
        also checks our HAL against the one that we claim to be compiled against.
    '''

    _download_hal_includes()

    from spec_scanners import hal_scanner

    hal_dirs = hal_scanner.get_hal_dirs(hal_dir)
    for tree in hal_dirs:
        assert exists(tree), "Invalid HAL include directory"

    frontend_output = hal_scanner.compare_header_dirs([hal], hal_dirs)
    backend_output = hal_scanner.scan_c_end(hal, frontend_output)

    has_errors = False

    for item in backend_output["methods"]:
        if len(item["errors"]) > 0:
            has_errors = True
            print("Error: method call to {} doesn't match c++ spec.".format(
                item["name"]))
            for error in item['errors']:
                print("- ", error)
            print()

    for item in backend_output["classes"]:
        if item["errors"] > 0:
            has_errors = True
            print(
                "Error: class {} doesn't match c++ spec, and is not ignored.".
                format(item["name"]))
            for error in item['errors']:
                print("- ", error)
            print()

    assert has_errors == False, "Check stdout for failure details"
def test_check_hal_api(hal):
    '''
        This test checks the HAL API against the include files that our Jenkins
        buildbot zips up when it builds our HAL shared library. If they don't
        match, then it may result in memory corruption or segfaults.
        
        This test ensures that the HAL shared library can be downloaded, and 
        also checks our HAL against the one that we claim to be compiled against.
    '''
    
    _download_hal_includes()
    
    from spec_scanners import hal_scanner

    hal_dirs = hal_scanner.get_hal_dirs(hal_dir)
    for tree in hal_dirs:
        assert exists(tree), "Invalid HAL include directory"

    frontend_output = hal_scanner.compare_header_dirs([hal], hal_dirs)
    backend_output = hal_scanner.scan_c_end(hal, frontend_output)
    
    has_errors = False
    
    for item in backend_output["methods"]:
        if len(item["errors"]) > 0:
            has_errors = True
            print("Error: method call to {} doesn't match c++ spec.".format(item["name"]))
            for error in item['errors']:
                print("- ", error)
            print()
            
    for item in backend_output["classes"]:
        if item["errors"] > 0:
            has_errors = True
            print("Error: class {} doesn't match c++ spec, and is not ignored.".format(item["name"]))
            for error in item['errors']:
                print("- ", error)
            print()

    assert has_errors == False, "Check stdout for failure details"