mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Move pinvalidate files
							parent
							
								
									e602adb080
								
							
						
					
					
						commit
						4dfdb11de0
					
				| 
						 | 
				
			
			@ -48,7 +48,7 @@ class ArgumentParserWithDefaultHelp(argparse.ArgumentParser):
 | 
			
		|||
 | 
			
		||||
def find_target_by_path(target_path):
 | 
			
		||||
    """Find a target by path."""
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
 | 
			
		||||
 | 
			
		||||
    targets = dict()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +95,7 @@ def find_target_by_path(target_path):
 | 
			
		|||
 | 
			
		||||
def find_target_by_name(target_name=""):
 | 
			
		||||
    """Find a target by name."""
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
 | 
			
		||||
    
 | 
			
		||||
    targets = dict()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +131,7 @@ def find_target_by_name(target_name=""):
 | 
			
		|||
 | 
			
		||||
def check_markers(test_mode=False):
 | 
			
		||||
    """Validate markers in PinNames.h files"""
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
 | 
			
		||||
 | 
			
		||||
    errors = []
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ def check_markers(test_mode=False):
 | 
			
		|||
 | 
			
		||||
def check_duplicate_pinnames_files(test_mode=False):
 | 
			
		||||
    """Check for duplicate PinNames.h files"""
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
 | 
			
		||||
 | 
			
		||||
    errors = []
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -218,7 +218,7 @@ def check_duplicate_pinnames_files(test_mode=False):
 | 
			
		|||
 | 
			
		||||
def check_duplicate_markers(test_mode=False):
 | 
			
		||||
    """Check target markers in PinNames.h files for duplicates."""
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
 | 
			
		||||
 | 
			
		||||
    errors = []
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -260,7 +260,7 @@ def check_duplicate_markers(test_mode=False):
 | 
			
		|||
 | 
			
		||||
def target_has_arduino_form_factor(target_name):
 | 
			
		||||
    """Check if the target has the Arduino form factor."""
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[4]
 | 
			
		||||
    mbed_os_root = pathlib.Path(__file__).absolute().parents[3]
 | 
			
		||||
 | 
			
		||||
    with (
 | 
			
		||||
        mbed_os_root.joinpath("targets", "targets.json")
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +15,7 @@ limitations under the License.
 | 
			
		|||
"""
 | 
			
		||||
 | 
			
		||||
import pytest
 | 
			
		||||
import os
 | 
			
		||||
from pinvalidate import *
 | 
			
		||||
 | 
			
		||||
@pytest.fixture
 | 
			
		||||
| 
						 | 
				
			
			@ -28,27 +29,27 @@ def pin_name_dict(pin_name_content):
 | 
			
		|||
 | 
			
		||||
def test_marker_check():
 | 
			
		||||
    expect = [
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/nonexistent_target/PinNames.h', 'error': 'target not found'},
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/misformatted_marker/PinNames.h', 'error': 'marker invalid or not found'},
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/missing_marker/PinNames.h', 'error': 'marker invalid or not found'}
 | 
			
		||||
        {'file': os.path.abspath('./test_files/nonexistent_target/PinNames.h'), 'error': 'target not found'},
 | 
			
		||||
        {'file': os.path.abspath('./test_files/misformatted_marker/PinNames.h'), 'error': 'marker invalid or not found'},
 | 
			
		||||
        {'file': os.path.abspath('./test_files/missing_marker/PinNames.h'), 'error': 'marker invalid or not found'}
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
    assert check_markers(test_mode=True) == expect
 | 
			
		||||
 | 
			
		||||
def test_duplicate_pinnames_files_check():
 | 
			
		||||
    expect = [
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/PinNames.h', 'error': 'duplicate file'},
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/duplicate_marker/PinNames.h', 'error': 'duplicate file'}
 | 
			
		||||
        {'file': os.path.abspath('./test_files/PinNames.h'), 'error': 'duplicate file'},
 | 
			
		||||
        {'file': os.path.abspath('./test_files/duplicate_marker/PinNames.h'), 'error': 'duplicate file'}
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
    assert check_duplicate_pinnames_files(test_mode=True) == expect
 | 
			
		||||
 | 
			
		||||
def test_duplicate_markers_check():
 | 
			
		||||
    expect = [
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/duplicate_file/PinNames.h', 'error': 'duplicate marker'},
 | 
			
		||||
        {'file': '/Users/geopsi01/Development/mbed-os/hal/tests/TESTS/pin_names/test_files/duplicate_marker/PinNames.h', 'error': 'duplicate marker'}
 | 
			
		||||
        {'file': os.path.abspath('./test_files/duplicate_file/PinNames.h'), 'error': 'duplicate marker'},
 | 
			
		||||
        {'file': os.path.abspath('./test_files/duplicate_marker/PinNames.h'), 'error': 'duplicate marker'}
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    assert check_duplicate_markers(test_mode=True) == expect
 | 
			
		||||
 | 
			
		||||
def test_pin_name_to_dict(pin_name_dict):
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
*
 | 
			
		||||
		Loading…
	
		Reference in New Issue