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

#185 #189 process termination code #190

Merged

Conversation

ZevEisenberg
Copy link
Collaborator

Fixes #185
Fixes #189

Look at the process termination code instead of just parsing the logs. Correctly handles a case where the logs might mention the string "fatal error" even when the tests are passing.

@@ -9,55 +9,60 @@ class TestSuiteResultParsingSpec: QuickSpec {
context("when a test log doesn't contain a failure, runtime error, or build error") {
it("returns a passed test result") {
var contents = loadLogFile(named: "testRunWithoutFailures_withTestSucceededFooter.log")
expect(TestSuiteOutcome.from(testLog: contents)).to(equal(.passed))
expect(TestSuiteOutcome.from(testLog: contents, terminationStatus: 0)).to(equal(.passed))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used 0 for everything except the one case I cared about testing. We should probably think about whether any of the rest of these tests need to change or be expanded.

Copy link
Member

Choose a reason for hiding this comment

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

I agree (left a comment above b4 reading it, sorry 😄 )


if logContainsRuntimeError(testLog) {
if !terminationStatusIsSuccess(terminationStatus) {
Copy link
Member

Choose a reason for hiding this comment

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

I think regression tests are still passing, right? Because I think xcodebuild returns 65 when tests fails.
I've find this unofficial list of exit codes... if can also improve it later

@@ -23,16 +23,16 @@ struct MutationTestingDelegate: MutationTestingIODelegate {
savingResultsIntoFileNamed fileName: String) -> (outcome: TestSuiteOutcome, testLog: String) {
do {
let (testProcessFileHandle, testLogUrl) = try fileHandle(for: fileName)
defer { testProcessFileHandle.closeFile() }
Copy link
Member

@rakaramos rakaramos Nov 4, 2020

Choose a reason for hiding this comment

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

Is it the same behaviour as we had before? It seems now that the file handle is closed after we attempt to read it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

defer happens right before the scope closes. It should be the same behavior as before, but now it'll still happen if we add an early return. I was originally going to use a guard in an earlier version of this PR. I ended up not doing it, but I still like using defer for open/close patterns.

@rakaramos rakaramos merged commit b4e128d into master Nov 5, 2020
@rakaramos rakaramos deleted the bugfix/zeveisenberg/185-189-process-termination-code branch November 5, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants