tfa-next: Enable rfa-fvp run tests in LAVA CI
The rfa-fvp setup was done to be able to run tests locally.
Add the following changes so that the runtime (not just build)
rfa-fvp tests can also run on Jenkins CI and LAVA:
* As all tfa-next tests require the modification of the RUSTUP_HOME
variable, modify this directly in build_package.sh before
pre_tf_build.
* Generate the lava job template that is later used by gen_fvp_yaml.
* Mirror the expect/tfa-next.exp file in expect-lava as needed by
LAVA.
Change-Id: I6fd7a36227b402111d1b93f47803deee2575eb3f
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
diff --git a/expect-lava/tfa-next.exp b/expect-lava/tfa-next.exp
new file mode 100644
index 0000000..56f80da
--- /dev/null
+++ b/expect-lava/tfa-next.exp
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 2024 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Expect script for Rusted Firmware
+#
+
+source $ci_root/expect-lava/trusted-firmware.inc
+
+expect_string+=('i;Rust BL31 starting')
+
+expect_string+=('i;Page table activated.')
diff --git a/group/tf-next-build/fvp-next:nil b/group/tf-next-build/fvp-next:nil
index ea434db..3cdfcfb 100644
--- a/group/tf-next-build/fvp-next:nil
+++ b/group/tf-next-build/fvp-next:nil
@@ -6,36 +6,6 @@
#
pre_tf_build() {
if not_upon "$local_ci"; then
- # pre_tf_build() and other call hooks are invoked from within subshells, so
- # environment variables are lost when calling them (except $PATH somehow is
- # retained)
- # - use `set_hook_var` to propagate to other levels, e.g. the actual
- # tf_build() stage
- # - use `export $VAR=` for use inside this pre_tf_build() stage
- #
- # In the CI Dockerfile, rustup is installed by the root user in the
- # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
- # access rust config e.g. default toolchains and run cargo
- #
- # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
- # user, it uses the default /home/buildslave/.cargo directory which it has
- # write permissions for - that allows it to download new crates during
- # compilation
- #
- # The buildslave user does not have write permissions to the default
- # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
- # new crates otherwise
- #
- # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
- # still run via the root installation
- #
- # see https://github.com/rust-lang/rustup/issues/1085
- #
- # set_hook_var propagates RUSTUP_HOME var to lower levels...
- set_hook_var RUSTUP_HOME /usr/local/rustup
- # ...but not to pre_tf_build() - explicit exporting is required to run
- # clippy here
- export RUSTUP_HOME=/usr/local/rustup
make PLAT=fvp -C "$tf_root/rust" clippy
fi
}
diff --git a/group/tf-next-build/qemu-next:nil b/group/tf-next-build/qemu-next:nil
index f6bf20c..cb21adf 100644
--- a/group/tf-next-build/qemu-next:nil
+++ b/group/tf-next-build/qemu-next:nil
@@ -6,36 +6,6 @@
#
pre_tf_build() {
if not_upon "$local_ci"; then
- # pre_tf_build() and other call hooks are invoked from within subshells, so
- # environment variables are lost when calling them (except $PATH somehow is
- # retained)
- # - use `set_hook_var` to propagate to other levels, e.g. the actual
- # tf_build() stage
- # - use `export $VAR=` for use inside this pre_tf_build() stage
- #
- # In the CI Dockerfile, rustup is installed by the root user in the
- # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
- # access rust config e.g. default toolchains and run cargo
- #
- # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
- # user, it uses the default /home/buildslave/.cargo directory which it has
- # write permissions for - that allows it to download new crates during
- # compilation
- #
- # The buildslave user does not have write permissions to the default
- # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
- # new crates otherwise
- #
- # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
- # still run via the root installation
- #
- # see https://github.com/rust-lang/rustup/issues/1085
- #
- # set_hook_var propagates RUSTUP_HOME var to lower levels...
- set_hook_var RUSTUP_HOME /usr/local/rustup
- # ...but not to pre_tf_build() - explicit exporting is required to run
- # clippy here
- export RUSTUP_HOME=/usr/local/rustup
make PLAT=qemu -C "$tf_root/rust" clippy
fi
}
diff --git a/run_config/fvp-next b/run_config/fvp-next
index 7b46cf0..3eb9802 100644
--- a/run_config/fvp-next
+++ b/run_config/fvp-next
@@ -5,6 +5,9 @@
# SPDX-License-Identifier: BSD-3-Clause
#
+generate_lava_job_template() {
+ payload_type="linux" gen_yaml_template
+}
generate_lava_job() {
local model="base-aemv8a"
diff --git a/script/build_package.sh b/script/build_package.sh
index 6538541..db1f5fd 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -1532,6 +1532,27 @@
echo "Building Trusted Firmware ($mode) ..." |& log_separator
+ if upon "$(get_tf_opt RUST)" && not_upon "$local_ci"; then
+ # In the CI Dockerfile, rustup is installed by the root user in the
+ # non-default location /usr/local/rustup, so $RUSTUP_HOME is required to
+ # access rust config e.g. default toolchains and run cargo
+ #
+ # Leave $CARGO_HOME blank so when this script is run in CI by the buildslave
+ # user, it uses the default /home/buildslave/.cargo directory which it has
+ # write permissions for - that allows it to download new crates during
+ # compilation
+ #
+ # The buildslave user does not have write permissions to the default
+ # $CARGO_HOME=/usr/local/cargo dir and so will error when trying to download
+ # new crates otherwise
+ #
+ # note: $PATH still contains /usr/local/cargo/bin at this point so cargo is
+ # still run via the root installation
+ #
+ # see https://github.com/rust-lang/rustup/issues/1085
+ set_hook_var "RUSTUP_HOME" "/usr/local/rustup"
+ fi
+
# Call pre-build hook
call_hook pre_tf_build