ci(fuzzing): add fuzz testing to CI
Starting with vendor and SDEI tests. This is an experimental add for
further additions if flow works as expected.
Change-Id: I48a11c9ec110cbf10f687b4c600596db22b6e195
Signed-off-by: Mark Dykes <mark.dykes@arm.com>
diff --git a/group/tf-l3-fuzzing/fvp-aarch64-sdei,fvp-smcfuzzing:fvp-tftf-fip.tftf-aemv8a-tftf.fuzz b/group/tf-l3-fuzzing/fvp-aarch64-sdei,fvp-smcfuzzing:fvp-tftf-fip.tftf-aemv8a-tftf.fuzz
new file mode 100644
index 0000000..8e0db6b
--- /dev/null
+++ b/group/tf-l3-fuzzing/fvp-aarch64-sdei,fvp-smcfuzzing:fvp-tftf-fip.tftf-aemv8a-tftf.fuzz
@@ -0,0 +1,5 @@
+#
+# Copyright (c) 2025, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
diff --git a/run_config/fvp-tftf.fuzz b/run_config/fvp-tftf.fuzz
index e0214fe..a6468fa 100644
--- a/run_config/fvp-tftf.fuzz
+++ b/run_config/fvp-tftf.fuzz
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright (c) 2019-2024, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,6 +12,8 @@
pre_tftf_build() {
source $tftf_config_file
python3 $ci_root/script/gen_smc_fuzz_setup.py -dts $tftf_root/$SMC_FUZZ_DTS -hdf $tftf_root/smc_fuzz/include/fuzz_names.h
+ cd $tftf_root/smc_fuzz
+ python3 script/generate_smc.py -s ./$SMC_FUZZ_DEFFILE
}
generate_lava_job_template() {
diff --git a/script/gen_smc_fuzz_tests.py b/script/gen_smc_fuzz_tests.py
new file mode 100755
index 0000000..5e1c2ed
--- /dev/null
+++ b/script/gen_smc_fuzz_tests.py
@@ -0,0 +1,58 @@
+# !/usr/bin/env python
+#
+# Copyright (c) 2025 Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+
+#python3 gen_smc_fuzz_tests.py -n <number of tests>
+#This script generates the tftf config and group files for fuzzing
+import argparse
+import random
+
+parser = argparse.ArgumentParser(
+ prog='gen_smc_fuzz_tests.py',
+ description='Generates the tftf config and group files for fuzzing tests in CI',
+ epilog='one argument input')
+
+parser.add_argument('-n', '--numtests',help="number of tests")
+
+args = parser.parse_args()
+
+print("starting fuzzing generation of tests for CI")
+
+gitadd = "git add "
+
+for i in range(int(args.numtests)):
+ rnum = str(hex(random.randint(1, 100000000)))
+ tftfconfilename = "fvp-smcfuzzing_" + rnum
+ tftfconfilenamepath = "../tftf_config/" + tftfconfilename
+ configfile = open(tftfconfilenamepath, "w")
+ cline = "CROSS_COMPILE=aarch64-none-elf-\n"
+ cline += "PLAT=fvp\n"
+ cline += "TESTS=smcfuzzing\n"
+ cline += "SMC_FUZZING=1\n"
+ cline += "SMC_FUZZ_DTS=smc_fuzz/dts/sdei_coverage.dts\n"
+ cline += "SMC_FUZZER_DEBUG=1\n"
+ cline += "SMC_FUZZ_SANITY_LEVEL=3\n"
+ cline += "SMC_FUZZ_CALLS_PER_INSTANCE=10000\n"
+ cline += "SMC_FUZZ_DEFFILE=sdei_and_vendor_smc_calls.txt\n"
+ cline += "SMC_FUZZ_SEEDS=" + rnum
+ configfile.write(cline)
+ configfile.close()
+ groupfile = "fvp-aarch64-sdei," + tftfconfilename + ":fvp-tftf-fip.tftf-aemv8a-tftf.fuzz"
+ groupfilepath = "../group/tf-l3-fuzzing/" + groupfile
+ gfile = open(groupfilepath, "w")
+ gline = "#\n"
+ gline += "# Copyright (c) 2025, Arm Limited. All rights reserved.\n"
+ gline += "#\n"
+ gline += "# SPDX-License-Identifier: BSD-3-Clause\n"
+ gline += "#\n"
+ gfile.write(gline)
+ gfile.close()
+ gitadd += "./tftf_config/" + tftfconfilename + " "
+ gitadd += "./group/tf-l3-fuzzing/" + groupfile + " "
+gaddcom = open("../gitadd", "w")
+gaddcom.write(gitadd)
+gaddcom.close()
diff --git a/tftf_config/fvp-smcfuzzing b/tftf_config/fvp-smcfuzzing
index 36d28bd..301ba92 100644
--- a/tftf_config/fvp-smcfuzzing
+++ b/tftf_config/fvp-smcfuzzing
@@ -2,5 +2,8 @@
PLAT=fvp
TESTS=smcfuzzing
SMC_FUZZING=1
-SMC_FUZZ_DTS=smc_fuzz/dts/sdei.dts
-
+SMC_FUZZ_DTS=smc_fuzz/dts/sdei_coverage.dts
+SMC_FUZZER_DEBUG=1
+SMC_FUZZ_SANITY_LEVEL=3
+SMC_FUZZ_CALLS_PER_INSTANCE=10000
+SMC_FUZZ_DEFFILE=sdei_and_vendor_smc_calls.txt