Enable LAVA test job submission for Cypress PSoC64 platform

Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: Ibb7dc1fe7e17889093c7f1d6805dcf1296514501
diff --git a/lava_helper/jinja2_templates/psoc64.jinja2 b/lava_helper/jinja2_templates/psoc64.jinja2
new file mode 100644
index 0000000..651efee
--- /dev/null
+++ b/lava_helper/jinja2_templates/psoc64.jinja2
@@ -0,0 +1,46 @@
+{#------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-----------------------------------------------------------------------------#}
+{% extends 'jinja2_templates/base.jinja2' %}
+{% block actions %}
+actions:
+    - deploy:
+        timeout:
+          minutes: 12
+        to: flasher
+        images:
+          spe:
+            url: {{ spe_url }}
+          nspe:
+            url: {{ nspe_url }}
+
+    - boot:
+        method: minimal
+
+    - test:
+        monitors:
+        {%- for monitor in test.monitors %}
+        - name: "{{monitor.name}}"
+          start: "{{monitor.start}}"
+          end: "{{monitor.end}}"
+          pattern: "{{monitor.pattern}}"
+          fixupdict:
+              '{{monitor.fixup.pass}}': pass
+              '{{monitor.fixup.fail}}': fail
+        {% endfor %}
+{% endblock %}
+
+{% block metadata %}
+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 }}
+{% endblock %}
diff --git a/lava_helper/lava_create_jobs.py b/lava_helper/lava_create_jobs.py
index 83be77d..f922a73 100755
--- a/lava_helper/lava_create_jobs.py
+++ b/lava_helper/lava_create_jobs.py
@@ -149,6 +149,16 @@
                                     params,
                                     test_dict.get("binaries").get("tarball"),
                                 ),
+                                "spe_url": get_artifact_url(
+                                    artifact_store_url,
+                                    params,
+                                    test_dict.get("binaries").get("spe_image"),
+                                ),
+                                "nspe_url": get_artifact_url(
+                                    artifact_store_url,
+                                    params,
+                                    test_dict.get("binaries").get("nspe_image"),
+                                ),
                             }
                         )
                         params.update(
@@ -189,7 +199,6 @@
         config["platforms"] = {platform: config["platforms"][platform]}
     # Generate the output definition
     definitions = generate_test_definitions(config, work_dir, user_args)
-
     # Write it into a file
     out_dir = os.path.abspath(user_args.lava_def_output)
     os.makedirs(out_dir, exist_ok=True)
diff --git a/lava_helper/lava_helper_configs.py b/lava_helper/lava_helper_configs.py
index 2b3e4ec..2758503 100644
--- a/lava_helper/lava_helper_configs.py
+++ b/lava_helper/lava_helper_configs.py
@@ -3504,6 +3504,135 @@
     }
 }
 
+# Cypress PSoC64
+psoc64 = {
+    "templ": "psoc64.jinja2",
+    "job_name": "psoc64",
+    "device_type": "cy8ckit-064s0s2-4343w",
+    "job_timeout": 120,
+    "action_timeout": 120,
+    "monitor_timeout": 120,
+    "poweroff_timeout": 5,
+    "platforms": {"psoc64": ""},
+    "compilers": ["GNUARM", "ARMCLANG"],
+    "build_types": ["Release", "Minsizerel"],
+    "boot_types": ["NOBL2"],
+    "tests": {
+        "Regression": {
+            "binaries": {
+                "spe_image": "tfm_s_signed.hex",
+                "nspe_image": "tfm_ns_signed.hex",
+            },
+            "monitors": [
+                {
+                    'name': 'Secure_Test_Suites_Summary',
+                    'start': 'Secure test suites summary',
+                    'end': 'End of Secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                },
+                {
+                    'name': 'Non_Secure_Test_Suites_Summary',
+                    'start': 'Non-secure test suites summary',
+                    'end': 'End of Non-secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                }
+            ]  # Monitors
+        },
+        "RegressionIPC": {
+            "binaries": {
+                "spe_image": "tfm_s_signed.hex",
+                "nspe_image": "tfm_ns_signed.hex",
+            },
+            "monitors": [
+                {
+                    'name': 'Secure_Test_Suites_Summary',
+                    'start': 'Secure test suites summary',
+                    'end': 'End of Secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                },
+                {
+                    'name': 'Non_Secure_Test_Suites_Summary',
+                    'start': 'Non-secure test suites summary',
+                    'end': 'End of Non-secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                }
+            ]  # Monitors
+        },
+        "RegressionIPCTfmLevel2": {
+            "binaries": {
+                "spe_image": "tfm_s_signed.hex",
+                "nspe_image": "tfm_ns_signed.hex",
+            },
+            "monitors": [
+                {
+                    'name': 'Secure_Test_Suites_Summary',
+                    'start': 'Secure test suites summary',
+                    'end': 'End of Secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                },
+                {
+                    'name': 'Non_Secure_Test_Suites_Summary',
+                    'start': 'Non-secure test suites summary',
+                    'end': 'End of Non-secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                }
+            ]  # Monitors
+        },
+        "RegressionIPCTfmLevel3": {
+            "binaries": {
+                "spe_image": "tfm_s_signed.hex",
+                "nspe_image": "tfm_ns_signed.hex",
+            },
+            "monitors": [
+                {
+                    'name': 'Secure_Test_Suites_Summary',
+                    'start': 'Secure test suites summary',
+                    'end': 'End of Secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                },
+                {
+                    'name': 'Non_Secure_Test_Suites_Summary',
+                    'start': 'Non-secure test suites summary',
+                    'end': 'End of Non-secure test suites',
+                    'pattern': r"Test suite '(?P<"
+                               r"test_case_id>[^\n]+)' has(.*) "
+                               r"(?P<result>PASSED|FAILED)",
+                    'fixup': {"pass": "PASSED", "fail": "FAILED"},
+                    'required': ["secure_image_initializing"]
+                }
+            ]  # Monitors
+        },
+    },
+}
+
 # All configurations should be mapped here
 lava_gen_config_map = {
     "mps2_an521_bl2": tfm_mps2_sse_200,
@@ -3516,6 +3645,7 @@
     "musca_b1_otp": musca_b1_otp_bl2,
     "stm32l562e_dk": stm32l562e_dk,
     "lpcxpresso55s69": lpcxpresso55s69,
+    "psoc64": psoc64,
 }
 
 lavagen_config_sort_order = [