aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/oeqa/runtime/cases/mono.py59
-rw-r--r--lib/oeqa/runtime/files/helloworld.cs17
-rw-r--r--lib/oeqa/runtime/files/helloworldform.cs109
-rw-r--r--lib/oeqa/runtime/files/helloworldgtk.cs50
-rw-r--r--recipes-mono/images/core-image-mono.inc1
5 files changed, 236 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/cases/mono.py b/lib/oeqa/runtime/cases/mono.py
new file mode 100644
index 0000000..f5aaede
--- /dev/null
+++ b/lib/oeqa/runtime/cases/mono.py
@@ -0,0 +1,59 @@
+import os
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+from oeqa.oetest import oeRuntimeTest, skipModule
+
+class MonoCompileTest(OERuntimeTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+
+ files_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../files"))
+
+ dst = '/tmp/'
+ src = os.path.join(files_dir, 'helloworld.cs')
+ cls.tc.target.copyTo(src, dst)
+ src = os.path.join(files_dir, 'helloworldform.cs')
+ cls.tc.target.copyTo(src, dst)
+ src = os.path.join(files_dir, 'helloworldgtk.cs')
+ cls.tc.target.copyTo(src, dst)
+
+ @classmethod
+ def tearDownClass(cls):
+ files = '/tmp/helloworld.cs /tmp/helloworld.exe /tmp/helloworldform.cs /tmp/helloworldform.exe /tmp/helloworldgtk.cs /tmp/helloworldgtk.exe'
+ cls.tc.target.run('rm %s' % files)
+
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ def test_executable_compile_and_run_cmdline(self):
+ status, output = self.target.run('mcs /tmp/helloworld.cs -out:/tmp/helloworld.exe')
+ msg = 'mcs compile failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+ status, output = self.target.run('mono /tmp/helloworld.exe')
+ msg = 'running compiled file failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+ self.assertEqual(output, 'HelloWorld', msg=msg)
+
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ def test_executable_compile_and_run_winform(self):
+# if not oeRuntimeTest.hasFeature("x11"):
+# skipModule("No x11 feature in image")
+ status, output = self.target.run('mcs /tmp/helloworldform.cs -out:/tmp/helloworldform.exe -r:System.Windows.Forms -r:System.Data -r:System.Drawing')
+ msg = 'mcs compile failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+ status, output = self.target.run('export DISPLAY=:0; mono /tmp/helloworldform.exe')
+ msg = 'running compiled file failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ def test_executable_compile_and_run_gtk(self):
+# if not oeRuntimeTest.hasPackage("gtk-sharp"):
+# skipModule("No gtk-sharp package in image")
+ status, output = self.target.run('mcs /tmp/helloworldgtk.cs -out:/tmp/helloworldgtk.exe -r:System.Windows.Forms -r:System.Data -r:System.Drawing -lib:/usr/lib/mono/gtk-sharp-2.0 -r:gtk-sharp -r:glib-sharp -r:atk-sharp')
+ msg = 'mcs compile failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+ status, output = self.target.run('export DISPLAY=:0; mono /tmp/helloworldgtk.exe')
+ msg = 'running compiled file failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
diff --git a/lib/oeqa/runtime/files/helloworld.cs b/lib/oeqa/runtime/files/helloworld.cs
new file mode 100644
index 0000000..7e493ab
--- /dev/null
+++ b/lib/oeqa/runtime/files/helloworld.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HelloWorld
+{
+ public class Program
+ {
+ public static int Main(string[] args)
+ {
+ Console.WriteLine("HelloWorld");
+
+ return 0;
+ }
+ }
+}
diff --git a/lib/oeqa/runtime/files/helloworldform.cs b/lib/oeqa/runtime/files/helloworldform.cs
new file mode 100644
index 0000000..2549b91
--- /dev/null
+++ b/lib/oeqa/runtime/files/helloworldform.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Timers;
+
+namespace HelloWorldForm
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+
+ partial class Form1
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.button1 = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(108, 113);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 0;
+ this.button1.Text = "Exit";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(284, 261);
+ this.Controls.Add(this.button1);
+ this.Name = "Form1";
+ this.Text = "Hello World";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button button1;
+ }
+
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+
+ System.Timers.Timer timer1 = new System.Timers.Timer();
+ timer1.Elapsed+=new ElapsedEventHandler(OnTimedEvent);
+ timer1.Interval=3000;
+ timer1.Enabled=true;
+ }
+
+ private void OnTimedEvent(object source, ElapsedEventArgs e)
+ {
+ Console.WriteLine("Time's up!");
+ button1_Click(source, e);
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+ }
+}
+
diff --git a/lib/oeqa/runtime/files/helloworldgtk.cs b/lib/oeqa/runtime/files/helloworldgtk.cs
new file mode 100644
index 0000000..4794811
--- /dev/null
+++ b/lib/oeqa/runtime/files/helloworldgtk.cs
@@ -0,0 +1,50 @@
+using Gtk;
+using GLib;
+using System;
+
+class Hello {
+
+ static void Main()
+ {
+ Application.Init ();
+
+ GLib.Timeout.Add (3000, new GLib.TimeoutHandler (timed_out));
+
+ // Set up a button object.
+ Button btn = new Button ("Hello World");
+ // when this button is clicked, it'll run hello()
+ btn.Clicked += new EventHandler (hello);
+
+ Window window = new Window ("helloworld");
+ // when this window is deleted, it'll run delete_event()
+ window.DeleteEvent += delete_event;
+
+ // Add the button to the window and display everything
+ window.Add (btn);
+ window.ShowAll ();
+
+ Application.Run ();
+ }
+
+
+ // runs when the user deletes the window using the "close
+ // window" widget in the window frame.
+ static void delete_event (object obj, DeleteEventArgs args)
+ {
+ Application.Quit ();
+ }
+
+ // runs when the button is clicked.
+ static void hello (object obj, EventArgs args)
+ {
+ Console.WriteLine("Hello World");
+ Application.Quit ();
+ }
+
+ static bool timed_out ()
+ {
+ Console.WriteLine("Timed Out!");
+ Application.Quit ();
+ return false;
+ }
+}
diff --git a/recipes-mono/images/core-image-mono.inc b/recipes-mono/images/core-image-mono.inc
index 83f630b..c82be8a 100644
--- a/recipes-mono/images/core-image-mono.inc
+++ b/recipes-mono/images/core-image-mono.inc
@@ -1,2 +1,3 @@
IMAGE_INSTALL += "mono mono-helloworld nuget tzdata"
+DEFAULT_TEST_SUITES_pn-${PN} = "mono ssh ping"