Beispiel #1
0
        public static void AssertLauncherFailure(LauncherStatus status, Type expectedFailureType)
        {
            Assert.Equal(LauncherStatus.FailedStatus, status);
            var ex = status.Error.OrElse(null);

            Assert.True(HasCause(ex, expectedFailureType), "Unexpected error: " + ex);
        }
Beispiel #2
0
        internal static void Write(
            string file, LauncherStatus status, bool bFinished)
        {
            string content = GetContent(status, bFinished);

            int retries = 0;

            while (true)
            {
                try
                {
                    File.WriteAllText(file, content);
                    return;
                }
                catch (Exception e)
                {
                    mLog.Info("The status file cannot be written. Error: " + e.Message);
                    if (retries++ > 10)
                    {
                        return;
                    }

                    System.Threading.Thread.Sleep(500);
                    continue;
                }
            }
        }
Beispiel #3
0
        internal AutomatedLauncherStatus GetStatus()
        {
            mLog.DebugFormat("GetStatus invoked");

            if (mLauncher == null)
            {
                return(new AutomatedLauncherStatus());
            }

            AutomatedLauncherStatus result = new AutomatedLauncherStatus();

            LauncherStatus launcherStatus = mLauncher.GetStatus();

            if (launcherStatus == null)
            {
                return(new AutomatedLauncherStatus());
            }

            result.TestCount          = launcherStatus.TestCount;
            result.TestToExecuteCount = launcherStatus.TestToExecuteCount;
            result.CurrentTestName    = launcherStatus.CurrentTestName;
            result.CurrentTest        = launcherStatus.CurrentTest;
            result.ExecutedTests      = launcherStatus.ExecutedTests;
            result.RepeatedTests      = launcherStatus.GetRepeatedTests();
            result.FailedTests        = launcherStatus.GetFailedTests();
            result.IgnoredTests       = launcherStatus.GetIgnoredTests();
            result.WarningMsg         = launcherStatus.WarningMsg;
            result.Finished           = mbFinished;

            return(result);
        }
Beispiel #4
0
        public void TestDriverCompleted()
        {
            // NoopTask can be replaced with any other class never used in FailDriver
            LauncherStatus status = FailDriverClient.RunClient(typeof(NoopTask),
                                                               LocalRuntimeConfiguration.ConfigurationModule.Build(), JobTimeout);

            Assert.Equal(LauncherStatus.CompletedStatus, status);
        }
Beispiel #5
0
 private void UpdateStatusAndNotify(LauncherStatus status)
 {
     lock (this)
     {
         LauncherStatus = status;
         Monitor.PulseAll(this);
     }
 }
Beispiel #6
0
 static string GetContent(LauncherStatus status, bool bFinished)
 {
     return(string.Join(FileReportConstants.FIELD_SEPARATOR, new string[] {
         status.TestCount.ToString(),
         status.TestToExecuteCount.ToString(),
         status.CurrentTestName,
         status.CurrentTest.ToString(),
         status.ExecutedTests.ToString(),
         string.Join(FileReportConstants.LIST_SEPARATOR, status.GetRepeatedTests().ToArray()),
         string.Join(FileReportConstants.LIST_SEPARATOR, status.GetFailedTests().ToArray()),
         string.Join(FileReportConstants.LIST_SEPARATOR, status.GetIgnoredTests().ToArray()),
         status.WarningMsg,
         bFinished.ToString()
     }));
 }
Beispiel #7
0
 public void Close(byte[] message = null)
 {
     try
     {
         _clientStub?.DriverControlHandler(new DriverControlOp()
         {
             JobId     = _jobId,
             Message   = message == null ? ByteString.Empty : ByteString.CopyFrom(message),
             Operation = DriverControlOp.Types.Operation.Close
         });
     }
     catch (Exception e)
     {
         Log.Log(Level.Warning, "exception occurred when trying to close job", e);
     }
     LauncherStatus = LauncherStatus.ForceCloseStatus;
     _clientStub    = null;
 }
Beispiel #8
0
        private void SetStatus(LauncherStatus status)
        {
            Status = status;
            switch (Status)
            {
            case LauncherStatus.UPDATE_REQUIRED:
                LauncherButton.Content   = "Update";
                LauncherButton.IsEnabled = true;
                break;

            case LauncherStatus.UPDATE_IN_PROGRESS:
                LauncherButton.Content   = "Updating...";
                LauncherButton.IsEnabled = false;
                break;

            case LauncherStatus.READY_TO_LAUNCH:
                LauncherButton.Content   = "Launch";
                LauncherButton.IsEnabled = true;
                break;

            case LauncherStatus.READY_TO_INJECT:
                LauncherButton.Content   = "Inject";
                LauncherButton.IsEnabled = true;
                break;

            case LauncherStatus.WAITING_TO_INJECT:
                LauncherButton.Content   = "Injecting...";
                LauncherButton.IsEnabled = false;
                break;

            case LauncherStatus.INJECTED:
                LauncherButton.Content   = "Injected";
                LauncherButton.IsEnabled = false;
                break;
            }
        }
 private void OnStatusUpdate(LauncherStatus state, string message = "")
 {
     LauncherStatusChanged?.Invoke(this, lastRequestMode, state, message);
 }