Skip to content

Commit 6c49075

Browse files
committed
Updated signpost code in tests to only run on macOS 10.14 and above
1 parent b6f2e17 commit 6c49075

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

Tests/ExtractBufferedDataTests.m

+34-11
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,34 @@ - (void)testExtractBufferedData_VeryLarge
9797
{
9898
os_log_t log = os_log_create("UnrarKit-testExtractBufferedData_VeryLarge", OS_LOG_CATEGORY_POINTS_OF_INTEREST);
9999

100-
os_signpost_id_t createTextFileID = os_signpost_id_generate(log);
101-
os_signpost_interval_begin(log, createTextFileID, "Create Text File");
100+
os_signpost_id_t createTextFileID;
101+
102+
if (@available(macOS 10.14, *)) {
103+
createTextFileID = os_signpost_id_generate(log);
104+
os_signpost_interval_begin(log, createTextFileID, "Create Text File");
105+
}
106+
102107
NSURL *largeTextFile = [self randomTextFileOfLength:1000000]; // Increase for a more dramatic test
103-
XCTAssertNotNil(largeTextFile, @"No large text file URL returned");
104-
os_signpost_interval_end(log, createTextFileID, "Create Text File");
105108

106-
os_signpost_id_t archiveDataID = os_signpost_id_generate(log);
107-
os_signpost_interval_begin(log, archiveDataID, "Archive Data");
109+
if (@available(macOS 10.14, *)) {
110+
XCTAssertNotNil(largeTextFile, @"No large text file URL returned");
111+
os_signpost_interval_end(log, createTextFileID, "Create Text File");
112+
}
113+
114+
os_signpost_id_t archiveDataID;
115+
116+
if (@available(macOS 10.14, *)) {
117+
archiveDataID = os_signpost_id_generate(log);
118+
os_signpost_interval_begin(log, archiveDataID, "Archive Data");
119+
}
120+
108121
NSURL *archiveURL = [self archiveWithFiles:@[largeTextFile]];
122+
109123
XCTAssertNotNil(archiveURL, @"No archived large text file URL returned");
110-
os_signpost_interval_end(log, archiveDataID, "Archive Data");
124+
125+
if (@available(macOS 10.14, *)) {
126+
os_signpost_interval_end(log, archiveDataID, "Archive Data");
127+
}
111128

112129
NSURL *deflatedFileURL = [self.tempDirectory URLByAppendingPathComponent:@"DeflatedTextFile.txt"];
113130
BOOL createSuccess = [[NSFileManager defaultManager] createFileAtPath:deflatedFileURL.path
@@ -122,8 +139,12 @@ - (void)testExtractBufferedData_VeryLarge
122139

123140
URKArchive *archive = [[URKArchive alloc] initWithURL:archiveURL error:nil];
124141

125-
os_signpost_id_t extractDataID = os_signpost_id_generate(log);
126-
os_signpost_interval_begin(log, extractDataID, "Extract Data");
142+
os_signpost_id_t extractDataID;
143+
144+
if (@available(macOS 10.14, *)) {
145+
extractDataID = os_signpost_id_generate(log);
146+
os_signpost_interval_begin(log, extractDataID, "Extract Data");
147+
}
127148

128149
NSError *error = nil;
129150
BOOL success = [archive extractBufferedDataFromFile:largeTextFile.lastPathComponent
@@ -134,8 +155,10 @@ - (void)testExtractBufferedData_VeryLarge
134155
[deflated writeData:dataChunk];
135156
}];
136157

137-
os_signpost_interval_end(log, extractDataID, "Extract Data");
138-
158+
if (@available(macOS 10.14, *)) {
159+
os_signpost_interval_end(log, extractDataID, "Extract Data");
160+
}
161+
139162
XCTAssertTrue(success, @"Failed to read buffered data");
140163
XCTAssertNil(error, @"Error reading buffered data");
141164

0 commit comments

Comments
 (0)