feat(smc_fuzz): performance enhancement
The fuzzer now implements a return of an integer and
requires support from CI to enable name creation in tf-a-tests.
There is an additional creation of a run config that supports
this flow when invoking smc fuzz testing.
Signed-off-by: mardyk01 <mark.dykes@arm.com>
Change-Id: I9e65d16236401fdcd651fa80fd22d2042b3d7202
diff --git a/run_config/fvp-tftf.fuzz b/run_config/fvp-tftf.fuzz
new file mode 100644
index 0000000..505e308
--- /dev/null
+++ b/run_config/fvp-tftf.fuzz
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019-2024, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+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
+}
+
+generate_lava_job_template() {
+ uart="0" timeout="1200" file="tftf.exp" track_expect
+ uart="1" file="hold_uart.exp" track_expect
+
+ payload_type="tftf" gen_yaml_template
+}
diff --git a/script/gen_smc_fuzz_setup.py b/script/gen_smc_fuzz_setup.py
new file mode 100755
index 0000000..f620f80
--- /dev/null
+++ b/script/gen_smc_fuzz_setup.py
@@ -0,0 +1,41 @@
+# !/usr/bin/env python
+#
+# Copyright (c) 2024, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# Script to generate the header file compiled into fuzzer for creating
+# the various enum values used to identify the specific fuzzer function called.
+# This is intended to replace the orignal string output of the fuzzer.
+# There are two arguments... one to specify the device tree file input to the fuzzer
+# and the other to give the name and path of the header file.
+
+import re
+import argparse
+
+parser = argparse.ArgumentParser(
+ prog='gen_smc_fuzz_setup',
+ description='Creates a header file to assign enum values to fuzzing function names',
+ epilog='Two argument input')
+
+parser.add_argument('-dts', '--devtree',help="Device tree file to analyze .")
+parser.add_argument('-hdf', '--headfile',help="Header file to create .")
+
+args = parser.parse_args()
+
+addresses = {}
+numl = 1
+dt_file = open(args.devtree, "r")
+hdr_file = open(args.headfile, "w")
+dt_lines = dt_file.readlines()
+dt_file.close()
+for line in dt_lines:
+ if "functionname" in line:
+ grp = re.search(r'functionname\s*=\s*\"(\w+)\"',line)
+ fnme = grp.group(1)
+ if fnme not in addresses:
+ addresses[fnme] = 1;
+ print("#define", fnme, numl,file=hdr_file)
+ numl = numl + 1
+hdr_file.close()