Commit Graph

9 Commits

Author SHA1 Message Date
Uwe Seimet
efbfb54d26
More unit tests, replacement of raw pointers and C arrays, separation of concerns (#878)
* Added unit tests

* Fixed SonarCloud issues

* Updated error handling

* Updated deletion of controllers

* Image folder handling cleanup

* Fixed clang warning

* Removed duplicate code

* Reduced code complexity

* Updated array handling

* Initialize device with ID and LUN

* Use smart pointers

* Updated memory management

* Logging updates

* Extracted methods

* Split scsi.h
2022-10-04 17:23:42 +02:00
Uwe Seimet
255a6e139f
Updated memory management, added unit tests, fixed SonarCloud issues (#862)
* Updated memory management. Final goal is to get rid of raw pointers everywhere.

* Added unit tests

* Fixed SonarCloud issues
2022-10-01 17:56:06 +02:00
Daniel Markstedt
05e0a785fa
Merge pull request #851 from akuker/rdmark-rename-host-bridge
Rename the Host Bridge INQUIRY product to RASCSI BRIDGE
2022-09-30 18:57:51 -07:00
Uwe Seimet
016a616b72
Added unit tests and convenience methods, fixed SonarCloud issues, include file cleanup (#849)
* Added unit tests, add convenience methods, fixed SonarCloud issues

* Replaced C-style arrays by C++ arrays

* Replaced ASSERT

* Constants cleanup

* Include cleanup

* Moved _LARGEFILE64_SOURCE to Makefile, so that os.h is not always needed

* os.h cleanup

* Fixed clang++ warnings

* Split protobuf_util

* Fixed SonarCloud issues

* Removed duplicate code

* DeviceFactory is not a singleton anymore

* Replaced macros

* Removed obsolete interface

* Replaced DWORD

* Improved locality of code

* Removed duplicate code

* Extracted CDTrack

* Split disk_track_cache

* Replaced localtime by localtime_r

* Moved CTapDriver cleanup to destructor

* Removed redunant struct keywords
2022-09-25 23:49:24 +02:00
Daniel Markstedt
1938a8b45f Rename the Host Bridge INQUIRY product to RASCSI BRIDGE, as expected by the RASETHER.SYS driver. 2022-09-22 09:03:36 -07:00
Uwe Seimet
241e739d3a
Memory management update, SonarCloud fixes, fix for issue #841 (#842)
- Memory management updates, more fixed Sonar issues
* Replaced macros, fixed other sonar issues
* Added const, replaced enum with a single value by constant
* Updated object initializations
* Fixed potential strncpy overflow reported by gcc 8.3
2022-09-15 23:01:10 +02:00
Uwe Seimet
d80fbec03d
Added support for .hd1 (SCSI-1) image files (#828)
* Added support for .hd1 (SCSI-1) image files

* Update c-cpp.yml

* Fixed unit test warnings

* Fixed wrong scan default default (must be 1, not -1)

* Updated max length check

* Removed file not present in develop branch

* Added unit test

* Added workflow configurations and README updates (#832)

* automated test try 1

* filter branches

* filter branches

* filter branches

* filter branches

* filter branches

* Configured build and test CI workflows

* enable for all branches

* Update README.md

* Update README.md

Co-authored-by: Tony Kuker <akuker@gmail.com>

* Fix simple SonarCloud issues (#834)

* Fixing SonarCloud issues, first round

* Fixing SonarCLoud issues, next round

* Fixing SonarQube issues, next round

* Fixed warning

* Replaced empty constructors/destructors with = default;

* Fixed warning

* Replaced new

* Use constants instead of macros

* Use structured binding declarations

* Use init statements for if

* Use string views

* Use enum class, use using instead of typedef

* Fixed more SonarCloud warnings

* Replaced redundant/duplicate types with auto

* Devlared methods const

* Memory management update

* Fixed warning

* Added missing const

* Improved RaScsiResponse memory management

* Improved memory management

* Improved memory management

* Replaced macros by constants, removed unused constants

* Made member private

* Fixed warning

* Added comment

* Fixed shadowing warnings

* Cleanup

* Cleanup

* Cleanup

* Fixed shadowing warning

* Removed unused code

* Fixed more warnings

* Removed obsolete casts

* Fixed warnings

* Removed unused field

* Removed library not needed by rasctl

* Include cleanup

* Updated platform check for better compatibility

* Improved check for invalid option. This prevents rasctl to break on macos.

* Updated option check

* Fixed typo

* Added TODO

* Removed macro

* Scope update

* Replaced macro

* Added TODO, update memory management

* Fixed typo

* Replaced NULL by nullptr

* Use more structured bindings

* Added TODO

* Use calloc instead of mallco to not need memset

* Fixed warnings

* Fixed SonarQube initialization issues

* Fixed warning

* Cleaned up override/virtual/final

* Fixed warnings

* Constructor update

* Fixed tests

* Improved memory management

* Added missing const

* Added const

* Fixed two bugs reported by SonarCloud

* Fix SonarCloud hotspot

* Fixed memory management

* Memory management update

* Addressing hotspot by using strncpy

* Fixed SonarCloud issues

* Fixed SonarQube issues

* Added missing const

* Added const

* Added const

* Suppress false positive

* Added SonarQube suppressions for false positives

* Added suppresoin

* Fixed code smells

* Reverted changes that is a SonarQube issue, but caused problems with -O3

* Removed TODO based on review

* Update c-cpp.yml

* Finalized merge

Co-authored-by: akuker <34318535+akuker@users.noreply.github.com>
Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-09-07 21:45:00 -05:00
Uwe Seimet
ddeede2beb
SASI code removal, error handling update, bug fixes, code cleanup (#806)
Summary ov most important changes triggered by the SASI code removal:

- Removed the SASI controller code
- New controller management. There is a new controller base class AbstractController and a class ControllerManager managing the controller lifecycle. The lifecycle management was removed from rasci.cpp and is covered by unit tests.
- New device management. The DeviceFactory manages the device lifecycle instead of rascsi.cpp. The new code is covered by unit tests.
- The lifecycle managment uses C++ collections with variable size instead of arrays with hard-coded sizes.
- The ScsiController method contains most of what was previously contained in scsidev_ctrl.cpp plus the code from sasidev_ctrl.cpp that was relevant for SCSI.
- scsi_command_util contains helper methods used for identical SCSI command implementations of more than one device
- Devices know their controllers, so that the controller instance does not need to be passed to each SCSI command. This change helps to decouple the devices from the controller. The phase_handler interface is also part of this decoupling.
- Use scsi_command_exception for propagating SCSI command execution errors, This resolves issues with the previous error handling, which was based on return values and often on magic numbers.
- Removed legacy SCSI error codes, all errors are now encoded by sense_key::, asc:: and status::.
- Fixed various warnings reported with -Wextra, -Weffc++ and -Wpedantic.
- Use constructor member initialization lists (recommended for ISO C++)
- Consistently use new/delete instead of malloc/free (recommended for ISO C++), resulting in better type safety and error handling
- Replaced variable sized arrays on the stack (violates ISO C++ and can cause a stack overflow)
- Replaced NULL by nullptr (recommended for C++), resulting in better type safety
- Use more const member functions in order to avoid side effects
- The format device page can now also be changed for hard disk drives (Fujitsu M2624S supports this, for instance), not just for MOs.
- Better encapsulation, updated access specifiers in many places
- Removed unused methods and method arguments
- Fixed a number of TODOs
- Added/updated unit tests for a lot of non-legacy classes
- Makefile support for creating HTML coverage reports with lcov/genhtml
2022-09-03 16:53:53 +02:00
Uwe Seimet
7fc84c4217
Initial unit tests based on GoogleTest and GoogleMock (#802)
* Initial dummy test

* Makefile update

* Make protected method visible

* Test update

* Test update

* Updated mode page device

* Only build tests with explicit test target

* make test builds and executes tests

* Replaced constant

* Added TODO

* Merged develop

* Added unit test

* Comment update

* Unit test update

* Added tests

* Added tests

* Test cleanup

* Updated error handling

* Reverted MODE SENSE change

* Reverted last change

* Use GoogleMock

* Comment update

* Signature update

* Cleanup

* Cleanup

* Further cleanup

* Removed obsolete comment

* Updated error handling

* Cleanup

* Added TODO

* Added test

* Added test

* Renaming

* Added test

* Cleanup

* Header update

* Added two tests

* Renaming

* Fixed test argument order

* Namespaces are needed in order to avoid name clashes

* Added test

* Added tests

* Added tests

* Added tests

* Added tests

* Updated host services test

* Merge with develop

* Moved code

* Renaming

* Added tests

* Added tests

* Initial device tests

* Test cleanup

* Added test

* Removed cast

* RASCSI_TEST target has to depend on SRC_PROTOBUF
2022-08-28 12:25:08 -05:00