From a5215b6564c793560adca4de0190b072e9a97424 Mon Sep 17 00:00:00 2001 From: Marcel Schmalzl Date: Wed, 18 Sep 2019 17:05:30 +0200 Subject: [PATCH] Updated travis config -> fixed paths for tests --- tests/functional_tests/test__cmd_line.py | 62 ++++++++-------- tests/functional_tests/test__test_project.py | 10 +-- tests/unit_tests/test_emma_helper.py | 62 ++++++++-------- tests/unit_tests/test_memoryEntry.py | 41 +++++----- tests/unit_tests/test_memoryMap.py | 78 ++++++++++---------- 5 files changed, 126 insertions(+), 127 deletions(-) diff --git a/tests/functional_tests/test__cmd_line.py b/tests/functional_tests/test__cmd_line.py index be4e435..0ce4927 100644 --- a/tests/functional_tests/test__cmd_line.py +++ b/tests/functional_tests/test__cmd_line.py @@ -27,13 +27,13 @@ from pypiscout.SCout_Logger import Logger as sc from matplotlib import pyplot as plt -sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "Emma")) +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) # pylint: disable=wrong-import-position # Rationale: This module needs to access modules that are above them in the folder structure. -import emma -import emma_vis -from shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import +import Emma.emma +import Emma.emma_vis +from Emma.shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import class TestHelper(unittest.TestCase): @@ -122,8 +122,8 @@ def test_normalRun(self): Check that an ordinary run is successful """ try: - args = emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder]) - emma.main(args) + args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder]) + Emma.emma.main(args) except Exception as e: # pylint: disable=broad-except # Rationale: The purpose here is to catch any exception. self.fail("Unexpected exception: " + str(e)) @@ -133,8 +133,8 @@ def test_help(self): Check that `--help` does not raise an exception but exits with SystemExit(0) """ with self.assertRaises(SystemExit) as context: - args = emma.parseArgs(["--help"]) - emma.main(args) + args = Emma.emma.parseArgs(["--help"]) + Emma.emma.main(args) self.assertEqual(context.exception.code, 0) def test_unrecognisedArgs(self): @@ -142,8 +142,8 @@ def test_unrecognisedArgs(self): Check that an unexpected argument does raise an exception """ with self.assertRaises(SystemExit) as context: - args = emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder, "--blahhhhhh"]) - emma.main(args) + args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder, "--blahhhhhh"]) + Emma.emma.main(args) self.assertEqual(context.exception.code, 2) def test_noProjDir(self): @@ -151,8 +151,8 @@ def test_noProjDir(self): Check run with non-existing project folder """ with self.assertRaises(SystemExit) as context: - args = emma.parseArgs(["--project", self.nonExistingPath, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder]) - emma.main(args) + args = Emma.emma.parseArgs(["--project", self.nonExistingPath, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", self.cmdLineTestOutputFolder]) + Emma.emma.main(args) self.assertEqual(context.exception.code, -10) def test_noMapfileDir(self): @@ -160,8 +160,8 @@ def test_noMapfileDir(self): Check run with non-existing mapfile folder """ with self.assertRaises(SystemExit) as context: - args = emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.nonExistingPath, "--dir", self.cmdLineTestOutputFolder]) - emma.main(args) + args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.nonExistingPath, "--dir", self.cmdLineTestOutputFolder]) + Emma.emma.main(args) self.assertEqual(context.exception.code, -10) def test_noDirOption(self): @@ -169,8 +169,8 @@ def test_noDirOption(self): Check run without a --dir parameter """ try: - args = emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder]) - emma.main(args) + args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder]) + Emma.emma.main(args) except Exception as e: # pylint: disable=broad-except # Rationale: The purpose here is to catch any exception. self.fail("Unexpected exception: " + str(e)) @@ -198,18 +198,18 @@ def runEmma(self, outputFolder=None): :return: None """ if outputFolder is not None: - args = emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", outputFolder, "--noprompt"]) + args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--dir", outputFolder, "--noprompt"]) else: - args = emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--noprompt"]) - emma.main(args) + args = Emma.emma.parseArgs(["--project", self.cmdLineTestProjectFolder, "--mapfiles", self.cmdLineTestProjectMapfilesFolder, "--noprompt"]) + Emma.emma.main(args) def test_normalRun(self): """ Check that an ordinary run is successful """ try: - argsEmmaVis = emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--inOutDir", self.cmdLineTestOutputFolder, "--noprompt", "--quiet"]) - emma_vis.main(argsEmmaVis) + argsEmmaVis = Emma.emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--inOutDir", self.cmdLineTestOutputFolder, "--noprompt", "--quiet"]) + Emma.emma_vis.main(argsEmmaVis) except Exception as e: # pylint: disable=broad-except # Rationale: The purpose here is to catch any exception. self.fail("Unexpected exception: " + str(e)) @@ -219,8 +219,8 @@ def test_help(self): Check that `--help` does not raise an exception but exits with SystemExit(0) """ with self.assertRaises(SystemExit) as context: - args = emma_vis.parseArgs(["--help"]) - emma_vis.main(args) + args = Emma.emma_vis.parseArgs(["--help"]) + Emma.emma_vis.main(args) self.assertEqual(context.exception.code, 0) def test_unrecognisedArgs(self): @@ -228,8 +228,8 @@ def test_unrecognisedArgs(self): Check that an unexpected argument does raise an exception """ with self.assertRaises(SystemExit) as context: - args = emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "overview", "--dir", self.cmdLineTestOutputFolder, "--blahhhhhh", "--noprompt", "--quiet"]) - emma_vis.main(args) + args = Emma.emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "overview", "--dir", self.cmdLineTestOutputFolder, "--blahhhhhh", "--noprompt", "--quiet"]) + Emma.emma_vis.main(args) self.assertEqual(context.exception.code, 2) def test_noProjDir(self): @@ -237,8 +237,8 @@ def test_noProjDir(self): Check run with non-existing project folder """ with self.assertRaises(SystemExit) as context: - args = emma_vis.parseArgs(["--project", self.nonExistingPath, "--overview", "--inOutDir", self.cmdLineTestOutputFolder, "--noprompt", "--quiet"]) - emma_vis.main(args) + args = Emma.emma_vis.parseArgs(["--project", self.nonExistingPath, "--overview", "--inOutDir", self.cmdLineTestOutputFolder, "--noprompt", "--quiet"]) + Emma.emma_vis.main(args) self.assertEqual(context.exception.code, -10) def test_noMemStats(self): @@ -246,8 +246,8 @@ def test_noMemStats(self): Check run with non-existing memStats folder """ with self.assertRaises(SystemExit) as context: - args = emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--inOutDir", self.nonExistingPath, "--noprompt", "--quiet"]) - emma_vis.main(args) + args = Emma.emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--inOutDir", self.nonExistingPath, "--noprompt", "--quiet"]) + Emma.emma_vis.main(args) self.assertEqual(context.exception.code, -10) def test_noDirOption(self): @@ -258,8 +258,8 @@ def test_noDirOption(self): # This a is a specific case, the default Emma results will not work here. Because of this, we will delete it and run the Emma again. shutil.rmtree(self.cmdLineTestOutputFolder) self.runEmma() - args = emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--noprompt", "--quiet"]) - emma_vis.main(args) + args = Emma.emma_vis.parseArgs(["--project", self.cmdLineTestProjectFolder, "--overview", "--noprompt", "--quiet"]) + Emma.emma_vis.main(args) plt.close('all') except Exception as e: # pylint: disable=broad-except # Rationale: The purpose here is to catch any exception. diff --git a/tests/functional_tests/test__test_project.py b/tests/functional_tests/test__test_project.py index 5e17899..59e863c 100644 --- a/tests/functional_tests/test__test_project.py +++ b/tests/functional_tests/test__test_project.py @@ -27,12 +27,12 @@ import pandas -sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "Emma")) +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) # pylint: disable=wrong-import-position # Rationale: This module needs to access modules that are above them in the folder structure. -from shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import -import emma +from Emma.shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import +import Emma.emma class EmmaTestProject(unittest.TestCase): # pylint: disable=invalid-name @@ -65,8 +65,8 @@ def setUp(self): os.mkdir(self.resultsFolder) # Running the test_project to create the CSV tables - arguments = emma.parseArgs(["--project", testProjectFolder, "--mapfile", mapfilesFolder, "--dir", self.resultsFolder]) - emma.main(arguments) + arguments = Emma.emma.parseArgs(["--project", testProjectFolder, "--mapfile", mapfilesFolder, "--dir", self.resultsFolder]) + Emma.emma.main(arguments) for _, directories, files in os.walk(self.memStatsFolder): # The result folder shall have 0 subdirectories and three summary files diff --git a/tests/unit_tests/test_emma_helper.py b/tests/unit_tests/test_emma_helper.py index c11592b..90a8a72 100644 --- a/tests/unit_tests/test_emma_helper.py +++ b/tests/unit_tests/test_emma_helper.py @@ -24,12 +24,12 @@ from pypiscout.SCout_Logger import Logger as sc -sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "Emma")) +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) # pylint: disable=wrong-import-position # Rationale: This module needs to access modules that are above them in the folder structure. -from shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import -import shared_libs.emma_helper +from Emma.shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import +import Emma.shared_libs.emma_helper class EmmaHelperTestCase(unittest.TestCase): @@ -50,28 +50,28 @@ def setUp(self): def test_checkIfFolderExists(self): try: - shared_libs.emma_helper.checkIfFolderExists(os.path.dirname(__file__)) + Emma.shared_libs.emma_helper.checkIfFolderExists(os.path.dirname(__file__)) except Exception: # pylint: disable=broad-except # Rationale: The goal here is to catch any exception types. self.fail("Unexpected exception!") with self.assertRaises(SystemExit) as contextManager: - shared_libs.emma_helper.checkIfFolderExists("DefinitelyNonExistingFolder") + Emma.shared_libs.emma_helper.checkIfFolderExists("DefinitelyNonExistingFolder") self.assertEqual(contextManager.exception.code, "error") def test_checkIfFileExists(self): try: - shared_libs.emma_helper.checkIfFileExists(__file__) + Emma.shared_libs.emma_helper.checkIfFileExists(__file__) except Exception: # pylint: disable=broad-except # Rationale: The goal here is to catch any exception types. self.fail("Unexpected exception!") with self.assertRaises(SystemExit) as contextManager: - shared_libs.emma_helper.checkIfFileExists("DefinitelyNonExisting.file") + Emma.shared_libs.emma_helper.checkIfFileExists("DefinitelyNonExisting.file") self.assertEqual(contextManager.exception.code, "error") def test_mkDirIfNeeded(self): directoryName = "TestDirectoryNameThatShouldNotExist" self.assertFalse(os.path.isdir(directoryName)) - shared_libs.emma_helper.mkDirIfNeeded(directoryName) + Emma.shared_libs.emma_helper.mkDirIfNeeded(directoryName) self.assertTrue(os.path.isdir(directoryName)) os.rmdir(directoryName) @@ -81,10 +81,10 @@ def test_readJsonWriteJson(self): jsonContentToWrite = {"TestDictionary": {}} jsonContentToWrite["TestDictionary"]["test_passed"] = True - shared_libs.emma_helper.writeJson(jsonTestFilePath, jsonContentToWrite) + Emma.shared_libs.emma_helper.writeJson(jsonTestFilePath, jsonContentToWrite) self.assertTrue(os.path.exists(jsonTestFilePath)) - jsonContentReadIn = shared_libs.emma_helper.readJson(jsonTestFilePath) + jsonContentReadIn = Emma.shared_libs.emma_helper.readJson(jsonTestFilePath) self.assertIn("TestDictionary", jsonContentReadIn) self.assertIn("test_passed", jsonContentReadIn["TestDictionary"]) self.assertEqual(type(jsonContentReadIn["TestDictionary"]["test_passed"]), bool) @@ -93,48 +93,48 @@ def test_readJsonWriteJson(self): self.assertFalse(os.path.exists(jsonTestFilePath)) def test_unifyAddress(self): - hexResult, decResult = shared_libs.emma_helper.unifyAddress("0x16") + hexResult, decResult = Emma.shared_libs.emma_helper.unifyAddress("0x16") self.assertEqual(hexResult, "0x16") self.assertEqual(decResult, 22) - hexResult, decResult = shared_libs.emma_helper.unifyAddress(22) + hexResult, decResult = Emma.shared_libs.emma_helper.unifyAddress(22) self.assertEqual(hexResult, "0x16") self.assertEqual(decResult, 22) with self.assertRaises(ValueError) as contextManager: - hexResult, decResult = shared_libs.emma_helper.unifyAddress("Obviously not a number...") + hexResult, decResult = Emma.shared_libs.emma_helper.unifyAddress("Obviously not a number...") with self.assertRaises(SystemExit) as contextManager: - hexResult, decResult = shared_libs.emma_helper.unifyAddress(0.123) + hexResult, decResult = Emma.shared_libs.emma_helper.unifyAddress(0.123) self.assertEqual(contextManager.exception.code, "error") def test_getTimestampFromFilename(self): - timestamp = shared_libs.emma_helper.getTimestampFromFilename("MyFile_2017-11-06-14h56s52.csv") + timestamp = Emma.shared_libs.emma_helper.getTimestampFromFilename("MyFile_2017-11-06-14h56s52.csv") self.assertEqual(timestamp, "2017-11-06-14h56s52") with self.assertRaises(SystemExit) as contextManager: - shared_libs.emma_helper.getTimestampFromFilename("MyFileWithoutTimeStamp.csv") + Emma.shared_libs.emma_helper.getTimestampFromFilename("MyFileWithoutTimeStamp.csv") self.assertEqual(contextManager.exception.code, "error") def test_toHumanReadable(self): - self.assertEqual(" 0.00 B", shared_libs.emma_helper.toHumanReadable(0)) - self.assertEqual(" 10.00 B", shared_libs.emma_helper.toHumanReadable(10)) - self.assertEqual(" 1024.00 B", shared_libs.emma_helper.toHumanReadable(1024)) - self.assertEqual(" 1.00 KiB", shared_libs.emma_helper.toHumanReadable(1025)) - self.assertEqual(" 1.01 KiB", shared_libs.emma_helper.toHumanReadable(1035)) - self.assertEqual(" 1.10 KiB", shared_libs.emma_helper.toHumanReadable(1126)) - self.assertEqual(" 157.36 GiB", shared_libs.emma_helper.toHumanReadable(168963795964)) + self.assertEqual(" 0.00 B", Emma.shared_libs.emma_helper.toHumanReadable(0)) + self.assertEqual(" 10.00 B", Emma.shared_libs.emma_helper.toHumanReadable(10)) + self.assertEqual(" 1024.00 B", Emma.shared_libs.emma_helper.toHumanReadable(1024)) + self.assertEqual(" 1.00 KiB", Emma.shared_libs.emma_helper.toHumanReadable(1025)) + self.assertEqual(" 1.01 KiB", Emma.shared_libs.emma_helper.toHumanReadable(1035)) + self.assertEqual(" 1.10 KiB", Emma.shared_libs.emma_helper.toHumanReadable(1126)) + self.assertEqual(" 157.36 GiB", Emma.shared_libs.emma_helper.toHumanReadable(168963795964)) def test_evalSummary(self): - self.assertEqual(shared_libs.emma_helper.evalSummary("Projectname_" + FILE_IDENTIFIER_SECTION_SUMMARY + "_2017-11-06-14h56s52.csv"), FILE_IDENTIFIER_SECTION_SUMMARY) - self.assertEqual(shared_libs.emma_helper.evalSummary("Projectname_" + FILE_IDENTIFIER_OBJECT_SUMMARY + "_2017-11-06-14h56s52.csv"), FILE_IDENTIFIER_OBJECT_SUMMARY) - self.assertIsNone(shared_libs.emma_helper.evalSummary("Projectname_" + "_2017-11-06-14h56s52.csv")) + self.assertEqual(Emma.shared_libs.emma_helper.evalSummary("Projectname_" + FILE_IDENTIFIER_SECTION_SUMMARY + "_2017-11-06-14h56s52.csv"), FILE_IDENTIFIER_SECTION_SUMMARY) + self.assertEqual(Emma.shared_libs.emma_helper.evalSummary("Projectname_" + FILE_IDENTIFIER_OBJECT_SUMMARY + "_2017-11-06-14h56s52.csv"), FILE_IDENTIFIER_OBJECT_SUMMARY) + self.assertIsNone(Emma.shared_libs.emma_helper.evalSummary("Projectname_" + "_2017-11-06-14h56s52.csv")) def test_projectNameFromPath(self): - self.assertEqual("MyProject", shared_libs.emma_helper.projectNameFromPath(os.path.join("C:", "GitRepos", "Emma", "MyProject"))) + self.assertEqual("MyProject", Emma.shared_libs.emma_helper.projectNameFromPath(os.path.join("C:", "GitRepos", "Emma", "MyProject"))) def test_joinPath(self): if platform.system() == "Windows": - self.assertEqual(r"c:Documents\Projects\Emma", shared_libs.emma_helper.joinPath("c:", "Documents", "Projects", "Emma")) - self.assertEqual(r"..\..\Emma\tests\other_files", shared_libs.emma_helper.joinPath("..", "..", "Emma", "tests", "other_files")) + self.assertEqual(r"c:Documents\Projects\Emma", Emma.shared_libs.emma_helper.joinPath("c:", "Documents", "Projects", "Emma")) + self.assertEqual(r"..\..\Emma\tests\other_files", Emma.shared_libs.emma_helper.joinPath("..", "..", "Emma", "tests", "other_files")) elif platform.system() == "Linux": - self.assertEqual(r"Documents/Projects/Emma", shared_libs.emma_helper.joinPath("Documents", "Projects", "Emma")) - self.assertEqual(r"../../Emma/tests/other_files", shared_libs.emma_helper.joinPath("..", "..", "Emma", "tests", "other_files")) + self.assertEqual(r"Documents/Projects/Emma", Emma.shared_libs.emma_helper.joinPath("Documents", "Projects", "Emma")) + self.assertEqual(r"../../Emma/tests/other_files", Emma.shared_libs.emma_helper.joinPath("..", "..", "Emma", "tests", "other_files")) else: raise EnvironmentError("Unexpected platform value: " + platform.system()) diff --git a/tests/unit_tests/test_memoryEntry.py b/tests/unit_tests/test_memoryEntry.py index 6de8a75..ac7a8a7 100644 --- a/tests/unit_tests/test_memoryEntry.py +++ b/tests/unit_tests/test_memoryEntry.py @@ -16,7 +16,6 @@ along with this program. If not, see """ - import os import sys import unittest @@ -24,11 +23,11 @@ from pypiscout.SCout_Logger import Logger as sc -sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "Emma")) +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) # pylint: disable=wrong-import-position # Rationale: This module needs to access modules that are above them in the folder structure. -import emma_libs.memoryEntry +import Emma.emma_libs.memoryEntry class TestData: @@ -57,7 +56,7 @@ def __init__(self): self.compilerSpecificData["vasName"] = self.vasName self.compilerSpecificData["vasSectionName"] = self.vasSectionName - self.basicMemEntry = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + self.basicMemEntry = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=None, addressEnd=self.addressEnd, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -117,7 +116,7 @@ def test_constructorBasicCase(self): def test_constructorAddressLengthAndAddressEnd(self): # Modifying the self.addressEnd to make sure it is wrong self.addressEnd = self.addressStart + self.addressLength + 0x100 - entryWithLengthAndAddressEnd = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + entryWithLengthAndAddressEnd = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=self.addressLength, addressEnd=self.addressEnd, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -129,7 +128,7 @@ def test_constructorAddressLengthAndAddressEnd(self): def test_constructorNoAddressLengthNorAddressEnd(self): self.assertFalse(self.actionErrorWasCalled) - entryWithoutLengthAndAddressEnd = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + entryWithoutLengthAndAddressEnd = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=None, addressEnd=None, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -138,7 +137,7 @@ def test_constructorNoAddressLengthNorAddressEnd(self): self.assertIsNone(entryWithoutLengthAndAddressEnd.addressLength) def test___setAddressesGivenEnd(self): - entry = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + entry = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=None, addressEnd=self.addressEnd, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -161,7 +160,7 @@ def test___setAddressesGivenEnd(self): self.assertEqual(entry.addressEndHex(), hex(self.addressEnd)) def test___setAddressesGivenLength(self): - entry = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + entry = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=self.addressLength, addressEnd=None, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -185,7 +184,7 @@ def test___setAddressesGivenLength(self): def test_compilerSpecificDataWrongType(self): self.assertFalse(self.actionErrorWasCalled) - otherMemEntry = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + otherMemEntry = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=None, addressEnd=self.addressEnd, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -194,7 +193,7 @@ def test_compilerSpecificDataWrongType(self): self.assertIsNone(otherMemEntry.compilerSpecificData) def test_equalConfigID(self): - otherMemEntry = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + otherMemEntry = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=None, addressEnd=self.addressEnd, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -204,7 +203,7 @@ def test_equalConfigID(self): self.assertEqual(self.basicMemEntry.equalConfigID(otherMemEntry), False) def test___lt__(self): - otherMemEntry = emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, + otherMemEntry = Emma.emma_libs.memoryEntry.MemEntry(configID=self.configID, mapfileName=self.mapfileName, addressStart=self.addressStart, addressLength=None, addressEnd=self.addressEnd, sectionName=self.sectionName, objectName=self.objectName, memType=self.memType, memTypeTag=self.memTypeTag, category=self.category, @@ -221,9 +220,9 @@ def test___calculateAddressEnd(self): # pylint: disable=protected-access # Rationale: This test was specificly written to access this private method. - self.assertEqual(emma_libs.memoryEntry.MemEntry._MemEntry__calculateAddressEnd(self.addressStart, self.addressLength), self.addressEnd) - self.assertEqual(emma_libs.memoryEntry.MemEntry._MemEntry__calculateAddressEnd(self.addressStart, 1), self.addressStart) - self.assertIsNone(emma_libs.memoryEntry.MemEntry._MemEntry__calculateAddressEnd(self.addressStart, 0), self.addressStart) + self.assertEqual(Emma.emma_libs.memoryEntry.MemEntry._MemEntry__calculateAddressEnd(self.addressStart, self.addressLength), self.addressEnd) + self.assertEqual(Emma.emma_libs.memoryEntry.MemEntry._MemEntry__calculateAddressEnd(self.addressStart, 1), self.addressStart) + self.assertIsNone(Emma.emma_libs.memoryEntry.MemEntry._MemEntry__calculateAddressEnd(self.addressStart, 0), self.addressStart) def test___eq__(self): with self.assertRaises(NotImplementedError): @@ -277,7 +276,7 @@ def test_abstractness(self): # Rationale: This test was specificly written to test whether it is possible to instantiate the MemEntryHandler class. Since it shall fail, it will not be tried to be used. with self.assertRaises(TypeError): - memEntryHandler = emma_libs.memoryEntry.MemEntryHandler() + memEntryHandler = Emma.emma_libs.memoryEntry.MemEntryHandler() class SectionEntryTestCase(unittest.TestCase, TestData): @@ -301,12 +300,12 @@ def actionError(self): self.actionErrorWasCalled = True def test_isEqual(self): - self.assertTrue(emma_libs.memoryEntry.SectionEntry.isEqual(self.basicMemEntry, self.basicMemEntry)) + self.assertTrue(Emma.emma_libs.memoryEntry.SectionEntry.isEqual(self.basicMemEntry, self.basicMemEntry)) with self.assertRaises(TypeError): - emma_libs.memoryEntry.SectionEntry.isEqual(self.basicMemEntry, "This is obviously not a MemEntry object!") + Emma.emma_libs.memoryEntry.SectionEntry.isEqual(self.basicMemEntry, "This is obviously not a MemEntry object!") def test_getName(self): - name = emma_libs.memoryEntry.SectionEntry.getName(self.basicMemEntry) + name = Emma.emma_libs.memoryEntry.SectionEntry.getName(self.basicMemEntry) self.assertEqual(name, self.sectionName) @@ -331,12 +330,12 @@ def actionError(self): self.actionErrorWasCalled = True def test_isEqual(self): - self.assertTrue(emma_libs.memoryEntry.ObjectEntry.isEqual(self.basicMemEntry, self.basicMemEntry)) + self.assertTrue(Emma.emma_libs.memoryEntry.ObjectEntry.isEqual(self.basicMemEntry, self.basicMemEntry)) with self.assertRaises(TypeError): - emma_libs.memoryEntry.ObjectEntry.isEqual(self.basicMemEntry, "This is obviously not a MemEntry object!") + Emma.emma_libs.memoryEntry.ObjectEntry.isEqual(self.basicMemEntry, "This is obviously not a MemEntry object!") def test_getName(self): - name = emma_libs.memoryEntry.ObjectEntry.getName(self.basicMemEntry) + name = Emma.emma_libs.memoryEntry.ObjectEntry.getName(self.basicMemEntry) self.assertEqual(name, (self.sectionName + "::" + self.objectName)) diff --git a/tests/unit_tests/test_memoryMap.py b/tests/unit_tests/test_memoryMap.py index 2cf9c07..abf0d5c 100644 --- a/tests/unit_tests/test_memoryMap.py +++ b/tests/unit_tests/test_memoryMap.py @@ -22,13 +22,13 @@ import collections import unittest -sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", os.path.abspath("Emma"))) +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) # pylint: disable=wrong-import-position # Rationale: This module needs to access modules that are above them in the folder structure. -from shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import -import emma_libs.memoryEntry -import emma_libs.memoryMap +from Emma.shared_libs.stringConstants import * # pylint: disable=unused-wildcard-import,wildcard-import +import Emma.emma_libs.memoryEntry +import Emma.emma_libs.memoryMap class MemEntryData: @@ -63,7 +63,7 @@ def createMemEntryObject(memEntryData): compilerSpecificData["DMA"] = True compilerSpecificData["vasName"] = "" compilerSpecificData["vasSectionName"] = "" - return emma_libs.memoryEntry.MemEntry(configID="MCU" if memEntryData.configId is None else memEntryData.configId, + return Emma.emma_libs.memoryEntry.MemEntry(configID="MCU" if memEntryData.configId is None else memEntryData.configId, mapfileName="mapfile.map", addressStart=memEntryData.addressStart, addressLength=0 if memEntryData.addressEnd is None else None, @@ -93,10 +93,10 @@ class ResolveDuplicateContainmentOverlapTestCase(unittest.TestCase): # Rationale: Tests need to have the following method names in order to be discovered: test_(). It is not necessary to add a docstring for every unit test. def assertEqualSections(self, firstSection, secondSection): - self.assertTrue(emma_libs.memoryEntry.SectionEntry.isEqual(firstSection, secondSection)) + self.assertTrue(Emma.emma_libs.memoryEntry.SectionEntry.isEqual(firstSection, secondSection)) def assertEqualObjects(self, firstObject, secondObject): - self.assertTrue(emma_libs.memoryEntry.ObjectEntry.isEqual(firstObject, secondObject)) + self.assertTrue(Emma.emma_libs.memoryEntry.ObjectEntry.isEqual(firstObject, secondObject)) def checkFlags(self, memEntry, memEntryHandler, expectedDuplicate=None, expectedContainingOthers=None, expectedContainedBy=None, expectedOverlappingOthers=None, expectedOverlappedBy=None): # pylint: disable=too-many-arguments # Rationale: This function needs to be able to check all kinds of flags, this is why these arguments needed. @@ -139,11 +139,11 @@ def test__singleSection(self): ADDRESS_START = 0x0100 ADDRESS_END = 0x01FF listOfMemEntryData = [MemEntryData(ADDRESS_START, ADDRESS_END)] - memEntryHandler = emma_libs.memoryEntry.SectionEntry + memEntryHandler = Emma.emma_libs.memoryEntry.SectionEntry originalSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) resolvedSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) # Running the resolveDuplicateContainmentOverlap list - emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, emma_libs.memoryEntry.SectionEntry) + Emma.emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, Emma.emma_libs.memoryEntry.SectionEntry) # Check the number of elements: no elements shall be removed or added to the container self.assertEqual(len(resolvedSectionContainer), len(originalSectionContainer)) @@ -166,11 +166,11 @@ def test__separateSections(self): SECOND_SECTION_ADDRESS_END = 0x02FF listOfMemEntryData = [MemEntryData(FIRST_SECTION_ADDRESS_START, FIRST_SECTION_ADDRESS_END, section="first"), MemEntryData(SECOND_SECTION_ADDRESS_START, SECOND_SECTION_ADDRESS_END, section="second")] - memEntryHandler = emma_libs.memoryEntry.SectionEntry + memEntryHandler = Emma.emma_libs.memoryEntry.SectionEntry originalSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) resolvedSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) # Running the resolveDuplicateContainmentOverlap list - emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, emma_libs.memoryEntry.SectionEntry) + Emma.emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, Emma.emma_libs.memoryEntry.SectionEntry) # Check the number of elements: no elements shall be removed or added to the container self.assertEqual(len(resolvedSectionContainer), len(originalSectionContainer)) @@ -196,11 +196,11 @@ def test__duplicateSections(self): SECOND_SECTION_ADDRESS_END = 0x01FF listOfMemEntryData = [MemEntryData(FIRST_SECTION_ADDRESS_START, FIRST_SECTION_ADDRESS_END, section="first"), MemEntryData(SECOND_SECTION_ADDRESS_START, SECOND_SECTION_ADDRESS_END, section="second")] - memEntryHandler = emma_libs.memoryEntry.SectionEntry + memEntryHandler = Emma.emma_libs.memoryEntry.SectionEntry originalSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) resolvedSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) # Running the resolveDuplicateContainmentOverlap list - emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, emma_libs.memoryEntry.SectionEntry) + Emma.emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, Emma.emma_libs.memoryEntry.SectionEntry) # Check the number of elements: no elements shall be removed or added to the container self.assertEqual(len(resolvedSectionContainer), len(originalSectionContainer)) @@ -224,11 +224,11 @@ def test__containmentSections(self): SECOND_SECTION_ADDRESS_END = 0x01FF listOfMemEntryData = [MemEntryData(FIRST_SECTION_ADDRESS_START, FIRST_SECTION_ADDRESS_END, section="first"), MemEntryData(SECOND_SECTION_ADDRESS_START, SECOND_SECTION_ADDRESS_END, section="second")] - memEntryHandler = emma_libs.memoryEntry.SectionEntry + memEntryHandler = Emma.emma_libs.memoryEntry.SectionEntry originalSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) resolvedSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) # Running the resolveDuplicateContainmentOverlap list - emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, emma_libs.memoryEntry.SectionEntry) + Emma.emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, Emma.emma_libs.memoryEntry.SectionEntry) # Check the number of elements: no elements shall be removed or added to the container self.assertEqual(len(resolvedSectionContainer), len(originalSectionContainer)) @@ -252,11 +252,11 @@ def test__overlapSections(self): SECOND_SECTION_ADDRESS_END = 0x027F listOfMemEntryData = [MemEntryData(FIRST_SECTION_ADDRESS_START, FIRST_SECTION_ADDRESS_END, section="first"), MemEntryData(SECOND_SECTION_ADDRESS_START, SECOND_SECTION_ADDRESS_END, section="second")] - memEntryHandler = emma_libs.memoryEntry.SectionEntry + memEntryHandler = Emma.emma_libs.memoryEntry.SectionEntry originalSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) resolvedSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) # Running the resolveDuplicateContainmentOverlap list - emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, emma_libs.memoryEntry.SectionEntry) + Emma.emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, Emma.emma_libs.memoryEntry.SectionEntry) # Check the number of elements: no elements shall be removed or added to the container self.assertEqual(len(resolvedSectionContainer), len(originalSectionContainer)) @@ -292,11 +292,11 @@ def test__overlapMultipleSections(self): MemEntryData(SECOND_SECTION_ADDRESS_START, SECOND_SECTION_ADDRESS_END, section="second"), MemEntryData(THIRD_SECTION_ADDRESS_START, THIRD_SECTION_ADDRESS_END, section="third"), MemEntryData(FOURTH_SECTION_ADDRESS_START, FOURTH_SECTION_ADDRESS_END, section="fourth")] - memEntryHandler = emma_libs.memoryEntry.SectionEntry + memEntryHandler = Emma.emma_libs.memoryEntry.SectionEntry originalSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) resolvedSectionContainer, _ = createMemEntryObjects(listOfMemEntryData) # Running the resolveDuplicateContainmentOverlap list - emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, emma_libs.memoryEntry.SectionEntry) + Emma.emma_libs.memoryMap.resolveDuplicateContainmentOverlap(resolvedSectionContainer, Emma.emma_libs.memoryEntry.SectionEntry) # Check the number of elements: no elements shall be removed or added to the container self.assertEqual(len(resolvedSectionContainer), len(originalSectionContainer)) @@ -379,10 +379,10 @@ def checkSectionReserve(self, sectionReserve, sourceSection, expectedAddressStar self.assertEqual(sectionReserve.objectName, OBJECTS_IN_SECTIONS_SECTION_RESERVE) def assertEqualSections(self, firstSection, secondSection): - self.assertTrue(emma_libs.memoryEntry.SectionEntry.isEqual(firstSection, secondSection)) + self.assertTrue(Emma.emma_libs.memoryEntry.SectionEntry.isEqual(firstSection, secondSection)) def assertEqualObjects(self, firstObject, secondObject): - self.assertTrue(emma_libs.memoryEntry.ObjectEntry.isEqual(firstObject, secondObject)) + self.assertTrue(Emma.emma_libs.memoryEntry.ObjectEntry.isEqual(firstObject, secondObject)) def test_singleSection(self): """ @@ -394,7 +394,7 @@ def test_singleSection(self): ADDRESS_END = 0x01FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(ADDRESS_START, ADDRESS_END)], []) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + sectionReserve self.assertEqual(len(objectsInSections), 2) @@ -423,7 +423,7 @@ def test_singleSectionWithZeroObjects(self): MemEntryData(FOURTH_OBJECT_ADDRESS_START, None), MemEntryData(FIFTH_OBJECT_ADDRESS_START, None)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: firstObject + # sectionEntry + @@ -472,7 +472,7 @@ def test_multipleSectionsAndObjectsWithZeroLengths(self): MemEntryData(SECOND_OBJECT_ADDRESS_START, None), MemEntryData(THIRD_OBJECT_ADDRESS_START, THIRD_OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: firstObject + # firstSectionEntry + @@ -519,7 +519,7 @@ def test_multipleSectionsAndObjectsWithContainmentFlag(self): sectionContainer[0].containmentFlag = True sectionContainer[1].containmentFlag = True # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: firstSectionEntry + # object + @@ -544,7 +544,7 @@ def test_sectionFullWithSingleObject(self): OBJECT_ADDRESS_END = 0x02FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + object self.assertEqual(len(objectsInSections), 2) @@ -568,7 +568,7 @@ def test_sectionFullWithTwoObjects(self): sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(FIRST_OBJECT_ADDRESS_START, FIRST_OBJECT_ADDRESS_END), MemEntryData(SECOND_OBJECT_ADDRESS_START, SECOND_OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + firstObject + secondObject self.assertEqual(len(objectsInSections), 3) @@ -591,7 +591,7 @@ def test_sectionFullWithOverlappingSingleObjectAtStart(self): OBJECT_ADDRESS_END = 0x09FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: object + sectionEntry self.assertEqual(len(objectsInSections), 2) @@ -612,7 +612,7 @@ def test_sectionFullWithOverlappingSingleObjectAtEnd(self): OBJECT_ADDRESS_END = 0x07FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + object self.assertEqual(len(objectsInSections), 2) @@ -633,7 +633,7 @@ def test_sectionFullWithOverlappingSingleObjectAtStartAndEnd(self): OBJECT_ADDRESS_END = 0x03FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: object + sectionEntry self.assertEqual(len(objectsInSections), 2) @@ -654,7 +654,7 @@ def test_sectionNotFullWithSingleObjectAtStart(self): OBJECT_ADDRESS_END = 0x0410 sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + object + sectionReserve self.assertEqual(len(objectsInSections), 3) @@ -677,7 +677,7 @@ def test_sectionNotFullWithSingleObjectAtEnd(self): OBJECT_ADDRESS_END = 0x05FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + sectionReserve + object self.assertEqual(len(objectsInSections), 3) @@ -700,7 +700,7 @@ def test_sectionNotFullWithSingleObjectAtMiddle(self): OBJECT_ADDRESS_END = 0x05A0 sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + sectionReserve + object + sectionReserve self.assertEqual(len(objectsInSections), 4) @@ -725,7 +725,7 @@ def test_sectionNotFullWithSingleObjectBeforeStart(self): OBJECT_ADDRESS_END = 0x03FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: object + sectionEntry + sectionReserve self.assertEqual(len(objectsInSections), 3) @@ -748,7 +748,7 @@ def test_sectionNotFullWithSingleObjectAfterEnd(self): OBJECT_ADDRESS_END = 0x05FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + sectionReserve + object self.assertEqual(len(objectsInSections), 3) @@ -771,7 +771,7 @@ def test_sectionNotFullWithOverlappingSingleObjectBeforeStart(self): OBJECT_ADDRESS_END = 0x05FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: object + sectionEntry + sectionReserve self.assertEqual(len(objectsInSections), 3) @@ -794,7 +794,7 @@ def test_sectionNotFullWithOverlappingSingleObjectAfterEnd(self): OBJECT_ADDRESS_END = 0x04FF sectionContainer, objectContainer = createMemEntryObjects([MemEntryData(SECTION_ADDRESS_START, SECTION_ADDRESS_END)], [MemEntryData(OBJECT_ADDRESS_START, OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + sectionReserve + object self.assertEqual(len(objectsInSections), 3) @@ -833,7 +833,7 @@ def test_sectionNotFullWithMultipleObjects(self): MemEntryData(FOURTH_OBJECT_ADDRESS_START, FOURTH_OBJECT_ADDRESS_END), MemEntryData(FIFTH_OBJECT_ADDRESS_START, FIFTH_OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: sectionEntry + # firstObject + @@ -898,7 +898,7 @@ def test_multipleSectionsWithMultipleObjects(self): MemEntryData(FOURTH_OBJECT_ADDRESS_START, FOURTH_OBJECT_ADDRESS_END), MemEntryData(FIFTH_OBJECT_ADDRESS_START, FIFTH_OBJECT_ADDRESS_END)]) # Calculating the objectsInSections list - objectsInSections = emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) + objectsInSections = Emma.emma_libs.memoryMap.calculateObjectsInSections(sectionContainer, objectContainer) # Check the number of created elements: firstObject + # firstSectionEntry +