diff --git a/unittests/test_boot_message_assembly.py b/unittests/test_boot_message_assembly.py deleted file mode 100644 index 7997918c8..000000000 --- a/unittests/test_boot_message_assembly.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2014 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import spinnman.messages.spinnaker_boot.spinnaker_boot_message as boot_msg -from spinnman.config_setup import unittest_setup -from spinnman.messages.spinnaker_boot import SpinnakerBootOpCode - - -class TestSpiNNakerBootMessage(unittest.TestCase): - - def setUp(self): - unittest_setup() - - def test_create_new_boot_message(self): - msg = boot_msg.SpinnakerBootMessage(SpinnakerBootOpCode.HELLO, 0, 0, 0) - self.assertEqual(msg.data, None) - self.assertEqual(msg.opcode, SpinnakerBootOpCode.HELLO) - self.assertEqual(msg.operand_1, 0) - self.assertEqual(msg.operand_2, 0) - self.assertEqual(msg.operand_3, 0) - - -if __name__ == '__main__': - unittest.main() diff --git a/unittests/test_cfg_checker.py b/unittests/test_cfg_checker.py deleted file mode 100644 index 859e3b6a9..000000000 --- a/unittests/test_cfg_checker.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2017 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import unittest -from spinn_utilities.config_holder import run_config_checks -import spinnman -from spinnman.config_setup import unittest_setup - - -class TestCfgChecker(unittest.TestCase): - - def setUp(self): - unittest_setup() - - def test_config_checks(self): - unittests = os.path.dirname(__file__) - spinnman_dir = spinnman.__path__[0] - run_config_checks(directories=[spinnman_dir, unittests]) diff --git a/unittests/test_import_all_test.py b/unittests/test_import_all_test.py deleted file mode 100644 index 45574e3df..000000000 --- a/unittests/test_import_all_test.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2017 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import unittest -import spinn_utilities.package_loader as package_loader - - -class ImportAllModule(unittest.TestCase): - - # no unittest_setup to check all imports work without it - - def test_import_all(self): - if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true': - package_loader.load_module("spinnman", remove_pyc_files=False) - else: - package_loader.load_module("spinnman", remove_pyc_files=True) diff --git a/unittests/test_multicast_message_assembly.py b/unittests/test_multicast_message_assembly.py deleted file mode 100644 index 335f0b053..000000000 --- a/unittests/test_multicast_message_assembly.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2014 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -from spinnman.config_setup import unittest_setup -import spinnman.messages.multicast_message as multicast_msg - - -class TestMulticastMessage(unittest.TestCase): - - def setUp(self): - unittest_setup() - - def test_create_new_multicast_message_without_payload(self): - msg = multicast_msg.MulticastMessage(1) - self.assertEqual(msg.key, 1) - self.assertEqual(msg.payload, None) - - def test_create_new_multicast_message_with_payload(self): - msg = multicast_msg.MulticastMessage(1, 100) - self.assertEqual(msg.key, 1) - self.assertEqual(msg.payload, 100) - - -if __name__ == '__main__': - unittest.main() diff --git a/unittests/test_transceiver.py b/unittests/test_transceiver.py deleted file mode 100644 index e454d2963..000000000 --- a/unittests/test_transceiver.py +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (c) 2014 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import struct -from spinn_utilities.config_holder import set_config -from spinn_machine.version.version_strings import VersionStrings -from spinnman.config_setup import unittest_setup -from spinnman.data import SpiNNManDataView -from spinnman.data.spinnman_data_writer import SpiNNManDataWriter -from spinnman.transceiver import ( - create_transceiver_from_connections, create_transceiver_from_hostname, - MockableTransceiver) -from spinnman.extended.extended_transceiver import ExtendedTransceiver -from spinnman import constants -from spinnman.messages.spinnaker_boot.system_variable_boot_values import ( - SystemVariableDefinition) -from spinnman.connections.udp_packet_connections import SCAMPConnection -from spinnman.board_test_configuration import BoardTestConfiguration - - -class MockExtendedTransceiver(MockableTransceiver, ExtendedTransceiver): - pass - - def _where_is_xy(self, x: int, y: int) -> None: - return None - - def scamp_connection_selector(self): - raise NotImplementedError - - -class TestTransceiver(unittest.TestCase): - - def setUp(self): - unittest_setup() - self.board_config = BoardTestConfiguration() - - def test_create_new_transceiver_to_board(self): - self.board_config.set_up_remote_board() - connections = list() - connections.append(SCAMPConnection( - remote_host=self.board_config.remotehost)) - trans = create_transceiver_from_connections(connections=connections) - trans.get_connections() == connections - trans.close() - - def test_create_new_transceiver_one_connection(self): - self.board_config.set_up_remote_board() - connections = set() - connections.add(SCAMPConnection( - remote_host=self.board_config.remotehost)) - trans = create_transceiver_from_connections(connections=connections) - self.assertSetEqual(connections, trans.get_connections()) - trans.close() - - def test_retrieving_machine_details(self): - self.board_config.set_up_remote_board() - trans = create_transceiver_from_hostname(self.board_config.remotehost) - SpiNNManDataWriter.mock().set_machine(trans.get_machine_details()) - version = SpiNNManDataView.get_machine_version() - self.assertEqual( - version.board_shape, - (trans._get_machine_dimensions().width, - trans._get_machine_dimensions().height)) - - assert any(c.is_connected() for c in trans._scamp_connections) - print(trans._get_scamp_version()) - print(trans.get_cpu_infos()) - - def test_boot_board(self): - self.board_config.set_up_remote_board() - trans = create_transceiver_from_hostname(self.board_config.remotehost) - trans._boot_board() - - def test_set_watch_dog(self): - set_config("Machine", "versions", VersionStrings.ANY.text) - connections = [] - connections.append(SCAMPConnection(remote_host=None)) - tx = MockExtendedTransceiver() - SpiNNManDataWriter.mock().set_machine(tx.get_machine_details()) - # All chips - tx.set_watch_dog(True) - tx.set_watch_dog(False) - tx.set_watch_dog(5) - - # The expected write values for the watch dog - expected_writes = ( - SystemVariableDefinition.software_watchdog_count.default, 0, 5) - - # Check the values that were "written" for set_watch_dog, - # which should be one per chip - written_memory = tx.written_memory - write_item = 0 - for write in range(3): - for x, y in tx.get_machine_details().chip_coordinates: - assert written_memory[write_item][0] == x - assert written_memory[write_item][1] == y - assert written_memory[write_item][2] == ( - constants.SYSTEM_VARIABLE_BASE_ADDRESS + - SystemVariableDefinition.software_watchdog_count.offset) - expected_data = struct.pack("B", expected_writes[write]) - assert written_memory[write_item][3] == expected_data - write_item += 1 - - -if __name__ == '__main__': - unittest.main() diff --git a/unittests/test_version.py b/unittests/test_version.py deleted file mode 100644 index 0f896c251..000000000 --- a/unittests/test_version.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2017 The University of Manchester -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import spinn_utilities -import spinn_machine -from spinnman.transceiver.base_transceiver import ( - BaseTransceiver, _SCAMP_VERSION) -import spinnman -from spinnman.config_setup import unittest_setup - - -class Test(unittest.TestCase): - """ Tests for the SCAMP version comparison - """ - - def setUp(self): - unittest_setup() - - def test_version_same(self): - self.assertTrue(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0], _SCAMP_VERSION[1], _SCAMP_VERSION[2]))) - - def test_major_version_too_big(self): - self.assertFalse(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0] + 1, 0, 0))) - - def test_major_version_too_small(self): - self.assertFalse(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0] - 1, 0, 0))) - - def test_minor_version_bigger(self): - self.assertTrue(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0], _SCAMP_VERSION[1] + 1, _SCAMP_VERSION[2]))) - - def test_minor_version_smaller(self): - self.assertFalse(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0], _SCAMP_VERSION[1] - 1, _SCAMP_VERSION[2]))) - - def test_patch_version_bigger(self): - self.assertTrue(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0], _SCAMP_VERSION[1], _SCAMP_VERSION[2] + 1))) - - def test_patch_version_smaller(self): - self.assertFalse(BaseTransceiver._is_scamp_version_compabible(( - _SCAMP_VERSION[0], _SCAMP_VERSION[1], _SCAMP_VERSION[2] - 1))) - - def test_compare_versions(self): - spinn_utilities_parts = spinn_utilities.__version__.split('.') - spinn_machine_parts = spinn_machine.__version__.split('.') - spinnman_parts = spinnman.__version__.split('.') - - self.assertEqual(spinn_utilities_parts[0], spinnman_parts[0]) - self.assertLessEqual(spinn_utilities_parts[1], spinnman_parts[1]) - - self.assertEqual(spinn_machine_parts[0], spinnman_parts[0]) - self.assertLessEqual(spinn_machine_parts[1], spinnman_parts[1])