lava_helper: initial support QEMU MPS2

Add an initial configuration for lava job generator and a jinja2 template,
to support MPS2 platform under QEMU. Validated job [1].

[1] https://tf.validation.linaro.org/scheduler/job/30217

Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
Change-Id: Iaee1543403fb641596f8afd8ad0f59b39882bb0a
diff --git a/lava_helper/jinja2_templates/qemu_mps2.jinja2 b/lava_helper/jinja2_templates/qemu_mps2.jinja2
new file mode 100644
index 0000000..7e0cefe
--- /dev/null
+++ b/lava_helper/jinja2_templates/qemu_mps2.jinja2
@@ -0,0 +1,55 @@
+{#------------------------------------------------------------------------------
+# Copyright (c) 2019-2020, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-----------------------------------------------------------------------------#}
+actions:
+- deploy:
+    images:
+      mcuboot: {image_arg: '-device loader,file={mcuboot},addr=0x10000000', url: '{{ bootloader_url }}'}
+      tfm: {image_arg: '-device loader,file={tfm},addr=0x10080000', url: '{{ firmware_url }}'}
+    timeout: {seconds: 100}
+    to: tmpfs
+- boot:
+    docker: {binary: /usr/bin/qemu-system-arm, image: 'kevintownsend/lite-qemu5:v1'}
+    method: qemu
+    timeout: {seconds: 300}
+- test:
+    monitors:
+    - name: wait-finish
+      start: "Non-Secure system starting"
+      end: "End of Non-secure test suites"
+      pattern: "[\x1b]\\[37mTest suite '(?P<test_case_id>.*?)' has [\x1b]\\[32m (?P<result>PASSED|FAILED)"
+      fixupdict:
+        PASSED: pass
+        FAILED: fail
+    timeout: {seconds: 300}
+
+context:
+  arch: arm
+  cpu: 'cortex-m33'
+  machine: mps2-an521
+  serial: '-serial mon:stdio'
+  vga: '-vga none'
+  memory: 16M
+  model: model=lan9118
+
+device_type: {{ device_type }}
+job_name: {{ job_name }}
+priority: medium
+timeouts:
+  action: {seconds: 300}
+  job: {seconds: 300}
+visibility: public
+
+metadata:
+  build_no: {{ build_no }}
+  compiler: {{ compiler }}
+  build_type: {{ build_type }}
+  boot_type: {{ boot_type }}
+  name: {{ name }}
+  platform: {{ platform }}
+  build_name: {{ build_name }}
+  build_job_url: {{ build_job_url }}
+
diff --git a/lava_helper/lava_helper_configs.py b/lava_helper/lava_helper_configs.py
index cb86dc4..1920458 100644
--- a/lava_helper/lava_helper_configs.py
+++ b/lava_helper/lava_helper_configs.py
@@ -1998,6 +1998,38 @@
     },
 }
 
+qemu_mps2 = {
+    "templ": "qemu_mps2.jinja2",
+    "job_name": "qemu_mps2",
+    "device_type": "qemu",
+    "job_timeout": 300,
+    "action_timeout": 300,
+    "poweroff_timeout": 20,
+    "platforms": {"AN521": ""},
+    "compilers": ["GNUARM", "ARMCLANG"],
+    "build_types": ["Debug", "Release"],
+    "boot_types": ["NOBL2"],
+    "tests": {
+        'Default': {
+            "binaries": {
+                "firmware": "tfm_sign.bin",
+                "bootloader": "mcuboot.bin"
+            },
+            "monitors": [
+                {
+                    'name': 'Secure_Test_Suites_Summary',
+                    'start': '[Sec Thread]',
+                    'end': 'system starting',
+                    'pattern': r'\x1b\\[1;34m\\[Sec Thread\\] '
+                               r'(?P<test_case_id>Secure image '
+                               r'initializing)(?P<result>!)',
+                    'fixup': {"PASSED": "pass", "FAILED": "fail"},
+                    'required': ["secure_image_initializing"]
+                }  # Monitors
+            ]
+        },  # Default
+    }
+}
 
 # All configurations should be mapped here
 lava_gen_config_map = {
@@ -2007,6 +2039,7 @@
     "fvp_mps2_an519_bl2": fvp_mps2_an519_bl2,
     "fvp_mps2_an519_nobl2": fvp_mps2_an519_nobl2,
     "musca_b1": musca_b1_bl2,
+    "qemu_mps2": qemu_mps2,
 }
 
 lavagen_config_sort_order = [