From: Eunki Hong Date: Thu, 26 Oct 2023 16:48:39 +0000 (+0900) Subject: Make it works on net6.0 X-Git-Tag: accepted/tizen/8.0/unified/20240613.065534~157 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8f484a66b8895b4bfdc192b2972a80b5d2586b7;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Make it works on net6.0 Signed-off-by: Eunki Hong --- diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/.vscode/launch.json b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/.vscode/launch.json index 368e16f..dc9b2c9 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/.vscode/launch.json +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/.vscode/launch.json @@ -9,7 +9,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/Tizen.NUI.Devel.Tests.dll", + "program": "${workspaceFolder}/bin/Debug/net6.0/Tizen.NUI.Devel.Tests.dll", "args": [], "env": { "DESKTOP_PREFIX":"${env:HOME}/dali-env/opt", diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/Program.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/Program.cs index 60af9ff..f954349 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/Program.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/Program.cs @@ -52,6 +52,8 @@ namespace Tizen.NUI.Devel.Tests private ManualResetEvent methodExecutionResetEvent; private TAsyncThreadMgr asyncThreadMgr; + private bool testFinished = false; + protected override void OnCreate() { base.OnCreate(); @@ -114,15 +116,18 @@ namespace Tizen.NUI.Devel.Tests { methodExecutionResetEvent.WaitOne(); - if (asyncThreadMgr.RunTestMethod() == false) + if (eventThreadCallback == null || asyncThreadMgr.RunTestMethod() == false) { mainTitle.Text = title + "Finished!\nWill be terminated after 5 seconds"; + testFinished = true; + timer = new Timer(300); timer.Tick += OnTick; timer.Start(); return; } - eventThreadCallback.Trigger(); + + eventThreadCallback?.Trigger(); } private bool OnTick(object obj, EventArgs e) @@ -163,9 +168,9 @@ namespace Tizen.NUI.Devel.Tests protected override void OnResume() { - base.OnResume(); - tlog.Debug(tag, $"OnResume()"); + + base.OnResume(); } protected override void OnPause() @@ -175,9 +180,21 @@ namespace Tizen.NUI.Devel.Tests protected override void OnTerminate() { - timer.Dispose(); - mainTitle.Unparent(); - root.Unparent(); + tlog.Debug(tag, "OnTerminate()"); + + // Clear program + timer?.Dispose(); + mainTitle?.Unparent(); + root?.Dispose(); + eventThreadCallback?.Dispose(); + + // Stop test forcely. + if (!testFinished) + { + // TODO : Currently, it is not works well... + // trunner._textRunner.StopTest(true); + } + base.OnTerminate(); Exit(); } diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSPropertyValue.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSPropertyValue.cs index aa18e3d..5a73629 100644 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSPropertyValue.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/TSPropertyValue.cs @@ -12,7 +12,6 @@ namespace Tizen.NUI.Devel.Tests public class PropertyValueTest { private const string tag = "NUITEST"; - private string path; [SetUp] public void Init() diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Api/NUnitTestAssemblyRunner.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Api/NUnitTestAssemblyRunner.cs index 10220ce..94ffb3f 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Api/NUnitTestAssemblyRunner.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Api/NUnitTestAssemblyRunner.cs @@ -261,7 +261,7 @@ namespace NUnit.Framework.Api /// public void RunAsync(ITestListener listener, ITestFilter filter) { - log.Info("Running tests"); + TLogger.Write("RunAsync Start!\n"); if (LoadedTest == null) throw new InvalidOperationException("The Run method was called but no test has been loaded"); @@ -288,6 +288,7 @@ namespace NUnit.Framework.Api StartRun(listener); WaitForCompletion(Timeout.Infinite); + TLogger.Write("RunAsync Finished!\n"); } /// @@ -297,6 +298,7 @@ namespace NUnit.Framework.Api /// True if the run completed, otherwise false public bool WaitForCompletion(int timeout) { + TLogger.Write("WaitForCompletion...\n"); #if !SILVERLIGHT && !PORTABLE return _runComplete.WaitOne(timeout, false); #else @@ -408,6 +410,7 @@ namespace NUnit.Framework.Api /// private void OnRunCompleted(object sender, EventArgs e) { + TLogger.Write("OnRunCompleted\n"); #if PARALLEL if (_pump != null) _pump.Dispose(); diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/CompositeWorkItem.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/CompositeWorkItem.cs index b06a287..e044c25 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/CompositeWorkItem.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/CompositeWorkItem.cs @@ -518,6 +518,7 @@ namespace NUnit.Framework.Internal.Execution { lock (cancelLock) { + NUnit.Framework.TUnit.TLogger.Write($"CompositeWorkItem Cancel {force}\n"); if (_children == null) return; @@ -531,6 +532,7 @@ namespace NUnit.Framework.Internal.Execution child.Cancel(force); } } + base.Cancel(force); } private string GetCaseID(string TCID) diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/ParallelWorkItemDispatcher.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/ParallelWorkItemDispatcher.cs index 37344e6..8d3a338 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/ParallelWorkItemDispatcher.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/ParallelWorkItemDispatcher.cs @@ -205,6 +205,7 @@ namespace NUnit.Framework.Internal.Execution /// public void CancelRun(bool force) { + NUnit.Framework.TUnit.TLogger.Write($"CancelRun {force}\n"); foreach (var shift in Shifts) shift.Cancel(force); } diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItem.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItem.cs index 79fad1c..fe18b79 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItem.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItem.cs @@ -75,5 +75,10 @@ namespace NUnit.Framework.Internal.Execution } } + public override void Cancel(bool force) + { + TLogger.Write($"Cancel SimpleWorkItem force:{force}\n"); + base.Cancel(force); + } } } diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItemDispatcher.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItemDispatcher.cs index 3bab6f4..b0d7c85 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItemDispatcher.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/SimpleWorkItemDispatcher.cs @@ -99,6 +99,7 @@ namespace NUnit.Framework.Internal.Execution /// true if the run should be aborted, false if it should allow its currently running test to complete public void CancelRun(bool force) { + NUnit.Framework.TUnit.TLogger.Write($"CancelRun {force}\n"); #if !PORTABLE lock (cancelLock) { diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/TestWorker.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/TestWorker.cs index dc80a92..951c3e2 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/TestWorker.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/TestWorker.cs @@ -30,6 +30,7 @@ #if PARALLEL using System; using System.Threading; +using NUnit.Framework.TUnit; namespace NUnit.Framework.Internal.Execution { @@ -112,6 +113,7 @@ namespace NUnit.Framework.Internal.Execution private void TestWorkerThreadProc() { log.Info("{0} starting ", _workerThread.Name); + TLogger.Write($"{_workerThread.Name} Started\n"); _running = true; @@ -125,15 +127,20 @@ namespace NUnit.Framework.Internal.Execution log.Info("{0} executing {1}", _workerThread.Name, _currentWorkItem.Test.Name); + TLogger.Write($"{_workerThread.Name} busy\n"); + if (Busy != null) Busy(this, EventArgs.Empty); - + + TLogger.Write($"{_workerThread.Name} executing {_currentWorkItem.Test.Name}\n"); _currentWorkItem.WorkerId = Name; _currentWorkItem.Execute(); + TLogger.Write($"{_workerThread.Name} executing {_currentWorkItem.Test.Name} done\n"); if (Idle != null) Idle(this, EventArgs.Empty); + TLogger.Write($"{_workerThread.Name} idle\n"); ++_workItemCount; } } @@ -141,6 +148,7 @@ namespace NUnit.Framework.Internal.Execution { log.Info("{0} stopping - {1} WorkItems processed.", _workerThread.Name, _workItemCount); } + TLogger.Write($"{_workerThread.Name} Finished\n"); } /// @@ -159,6 +167,7 @@ namespace NUnit.Framework.Internal.Execution /// true if the thread should be aborted, false if it should allow the currently running test to complete public void Cancel(bool force) { + TLogger.Write($"Cancel TestWorker force:{force}\n"); if (force) _running = false; @@ -167,7 +176,9 @@ namespace NUnit.Framework.Internal.Execution { _currentWorkItem.Cancel(force); if (force) + { _currentWorkItem = null; + } } } } diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkItem.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkItem.cs index 2242dad..1c12841 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkItem.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkItem.cs @@ -383,6 +383,7 @@ namespace NUnit.Framework.Internal.Execution /// true if the WorkItem should be aborted, false if it should run to completion public virtual void Cancel(bool force) { + NUnit.Framework.TUnit.TLogger.Write($"Cancel WorkItem force:{force}\n"); if (Context != null) Context.ExecutionStatus = force ? TestExecutionStatus.AbortRequested : TestExecutionStatus.StopRequested; diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkShift.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkShift.cs index 79a7b4a..4b0dc59 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkShift.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/Internal/Execution/WorkShift.cs @@ -201,6 +201,7 @@ namespace NUnit.Framework.Internal.Execution /// true if the WorkShift should be aborted, false if it should allow its currently running tests to complete public void Cancel(bool force) { + NUnit.Framework.TUnit.TLogger.Write($"Cancel shift {force}\n"); if (force) this.IsActive = false; diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/TUnit/TAsyncThreadMgr.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/TUnit/TAsyncThreadMgr.cs index 58eb76c..7191378 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/TUnit/TAsyncThreadMgr.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunit.framework/TUnit/TAsyncThreadMgr.cs @@ -44,6 +44,7 @@ namespace NUnit.Framework.TUnit public void SetData(TestCommand testCommand, TestMethod testMethod, object[] arguments, TestExecutionContext context, bool IsAsyncOperation) { + TLogger.Write($"TAsyn.SetData()\n"); this.testCommand = testCommand; this.testMethod = testMethod; this.arguments = arguments; @@ -126,6 +127,7 @@ namespace NUnit.Framework.TUnit runTearDown(); Thread.Sleep(50); #endregion + testCommand._testMethodRunComplete.Set(); _methodExecutionResetEvent.Reset(); _methodExecutionResetEvent.WaitOne(); @@ -163,6 +165,7 @@ namespace NUnit.Framework.TUnit #region nguyen.vtan add TearDown runTearDown(); #endregion + testCommand._testMethodRunComplete.Set(); _methodExecutionResetEvent.Reset(); _methodExecutionResetEvent.WaitOne(); diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TUnit/TRunner.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TUnit/TRunner.cs index ae763ea..440c257 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TUnit/TRunner.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TUnit/TRunner.cs @@ -127,14 +127,15 @@ namespace NUnitLite.TUnit //TLogger.Write("Executing the application: " + pkgName + "..."); Tizen.Log.Fatal("NUITEST", $"Executing the application: {pkgName}"); + Tizen.Log.Fatal("NUITEST", $"dllPath: {dllPath}"); string exeFilePathName = ""; - if (dllPath.Contains("netcoreapp")) + if (dllPath.Contains("net6.0")) { exeFilePathName = string.Format(dllPath + "Tizen.{0}Tests.dll", pkgName); } else { - exeFilePathName = string.Format(dllPath + "Debug/netcoreapp3.1/Tizen.{0}dll", pkgName); + exeFilePathName = string.Format(dllPath + "Debug/net6.0/Tizen.{0}dll", pkgName); } //TLogger.Write("exeFilePathName : " + exeFilePathName); Tizen.Log.Fatal("NUITEST", $"exeFilePathName : {exeFilePathName}"); diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TextRunner.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TextRunner.cs index 18fe8d3..4cb77f2 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TextRunner.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/nunitlite/TextRunner.cs @@ -420,6 +420,12 @@ namespace NUnitLite return Summary.FailureCount + Summary.ErrorCount + Summary.InvalidCount; } + public void StopTest(bool force) + { + TLogger.Write($"StopTest force:{force}\n"); + _runner.StopRun(force); + } + public void ReportResults(ITestResult result) { Summary = new ResultSummary(result);