Beispiel #1
0
 def test_detect_duplicates(self):
     """
     Verify that detect_duplicates finds all of the duplicate object files
     in the scanned tree.
     """
     notifier = MockNotifier()
     first = Resources(notifier)
     first._add_labels('TARGET', ['K64F'])
     for name, loc in SRC_PATHS.items():
         first.add_directory(loc, into_path=name)
     notifier.messages = []
     first.detect_duplicates()
     error_messages = "\n".join(m['message'] for m in notifier.messages
                                if m['type'] == 'tool_error')
     assert (" eggs.o " in error_messages)
     first._add_labels('TARGET', ['FRDM'])
     first.detect_duplicates()
     error_messages = "\n".join(m['message'] for m in notifier.messages
                                if m['type'] == 'tool_error')
     assert (" eggs.o " in error_messages)
     assert (" not-main.o " in error_messages)
     assert (" main.o " in error_messages)
Beispiel #2
0
def test_detect_duplicates(filenames):
    c_sources = [os.path.join(name, "dupe.c") for name in filenames]
    s_sources = [os.path.join(name, "dupe.s") for name in filenames]
    cpp_sources = [os.path.join(name, "dupe.cpp") for name in filenames]
    notify = MockNotifier()
    res = Resources(notify)
    res.add_files_to_type(FileType.C_SRC, c_sources)
    res.add_files_to_type(FileType.ASM_SRC, s_sources)
    res.add_files_to_type(FileType.CPP_SRC, cpp_sources)
    assert res.detect_duplicates() == 1,\
        "Not Enough duplicates found"

    notification = notify.messages[0]
    assert "dupe.o" in notification["message"]
    assert "dupe.s" in notification["message"]
    assert "dupe.c" in notification["message"]
    assert "dupe.cpp" in notification["message"]