Пример #1
0
        public void ExitCodeFromPreviousRunIsIgnored()
        {
            var previousLog =
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSRefKeyObject is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b738) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259970). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSOptionalParameters is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b788) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x1032599c0). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class SecXPCHelper is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b918) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259a60). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Some other error message" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Service exited with abnormal code: 55" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 com.apple.CoreSimulator.SimDevice.F67392D9-A327-4217-B924-5DA0918415E5[811] (com.apple.security.cloudkeychainproxy3): Service only ran for 0 seconds. Pushing respawn out by 10 seconds." + Environment.NewLine;

            var currentRunLog =
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSRefKeyObject is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b738) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259970). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSOptionalParameters is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b788) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x1032599c0). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class SecXPCHelper is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b918) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259a60). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Some other error message" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Service exited with abnormal code: 72" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 com.apple.CoreSimulator.SimDevice.F67392D9-A327-4217-B924-5DA0918415E5[811] (com.apple.security.cloudkeychainproxy3): Service only ran for 0 seconds. Pushing respawn out by 10 seconds." + Environment.NewLine;

            var tempFilename = Path.GetTempFileName();

            File.WriteAllText(tempFilename, previousLog);

            var capturedFilename = Path.GetTempFileName();

            using var captureLog = new CaptureLog(capturedFilename, tempFilename, false);
            captureLog.StartCapture();
            File.AppendAllText(tempFilename, currentRunLog);
            captureLog.StopCapture();

            var appBundleInformation = new AppBundleInformation("net.dot.HelloiOS", "net.dot.HelloiOS", "some/path", "some/path", false, null);
            var exitCode             = new iOSExitCodeDetector().DetectExitCode(appBundleInformation, captureLog);

            Assert.Equal(72, exitCode);
        }
Пример #2
0
        public void CaptureRightOrder()
        {
            var ignoredLine = "This lines should not be captured";
            var logLines    = new[] { "first line", "second line", "thrid line" };

            File.WriteAllLines(_filePath, new[] { ignoredLine });

            using var captureLog = new CaptureLog(_capturePath, _filePath, false);

            captureLog.StartCapture();
            File.WriteAllLines(_filePath, logLines);
            captureLog.StopCapture();

            // get the stream and assert we do have the correct lines
            using var captureStream = captureLog.GetReader();
            string logLine;

            while ((logLine = captureStream.ReadLine()) != null)
            {
                if (!string.IsNullOrEmpty(logLine))
                {
                    Assert.Contains(logLine, logLines);
                }
            }
        }
Пример #3
0
        public void CaptureRightOrder()
        {
            var ignoredLine = "This lines should not be captured";
            var logLines    = new[] { "first line", "second line", "thrid line" };

            using (var stream = File.Create(_filePath))
                using (var writer = new StreamWriter(stream))
                {
                    writer.WriteLine(ignoredLine);
                }
            using (var captureLog = new CaptureLog(_capturePath, _filePath, false))
            {
                captureLog.StartCapture();
                using (var writer = new StreamWriter(_filePath))
                {
                    foreach (var line in logLines)
                    {
                        writer.WriteLine(line);
                    }
                }
                captureLog.StopCapture();
                // get the stream and assert we do have the correct lines
                using (var captureStream = captureLog.GetReader())
                {
                    string line;
                    while ((line = captureStream.ReadLine()) != null)
                    {
                        Assert.Contains(line, logLines);
                    }
                }
            }
        }
Пример #4
0
    public void CapturePieceByPiece()
    {
        var ignoredLine = "This line should not be captured";
        var logLines    = new[] { "first line", "second line", "third line" };

        File.WriteAllLines(_sourcePath, new[] { ignoredLine });

        using var captureLog = new CaptureLog(_destinationPath, _sourcePath, false);
        captureLog.StartCapture();

        File.AppendAllLines(_destinationPath, logLines.Take(1));
        captureLog.Flush();
        Assert.Contains(logLines.First(), File.ReadAllText(_destinationPath));

        File.AppendAllLines(_destinationPath, logLines.Skip(1));

        captureLog.StopCapture();

        // Get the stream and assert we do have the correct lines
        using var captureStream = captureLog.GetReader();
        string logLine;

        while ((logLine = captureStream.ReadLine()) != null)
        {
            Assert.NotEqual(ignoredLine, logLine);

            if (!string.IsNullOrEmpty(logLine))
            {
                Assert.Contains(logLine, logLines);
            }
        }
    }
Пример #5
0
 public void CaptureMissingFileTest()
 {
     using (var captureLog = new CaptureLog(capturePath, filePath, false)) {
         Assert.AreEqual(capturePath, captureLog.FullPath, "capture path");
         captureLog.StartCapture();
         captureLog.StopCapture();
     }
     // read the data that was added to the capture path and  ensure that we do have the name of the missing file
     using (var reader = new StreamReader(capturePath)) {
         var line = reader.ReadLine();
         StringAssert.Contains(filePath, line, "file path missing");
     }
 }
Пример #6
0
    public void CaptureMissingFileTest()
    {
        using (var captureLog = new CaptureLog(_destinationPath, _sourcePath, false))
        {
            Assert.Equal(_destinationPath, captureLog.FullPath);
            captureLog.StartCapture();
            captureLog.StopCapture();
        }

        // Read the data that was added to the capture path and  ensure that we do have the name of the missing file
        using (var reader = new StreamReader(_destinationPath))
        {
            var line = reader.ReadLine();
            Assert.Contains(_sourcePath, line);
        }
    }
Пример #7
0
    public void CaptureEverythingAtOnce()
    {
        var logLines = new[] { "first line", "second line", "third line" };

        File.WriteAllText(_sourcePath, string.Empty);

        using var captureLog = new CaptureLog(_destinationPath, _sourcePath, false);

        captureLog.StartCapture();
        File.AppendAllLines(_sourcePath, logLines);
        captureLog.StopCapture();

        // get the stream and assert we do have the correct lines
        using var captureStream = captureLog.GetReader();
        string logLine;

        while ((logLine = captureStream.ReadLine()) != null)
        {
            if (!string.IsNullOrEmpty(logLine))
            {
                Assert.Contains(logLine, logLines);
            }
        }
    }