LAVA: Run test cases only on FVP in per-patch job

LAVA tests on physical boards and QEMU are disabled in per-patch job,
which could help to improve the performance of per-patch job.

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I96019b8122d19142fd42540ac42573d31eb29d64
diff --git a/jenkins/lava-submit.jpl b/jenkins/lava-submit.jpl
index 9e27631..84eaf78 100644
--- a/jenkins/lava-submit.jpl
+++ b/jenkins/lava-submit.jpl
@@ -1,11 +1,17 @@
 #!/usr/bin/env groovy
 //-------------------------------------------------------------------------------
-// Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+// Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
 //
 // SPDX-License-Identifier: BSD-3-Clause
 //
 //-------------------------------------------------------------------------------
 
+@NonCPS
+def getUpstreamJob() {
+  def cause = manager.build.getAction(hudson.model.CauseAction.class).getCauses()
+  return cause
+}
+
 node("docker-amd64-tf-m-bionic") {
   stage("Init") {
     cleanWs()
@@ -14,6 +20,14 @@
     }
   }
   stage("LAVA") {
+
+    def fvp_only_cmd = ""
+    def upstreamProject = getUpstreamJob()[0].upstreamProject
+    if (upstreamProject == "tf-m-build-and-test") {
+      fvp_only_cmd = "--fvp-only "
+      print("Run test cases only on FVP in per-patch.")
+    }
+
     withCredentials([usernamePassword(credentialsId: env.LAVA_CREDENTIALS, passwordVariable: 'LAVA_TOKEN', usernameVariable: 'LAVA_USER')]) {
       print("Generating LAVA jobs...")
       def bl2_string = ""
@@ -27,7 +41,7 @@
       }
       dir("tf-m-ci-scripts") {
         def res = sh(script: """./lava_helper/lava_create_jobs.py \
---build-number ${env.BUILD_NUMBER} --output-dir lava_jobs \
+--build-number ${env.BUILD_NUMBER} --output-dir lava_jobs ${fvp_only_cmd}\
 --compiler ${env.COMPILER} --platform ${env.TARGET_PLATFORM} \
 ${bl2_string} ${psa_string} --build-type ${env.CMAKE_BUILD_TYPE} \
 --jenkins-build-url ${env.BUILD_URL} --proj-config ${env.PROJ_CONFIG} \