Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some common libraries improvements #589

Merged
merged 3 commits into from
Feb 17, 2025
Merged

Conversation

TomasTurina
Copy link
Member

@TomasTurina TomasTurina commented Feb 10, 2025

Description

This PR includes several improvements in common libraries.

Proposed Changes

  • Clean up a lot of unused stuff from CMakeLists.txt files.
  • Complete CMakeLists.txt files and create targets for all common C++ libraries.
  • Link against targets instead of including directories for common library usage.
  • Compile and run all UTs on all platforms.
  • Some style fixes.

Results and Evidence

Common library tests run as expected:

# make test
Running tests...
Test project /home/tomas/wazuh/wazuh-agent/src/build
      Start  1: byteArrayHelperTests
 1/56 Test  #1: byteArrayHelperTests .....................   Passed    0.00 sec
      Start  2: cmdHelperTests
 2/56 Test  #2: cmdHelperTests ...........................   Passed    0.01 sec
      Start  3: sysInfoPackagesLinuxHelper_unit_test
 3/56 Test  #3: sysInfoPackagesLinuxHelper_unit_test .....   Passed    0.01 sec
      Start  4: sysInfoPackagesBerkeleyDB_unit_test
 4/56 Test  #4: sysInfoPackagesBerkeleyDB_unit_test ......   Passed    0.01 sec
      Start  5: sysInfoNetworkLinux_unit_test
 5/56 Test  #5: sysInfoNetworkLinux_unit_test ............   Passed    0.01 sec
      Start  6: Rpm_unit_test
 6/56 Test  #6: Rpm_unit_test ............................   Passed    0.02 sec
      Start  7: sysInfoPackageLinuxParserRPM_unit_test
 7/56 Test  #7: sysInfoPackageLinuxParserRPM_unit_test ...   Passed    0.03 sec
      Start  8: sysInfoPackages_unit_test
 8/56 Test  #8: sysInfoPackages_unit_test ................   Passed    0.02 sec
      Start  9: sysinfo_unit_test
 9/56 Test  #9: sysinfo_unit_test ........................   Passed    0.04 sec
      Start 10: sysInfoPort_unit_test
10/56 Test #10: sysInfoPort_unit_test ....................   Passed    0.02 sec
      Start 11: sqlite_unit_test
11/56 Test #11: sqlite_unit_test .........................   Passed    0.06 sec
      Start 12: dbsync_unit_test
12/56 Test #12: dbsync_unit_test .........................   Passed    0.20 sec
      Start 13: dbsyncPipelineFactory_unit_test
13/56 Test #13: dbsyncPipelineFactory_unit_test ..........   Passed    0.02 sec
      Start 14: dbengine_unit_test
14/56 Test #14: dbengine_unit_test .......................   Passed    0.02 sec
      Start 15: fim_integration_test
15/56 Test #15: fim_integration_test .....................   Passed    0.42 sec
      Start 16: encodingHelperTests
16/56 Test #16: encodingHelperTests ......................   Passed    0.00 sec
      Start 17: Filesystem
17/56 Test #17: Filesystem ...............................   Passed    0.01 sec
      Start 18: FileIO
18/56 Test #18: FileIO ...................................   Passed    0.01 sec
      Start 19: globHelperTests
19/56 Test #19: globHelperTests ..........................   Passed    0.01 sec
      Start 20: hashHelperTests
20/56 Test #20: hashHelperTests ..........................   Passed    0.04 sec
      Start 21: linuxHelperTests
21/56 Test #21: linuxHelperTests .........................   Passed    0.03 sec
      Start 22: LoggerTest
22/56 Test #22: LoggerTest ...............................   Passed    0.01 sec
      Start 23: mapWrapperTests
23/56 Test #23: mapWrapperTests ..........................   Passed    0.01 sec
      Start 24: pipelineHelperTests
24/56 Test #24: pipelineHelperTests ......................   Passed    0.01 sec
      Start 25: registryHelperTests
25/56 Test #25: registryHelperTests ......................   Passed    0.01 sec
      Start 26: stringHelperTests
26/56 Test #26: stringHelperTests ........................   Passed    0.01 sec
      Start 27: threadDispatcherTests
27/56 Test #27: threadDispatcherTests ....................   Passed    0.01 sec
      Start 28: timeHelperTests
28/56 Test #28: timeHelperTests ..........................   Passed    0.02 sec
      Start 29: windowsHelperTests
29/56 Test #29: windowsHelperTests .......................   Passed    0.00 sec
      Start 30: InventoryTest
30/56 Test #30: InventoryTest ............................   Passed    0.05 sec
      Start 31: InventoryImpTest
31/56 Test #31: InventoryImpTest .........................   Passed   28.14 sec
      Start 32: InvNormalizerTest
32/56 Test #32: InvNormalizerTest ........................   Passed    0.04 sec
      Start 33: StatelessEventUnitTest
33/56 Test #33: StatelessEventUnitTest ...................   Passed    0.01 sec
      Start 34: LogcollectorUnitTests
34/56 Test #34: LogcollectorUnitTests ....................   Passed    0.03 sec
      Start 35: ModuleManagerTest
35/56 Test #35: ModuleManagerTest ........................   Passed    0.07 sec
      Start 36: AgentInfoTest
36/56 Test #36: AgentInfoTest ............................   Passed    0.02 sec
      Start 37: AgentInfoPersistanceTest
37/56 Test #37: AgentInfoPersistanceTest .................   Passed    0.01 sec
      Start 38: CentralizedConfiguration
38/56 Test #38: CentralizedConfiguration .................   Passed    0.01 sec
      Start 39: CommandHandlerTest
39/56 Test #39: CommandHandlerTest .......................   Passed    0.01 sec
      Start 40: CommandStoreTest
40/56 Test #40: CommandStoreTest .........................   Passed    0.06 sec
      Start 41: CommunicatorTest
41/56 Test #41: CommunicatorTest .........................   Passed    8.04 sec
      Start 42: ConfigParserTest
42/56 Test #42: ConfigParserTest .........................   Passed    0.02 sec
      Start 43: ConfigParserUtilsTest
43/56 Test #43: ConfigParserUtilsTest ....................   Passed    0.01 sec
      Start 44: HttpClientTest
44/56 Test #44: HttpClientTest ...........................   Passed    0.04 sec
      Start 45: HttpSocketTest
45/56 Test #45: HttpSocketTest ...........................   Passed    0.02 sec
      Start 46: HttpsSocketTest
46/56 Test #46: HttpsSocketTest ..........................   Passed    0.03 sec
      Start 47: MultiTypeQueueTest
47/56 Test #47: MultiTypeQueueTest .......................   Passed    4.54 sec
      Start 48: StorageTest
48/56 Test #48: StorageTest ..............................   Passed    0.37 sec
      Start 49: SQLiteManager_test
49/56 Test #49: SQLiteManager_test .......................   Passed    0.11 sec
      Start 50: TaskManagerTest
50/56 Test #50: TaskManagerTest ..........................   Passed    0.01 sec
      Start 51: RestartHandler
51/56 Test #51: RestartHandler ...........................   Passed   11.06 sec
      Start 52: AgentTest
52/56 Test #52: AgentTest ................................   Passed    0.13 sec
      Start 53: AgentRegistrationTest
53/56 Test #53: AgentRegistrationTest ....................   Passed    0.05 sec
      Start 54: SignalHandlerTest
54/56 Test #54: SignalHandlerTest ........................   Passed    0.01 sec
      Start 55: MessageQueueUtilsTest
55/56 Test #55: MessageQueueUtilsTest ....................   Passed    0.01 sec
      Start 56: InstanceHandlerTest
56/56 Test #56: InstanceHandlerTest ......................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 56

Total Test time (real) =  54.00 sec

Artifacts Affected

N/A

Configuration Changes

N/A

Documentation Updates

N/A

Tests Introduced

No tests were introduced, but tests were enabled for the following libraries:

  • byteArrayHelper
  • cmdHelper
  • encodingHelper
  • globHelper
  • hashHelper
  • linuxHelper
  • mapWrapper
  • pipelineHelper
  • registryHelper
  • stringHelper
  • threadDispatcher
  • timeHelper
  • windowsHelper

Review Checklist

  • Code changes reviewed
  • Relevant evidence provided
  • Tests cover the new functionality
  • Configuration changes documented
  • Developer documentation reflects the changes
  • Meets requirements and/or definition of done
  • No unresolved dependencies with other issues
  • ...

@TomasTurina TomasTurina self-assigned this Feb 10, 2025
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch 3 times, most recently from da13669 to bb45d21 Compare February 10, 2025 21:08
@TomasTurina TomasTurina linked an issue Feb 11, 2025 that may be closed by this pull request
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch 4 times, most recently from 54bedb9 to edcc192 Compare February 13, 2025 16:48
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch 3 times, most recently from 18d1d9d to 049c2f1 Compare February 13, 2025 20:36
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch 5 times, most recently from 32bb6d4 to 9fd2c96 Compare February 14, 2025 20:07
@TomasTurina TomasTurina marked this pull request as ready for review February 14, 2025 20:08
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch 3 times, most recently from 021bf03 to 01a08c0 Compare February 14, 2025 20:28
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch from 01a08c0 to 039ec16 Compare February 14, 2025 21:02
@TomasTurina TomasTurina force-pushed the fix/fix-common-targets branch from 039ec16 to 386c4e7 Compare February 14, 2025 23:17
Copy link
Member

@jr0me jr0me left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TomasTurina TomasTurina merged commit c9728a6 into main Feb 17, 2025
5 checks passed
@TomasTurina TomasTurina deleted the fix/fix-common-targets branch February 17, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve common cmake files and enable libraries UT
3 participants