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"])
Exemplo n.º 2
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"