From 436748cfb84a264404f511a68c7ebd67d21339b0 Mon Sep 17 00:00:00 2001 From: Russell Hancox Date: Thu, 12 May 2022 16:42:15 -0400 Subject: [PATCH] Project: Fix layering for tests --- Source/santactl/BUILD | 13 +++++++++- Source/santad/BUILD | 32 +++++++++++++++++++++++++ Source/santametricservice/BUILD | 7 ++++++ Source/santametricservice/Writers/BUILD | 3 +++ Source/santasyncservice/BUILD | 4 ++++ 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/Source/santactl/BUILD b/Source/santactl/BUILD index 091898ad9..3faa0181e 100644 --- a/Source/santactl/BUILD +++ b/Source/santactl/BUILD @@ -90,6 +90,7 @@ santa_unit_test( "//Source/common:SNTCachedDecision", "//Source/common:SNTFileInfo", "//Source/common:SNTLogging", + "//Source/common:SNTRule", "//Source/common:SNTXPCControlInterface", "@MOLCertificate", "@MOLCodesignChecker", @@ -100,13 +101,23 @@ santa_unit_test( santa_unit_test( name = "SNTCommandMetricsTest", - srcs = ["Commands/SNTCommandMetricsTest.m"], + srcs = [ + "SNTCommand.h", + "SNTCommandController.h", + "Commands/SNTCommandMetrics.h", + "Commands/SNTCommandMetricsTest.m", + ], structured_resources = glob(["Commands/testdata/*"]), visibility = ["//:santa_package_group"], deps = [ ":santactl_lib", + "//Source/common:SNTCommonEnums", + "//Source/common:SNTConfigurator", + "//Source/common:SNTMetricSet", + "//Source/common:SNTXPCControlInterface", "//Source/santametricservice/Formats:SNTMetricFormatTestHelper", "@OCMock", + "@MOLXPCConnection", ], ) diff --git a/Source/santad/BUILD b/Source/santad/BUILD index 0611d0f4e..644fe4fe0 100644 --- a/Source/santad/BUILD +++ b/Source/santad/BUILD @@ -248,6 +248,9 @@ objc_library( "EventProviders/EndpointSecurityTestUtil.h", "EventProviders/EndpointSecurityTestUtil.mm", ], + hdrs = [ + "EventProviders/EndpointSecurityTestUtil.h", + ], sdk_dylibs = [ "EndpointSecurity", "bsm", @@ -299,6 +302,11 @@ macos_bundle( santa_unit_test( name = "SNTExecutionControllerTest", srcs = [ + "SNTExecutionController.h", + "DataLayer/SNTDatabaseTable.h", + "DataLayer/SNTEventTable.h", + "DataLayer/SNTRuleTable.h", + "EventProviders/SNTEventProvider.h", "SNTExecutionControllerTest.m", ], sdk_dylibs = [ @@ -311,6 +319,7 @@ santa_unit_test( "//Source/common:SNTCachedDecision", "//Source/common:SNTCommon", "//Source/common:SNTCommonEnums", + "//Source/common:SNTConfigurator", "//Source/common:SNTDropRootPrivs", "//Source/common:SNTFileInfo", "//Source/common:SNTLogging", @@ -319,6 +328,8 @@ santa_unit_test( "//Source/common:SNTRule", "//Source/common:SNTXPCNotifierInterface", "//Source/common:SantaCache", + "@FMDB", + "@MOLCertificate", "@MOLCodesignChecker", "@MOLXPCConnection", "@OCMock", @@ -355,6 +366,7 @@ santa_unit_test( ], deps = [ "//Source/common:SNTCachedDecision", + "//Source/common:SNTCommonEnums", "//Source/common:SNTConfigurator", "//Source/common:SNTFileInfo", "//Source/common:SNTLogging", @@ -383,7 +395,9 @@ santa_unit_test( ], deps = [ ":EndpointSecurityTestLib", + "//Source/common:SNTConfigurator", "//Source/common:SNTCommon", + "//Source/common:SNTLogging", "//Source/common:SNTPrefixTree", "//Source/common:SantaCache", ], @@ -392,6 +406,8 @@ santa_unit_test( santa_unit_test( name = "SNTDeviceManagerTest", srcs = [ + "EventProviders/DiskArbitrationTestUtil.h", + "EventProviders/SNTDeviceManager.h", "EventProviders/SNTDeviceManagerTest.mm", ], minimum_os_version = "10.15", @@ -404,6 +420,8 @@ santa_unit_test( ":EndpointSecurityTestLib", ":santad_lib", "//Source/common:SNTCommon", + "//Source/common:SNTConfigurator", + "//Source/common:SNTDeviceEvent", "//Source/common:SNTPrefixTree", "//Source/common:SantaCache", "@OCMock", @@ -413,7 +431,9 @@ santa_unit_test( santa_unit_test( name = "SNTApplicationTest", srcs = [ + "SNTApplication.h", "SNTApplicationTest.m", + "SNTDatabaseController.h", ], data = [ "//Source/santad/testdata:binaryrules_testdata", @@ -426,6 +446,9 @@ santa_unit_test( deps = [ ":EndpointSecurityTestLib", ":santad_lib", + "//Source/common:SNTConfigurator", + "@FMDB", + "@MOLCertificate", "@MOLCodesignChecker", "@MOLXPCConnection", "@OCMock", @@ -463,6 +486,7 @@ santa_unit_test( deps = [ ":SNTApplicationCoreMetrics", "//Source/common:SNTCommonEnums", + "//Source/common:SNTConfigurator", "//Source/common:SNTMetricSet", "//Source/common:SNTSystemInfo", "//Source/santametricservice/Formats:SNTMetricFormatTestHelper", @@ -473,13 +497,21 @@ santa_unit_test( santa_unit_test( name = "SNTProtobufEventLogTest", srcs = [ + "Logs/SNTLogOutput.h", + "Logs/SNTProtobufEventLog.h", "Logs/SNTProtobufEventLogTest.m", + "Logs/SNTSimpleMaildir.h", ], minimum_os_version = "10.15", deps = [ ":EndpointSecurityTestLib", ":event_logs", + "//Source/common:SNTAllowlistInfo", + "//Source/common:SNTCachedDecision", "//Source/common:SNTConfigurator", + "//Source/common:SNTLogging", + "//Source/common:SNTRule", + "//Source/common:SNTStoredEvent", "//Source/common:santa_objc_proto", "@OCMock", ], diff --git a/Source/santametricservice/BUILD b/Source/santametricservice/BUILD index f2f17e4ca..b39449bef 100644 --- a/Source/santametricservice/BUILD +++ b/Source/santametricservice/BUILD @@ -14,6 +14,9 @@ objc_library( "SNTMetricService.m", "main.m", ], + hdrs = [ + "SNTMetricService.h", + ], deps = [ "//Source/common:SNTConfigurator", "//Source/common:SNTDropRootPrivs", @@ -35,8 +38,12 @@ santa_unit_test( structured_resources = ["//Source/santametricservice/Formats:testdata"], deps = [ ":SNTMetricServiceLib", + "//Source/common:SNTCommonEnums", + "//Source/common:SNTConfigurator", + "//Source/common:SNTMetricSet", "//Source/santametricservice/Formats:SNTMetricFormatTestHelper", "@OCMock", + "@MOLAuthenticatingURLSession", ], ) diff --git a/Source/santametricservice/Writers/BUILD b/Source/santametricservice/Writers/BUILD index be493d776..b866c35f5 100644 --- a/Source/santametricservice/Writers/BUILD +++ b/Source/santametricservice/Writers/BUILD @@ -33,6 +33,7 @@ santa_unit_test( ], deps = [ ":SNTMetricFileWriter", + "//Source/common:SNTConfigurator", ], ) @@ -60,7 +61,9 @@ santa_unit_test( ], deps = [ ":SNTMetricHTTPWriter", + "//Source/common:SNTConfigurator", "@OCMock", + "@MOLAuthenticatingURLSession", ], ) diff --git a/Source/santasyncservice/BUILD b/Source/santasyncservice/BUILD index 58fc66f7f..3a7ae0daa 100644 --- a/Source/santasyncservice/BUILD +++ b/Source/santasyncservice/BUILD @@ -104,6 +104,7 @@ santa_unit_test( deps = [ ":FCM_lib", ":broadcaster_lib", + "//Source/common:SNTCommon", "//Source/common:SNTCommonEnums", "//Source/common:SNTConfigurator", "//Source/common:SNTDropRootPrivs", @@ -111,8 +112,11 @@ santa_unit_test( "//Source/common:SNTLogging", "//Source/common:SNTRule", "//Source/common:SNTStoredEvent", + "//Source/common:SNTStrengthify", + "//Source/common:SNTSystemInfo", "//Source/common:SNTXPCControlInterface", "@MOLAuthenticatingURLSession", + "@MOLCertificate", "@MOLXPCConnection", "@OCMock", ],