arm-ffa-main: add a job to test arm-ffa crate patchsets

Replace tfa-generic-tfa-next with a more generic
`generic-lib-testing`, as testing platform independent code is
not tf-a specific.

Change-Id: I145149c77dbd6f1ec08bbc833041aba3d7fe446e
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
diff --git a/arm-ffa-main.yaml b/arm-ffa-main.yaml
new file mode 100644
index 0000000..0d7e7e3
--- /dev/null
+++ b/arm-ffa-main.yaml
@@ -0,0 +1,126 @@
+- job:
+    name: arm-ffa-main
+    node: docker-amd64-tf-a-jammy
+    project-type: multijob
+    concurrent: true
+    disabled: false
+    description: Main CI job for the arm-ffa crate
+    properties:
+    - throttle:
+        option: project
+        enabled: true
+        max-total: 5
+    - build-discarder:
+        days-to-keep: 14
+        num-to-keep: 60
+    triggers:
+    - gerrit:
+        server-name: 'review.trustedfirmware.org'
+        projects:
+        - branches:
+          - branch-compare-type: PLAIN
+            branch-pattern: 'main'
+          project-compare-type: PLAIN
+          project-pattern: 'rust-spmc/arm-ffa'
+        trigger-on:
+            - patchset-created-event:
+                exclude-drafts: true
+                exclude-trivial-rebase: false
+                exclude-no-code-change: true
+                exclude-private: true
+                exclude-wip: true
+            - comment-added-contains-event:
+                comment-contains-value: '^STAGING_RUN_FFA_CI$'
+        override-votes: true
+        gerrit-build-started-verified-value: 0
+        gerrit-build-successful-verified-value: 1
+        gerrit-build-failed-verified-value: -1
+        gerrit-build-unstable-verified-value: -1
+        gerrit-build-notbuilt-verified-value: 0
+        # without explicitly setting these values to 0, the plugin will by
+        # default leave Code Review votes
+        gerrit-build-started-codereview-value: 0
+        gerrit-build-successful-codereview-value: 0
+        gerrit-build-failed-codereview-value: 0
+        gerrit-build-unstable-codereview-value: 0
+        gerrit-build-notbuilt-codereview-value: 0
+        silent: false
+        silent-start: false
+    parameters:
+        # GERRIT_{PROJECT,BRANCH,REFSPEC} are set when triggered by a Gerrit
+        # patchset - defaults below are for manual triggers
+        - string:
+            name: GERRIT_PROJECT
+            default: 'rust-spmc/arm-ffa'
+        - string:
+            name: GERRIT_BRANCH
+            default: 'refs/heads/main'
+        - string:
+            name: GERRIT_REFSPEC
+            default: '+refs/heads/main:refs/remotes/origin/main'
+            description: |
+              'e.g. refs/changes/13/31138/1'
+        - string:
+            name: ARM_FFA_REFSPEC
+            default: ${GERRIT_REFSPEC}
+            description: |
+              'do-not-amend: used by scripts/clone.sh to fetch the correct Gerrit patchset - use GERRIT_REFSPEC instead'
+        - string:
+            name: CI_REFSPEC
+            default: '+refs/heads/tfa-next:refs/remotes/origin/tfa-next'
+            description: |
+              'Refs to fetch for the tf-a-ci-scripts repo e.g. refs/changes/13/31138/1'
+        - string:
+            name: JOBS_REFSPEC
+            default: 'refs/heads/master'
+            description: |
+              tf-a-job-configs refspec to use. The master branch is used by default.
+        - string:
+            name: TEST_FEATURES
+            description: 'Features the arm-ffa crate will be tested against'
+        - string:
+            name: SHARE_FOLDER
+            default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
+            description: 'Folder containing shared repositories for downstream pipeline jobs'
+        - string:
+            name: CLONE_REPOS
+            default: "tf-a-ci-scripts,arm-ffa"
+            description: |
+              Optional arg to clone only specific projects from default list (tf-a-ci-scripts,trusted-firmware-a,tf-a-tests,spm,tf-m-tests,tf-m-extras,etc.)
+        - string:
+            name: FETCH_SSH
+            default: 1
+            description: |
+              Fetch branches with authenticated SSH instead of anonymous HTTPS
+    wrappers:
+      - credentials-binding:
+          - ssh-user-private-key:
+              credential-id: TFA_CI_BOT_USER_SSH_KEY
+              key-file-variable: CI_BOT_KEY
+              username-variable: CI_BOT_USERNAME
+              passphrase-variable: ''
+      - workspace-cleanup
+      - timestamps
+    builders:
+    - shell:
+        !include-raw: scripts/clone.sh
+    - shell: |
+        #!/bin/bash
+        set -e
+        cat << EOF > tf-a-env.param
+        ARM_FFA_GERRIT_PROJECT=${GERRIT_PROJECT}
+        ARM_FFA_GERRIT_REFSPEC=${GERRIT_REFSPEC}
+        SHARE_FOLDER=${SHARE_FOLDER}
+        EOF
+    - multijob:
+        name: Platform independent tests
+        condition: COMPLETED
+        projects:
+        - name: generic-lib-testing
+          current-parameters: true
+          kill-phase-on: NEVER
+          predefined-parameters: |
+            TEST_REPO_NAME=arm-ffa
+            TEST_REPO_PROJECT=rust-spmc
+            TEST_FEATURES=${TEST_FEATURES}
+          property-file: tf-a-env.param
diff --git a/generic-lib-testing.yaml b/generic-lib-testing.yaml
new file mode 100644
index 0000000..0a236a8
--- /dev/null
+++ b/generic-lib-testing.yaml
@@ -0,0 +1,98 @@
+- job:
+    name: generic-lib-testing
+    node: docker-amd64-tf-a-jammy
+    project-type: freestyle
+    concurrent: true
+    disabled: false
+    defaults: global
+    description: Run platform independent tests
+    properties:
+        - build-discarder:
+            days-to-keep: 14
+    parameters:
+    - string:
+        name: TF_GERRIT_PROJECT
+        default: 'TF-A/trusted-firmware-a'
+    - string:
+        name: TF_GERRIT_BRANCH
+        default: 'refs/heads/tfa-next'
+    - string:
+        name: TF_GERRIT_REFSPEC
+        default: '+refs/heads/tfa-next:refs/remotes/origin/tfa-next'
+    - string:
+        name: CI_REFSPEC
+        default: 'refs/changes/58/39058/5'
+    - string:
+        name: JOBS_REFSPEC
+        default: 'refs/heads/master'
+        description: |
+            tf-a-job-configs refspec to use. The master branch is used by default.
+    - string:
+        name: FETCH_SSH
+        default: 1
+        description: |
+            Fetch branches with authenticated SSH instead of anonymous HTTPS
+    - string:
+        name: GERRIT_BRANCH
+        default: ''
+    - string:
+        name: CLONE_REPOS
+        default: "tf-a-ci-scripts"
+        description: |
+            Optional arg to clone only specific projects from default list (tf-a-ci-scripts,trusted-firmware-a,tf-a-tests,spm,tf-m-tests,tf-m-extras,etc.)
+    - string:
+        name: JOBS_REFSPEC
+        default: 'refs/heads/master'
+        description: |
+            tf-a-job-configs refspec to use. The master branch is used by default.
+    - string:
+        name: TEST_REPO_PROJECT
+        default: 'rust-spmc'
+    - string:
+        name: TEST_REPO_NAME
+    - string:
+        name: TEST_FEATURES
+        description: 'Features against which the library will be tested'
+    - string:
+        name: SHARE_FOLDER
+        default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
+        description: 'Folder containing shared repositories for downstream pipeline jobs'
+    wrappers:
+        - credentials-binding:
+            - ssh-user-private-key:
+                credential-id: TFA_CI_BOT_USER_SSH_KEY
+                key-file-variable: CI_BOT_KEY
+                username-variable: CI_BOT_USERNAME
+                passphrase-variable: ''
+        - timestamps
+        - timeout:
+            timeout: 240
+            fail: true
+    builders:
+    - shell:
+        !include-raw: scripts/clone.sh
+    - shell: |
+        #!/bin/bash
+        set -e
+        cat << EOF > env.param
+        QA_SERVER_PROJECT=${JOB_NAME}
+        QA_SERVER_VERSION=${BUILD_NUMBER}
+        GERRIT_PROJECT=${TF_GERRIT_PROJECT}
+        GERRIT_BRANCH=${TF_GERRIT_BRANCH}
+        GERRIT_REFSPEC=${TF_GERRIT_REFSPEC}
+        EOF
+
+        cd ${WORKSPACE}
+        # Executed project-related next checks: platform independent tests with a generic platform.
+        IS_CONTINUOUS_INTEGRATION=1 ${WORKSPACE}/tf-a-ci-scripts/script/next-checks/next-checks-generic-tests.sh ${TEST_REPO_PROJECT} ${TEST_REPO_NAME}
+    publishers:
+        - archive:
+            artifacts: 'next-generic-checks.log'
+        # TODO: it is not possible to give this groovy script the
+        #       auth/permissions required to access next-generic-checks.log
+        #       * uncomment this once the job is made public
+        #       * create the required postbuild.groovy file based on generic-lib-testing/postbuild.groovy
+        # - groovy-postbuild:
+        #     script:
+        #         !include-raw:
+        #           - tf-a-generic-tfa-next/postbuild.groovy
diff --git a/scripts/clone.sh b/scripts/clone.sh
index 47aaa63..5157541 100755
--- a/scripts/clone.sh
+++ b/scripts/clone.sh
@@ -46,6 +46,14 @@
 SPM_GERRIT_PROJECT="${SPM_GERRIT_PROJECT:-hafnium/hafnium}"
 RMM_GERRIT_PROJECT="${RMM_GERRIT_PROJECT:-TF-RMM/tf-rmm}"
 CI_GERRIT_PROJECT="${CI_GERRIT_PROJECT:-ci/tf-a-ci-scripts}"
+ARM_FFA_GERRIT_PROJECT="${ARM_FFA_GERRIT_PROJECT:-rust-spmc/arm-ffa}"
+ARM_PL011_UART_GERRIT_PROJECT="${ARM_PL011_UART_GERRIT_PROJECT:-rust-spmc/arm-pl011-uart}"
+ARM_PSCI_GERRIT_PROJECT="${ARM_PSCI_GERRIT_PROJECT:-rust-spmc/arm-psci}"
+ARM_GIC_GERRIT_PROJECT="${ARM_GIC_GERRIT_PROJECT:-rust-spmc/arm-gic}"
+ARM_FVP_BASE_PAC_GERRIT_PROJECT="${ARM_GIC_GERRIT_PROJECT:-rust-spmc/arm-fvp-base-pac}"
+ARM_SP805_GERRIT_PROJECT="${ARM_GIC_GERRIT_PROJECT:-rust-spmc/arm-sp805}"
+ARM_XLAT_GERRIT_PROJECT="${ARM_GIC_GERRIT_PROJECT:-rust-spmc/arm-xlat}"
+ARM_FW_DEV_GUIDE_GERRIT_PROJECT="${ARM_GIC_GERRIT_PROJECT:-rust-spmc/firmware-development-guide}"
 JOBS_PROJECT="${JOBS_PROJECT:-ci/tf-a-job-configs.git}"
 
 # Default Reference specs
@@ -56,6 +64,14 @@
 TF_M_TESTS_GERRIT_REFSPEC="${TF_M_TESTS_GERRIT_REFSPEC:-${REFSPEC_TF_M_TESTS}}"
 TF_M_EXTRAS_GERRIT_REFSPEC="${TF_M_EXTRAS_GERRIT_REFSPEC:-${REFSPEC_TF_M_EXTRAS}}"
 CI_REFSPEC="${CI_REFSPEC:-${REFSPEC_MASTER}}"
+ARM_FFA_REFSPEC="${ARM_FFA_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_PL011_UART_REFSPEC="${ARM_PL011_UART_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_PSCI_REFSPEC="${ARM_PSCI_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_GIC_REFSPEC="${ARM_GIC_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_FVP_BASE_PAC_REFSPEC="${ARM_FVP_BASE_PAC_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_SP805_REFSPEC="${ARM_SP805_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_XLAT_REFSPEC="${ARM_XLAT_REFSPEC:-${REFSPEC_MAIN}}"
+ARM_FW_DEV_GUIDE_REFSPEC="${ARM_FW_DEV_GUIDE_REFSPEC:-${REFSPEC_MAIN}}"
 JOBS_REFSPEC="${JOBS_REFSPEC:-${REFSPEC_MASTER}}"
 
 JOBS_REPO_NAME="tf-a-job-configs"
@@ -69,6 +85,14 @@
     "${GERRIT_HOST};${RMM_GERRIT_PROJECT};tf-rmm;${RMM_REFSPEC}"
     "${GERRIT_HOST};${TF_M_TESTS_GERRIT_PROJECT};tf-m-tests;${TF_M_TESTS_GERRIT_REFSPEC}"
     "${GERRIT_HOST};${TF_M_EXTRAS_GERRIT_PROJECT};tf-m-extras;${TF_M_EXTRAS_GERRIT_REFSPEC}"
+    "${GERRIT_HOST};${ARM_FFA_GERRIT_PROJECT};arm-ffa;${ARM_FFA_REFSPEC}"
+    "${GERRIT_HOST};${ARM_PL011_UART_GERRIT_PROJECT};arm-pl011-uart;${ARM_PL011_UART_REFSPEC}"
+    "${GERRIT_HOST};${ARM_PSCI_GERRIT_PROJECT};arm-psci;${ARM_PSCI_REFSPEC}"
+    "${GERRIT_HOST};${ARM_GIC_GERRIT_PROJECT};arm-gic;${ARM_GIC_REFSPEC}"
+    "${GERRIT_HOST};${ARM_FVP_BASE_PAC_GERRIT_PROJECT};arm-fvp-base-pac;${ARM_FVP_BASE_PAC_REFSPEC}"
+    "${GERRIT_HOST};${ARM_SP805_GERRIT_PROJECT};arm-sp805;${ARM_SP805_REFSPEC}"
+    "${GERRIT_HOST};${ARM_XLAT_GERRIT_PROJECT};arm-xlat;${ARM_XLAT_REFSPEC}"
+    "${GERRIT_HOST};${ARM_FW_DEV_GUIDE_GERRIT_PROJECT};firmware-development-guide;${ARM_FW_DEV_GUIDE_REFSPEC}"
 )
 
 df -h
diff --git a/tf-a-generic-tfa-next.yaml b/tf-a-generic-tfa-next.yaml
deleted file mode 100644
index fa7df62..0000000
--- a/tf-a-generic-tfa-next.yaml
+++ /dev/null
@@ -1,83 +0,0 @@
-- job:
-    name: tf-a-generic-tfa-next
-    node: docker-amd64-tf-a-jammy
-    project-type: freestyle
-    concurrent: true
-    disabled: false
-    defaults: global
-    description: Run platform independent tests
-    properties:
-        - build-discarder:
-            days-to-keep: 14
-    parameters:
-        - string:
-            name: TF_GERRIT_PROJECT
-            default: 'TF-A/trusted-firmware-a'
-        - string:
-            name: TF_GERRIT_BRANCH
-            default: 'refs/heads/tfa-next'
-        - string:
-            name: TF_GERRIT_REFSPEC
-            default: '+refs/heads/tfa-next:refs/remotes/origin/tfa-next'
-        - string:
-            name: TFTF_GERRIT_PROJECT
-            default: 'TF-A/tf-a-tests'
-        - string:
-            name: TFTF_GERRIT_BRANCH
-            default: 'refs/heads/master'
-        - string:
-            name: TFTF_GERRIT_REFSPEC
-            default: '+refs/heads/master:refs/remotes/origin/master'
-        - string:
-            name: CI_REFSPEC
-            default: '+refs/heads/tfa-next:refs/remotes/origin/tfa-next'
-        - string:
-            name: JOBS_REFSPEC
-            default: 'refs/heads/master'
-            description: |
-              tf-a-job-configs refspec to use. The master branch is used by default.
-        - string:
-            name: GERRIT_BRANCH
-            default: ''
-        - string:
-            name: SHARE_FOLDER
-            default: '/srv/shared/${JOB_NAME}/${BUILD_NUMBER}'
-            description: 'Folder containing shared repositories for downstream pipeline jobs'
-    wrappers:
-        - credentials-binding:
-            - ssh-user-private-key:
-                credential-id: TFA_CI_BOT_USER_SSH_KEY
-                key-file-variable: CI_BOT_KEY
-                username-variable: CI_BOT_USERNAME
-                passphrase-variable: ''
-        - timestamps
-        - timeout:
-            timeout: 240
-            fail: true
-    builders:
-    - shell:
-        !include-raw: scripts/clone.sh
-    - shell: |
-       #!/bin/bash
-       set -e
-       cat << EOF > env.param
-       QA_SERVER_PROJECT=${JOB_NAME}
-       QA_SERVER_VERSION=${BUILD_NUMBER}
-       GERRIT_PROJECT=${TF_GERRIT_PROJECT}
-       GERRIT_BRANCH=${TF_GERRIT_BRANCH}
-       GERRIT_REFSPEC=${TF_GERRIT_REFSPEC}
-       EOF
-       cd ${WORKSPACE}/trusted-firmware-a
-       # Executed project-related next checks: platform independent tests with a generic platform.
-       IS_CONTINUOUS_INTEGRATION=1 ${WORKSPACE}/tf-a-ci-scripts/script/next-checks/next-checks-generic-tests.sh
-    publishers:
-        - archive:
-            artifacts: 'trusted-firmware-a/next-generic-checks.log'
-        # TODO: it is not possible to give this groovy script the
-        #       auth/permissions required to access next-generic-checks.log
-        #       * uncomment this once the job is made public
-        #       * create the required postbuild.groovy file based on tf-a-static-tfa-next/postbuild.groovy
-        # - groovy-postbuild:
-        #     script:
-        #         !include-raw:
-        #           - tf-a-generic-tfa-next/postbuild.groovy
diff --git a/tf-a-main-tfa-next.yaml b/tf-a-main-tfa-next.yaml
index 11ea32e..f961fd1 100644
--- a/tf-a-main-tfa-next.yaml
+++ b/tf-a-main-tfa-next.yaml
@@ -141,7 +141,7 @@
         name: Platform independent tests
         condition: COMPLETED
         projects:
-        - name: tf-a-generic-tfa-next
+        - name: generic-lib-testing
           current-parameters: true
           kill-phase-on: NEVER
           property-file: tf-a-env.param