From a7db3e8d2c55684dbe34ecf4ce460fba3be97fef Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Thu, 2 Feb 2023 15:43:25 -0500 Subject: [PATCH 1/2] Cirrus: Omit functions in env. file The `localbenchmarks()` function stores a `.env` file containing current environment variables for benchmark-classification purposes. However its naked use of `printenv` means it was logging the contents of library functions and (worse) trying to stort all the lines. This results in an unusable mess inside `benchmarks.env`. Fix this by re-using the purpose-built passthrough_envars() which is designed to only print useful, safe, env. vars. Signed-off-by: Chris Evich --- contrib/cirrus/lib.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh index 2f4e913abf..0f403ef1c8 100644 --- a/contrib/cirrus/lib.sh +++ b/contrib/cirrus/lib.sh @@ -328,16 +328,19 @@ remove_packaged_podman_files() { # Execute make localbenchmarks in $CIRRUS_WORKING_DIR/data # for preserving as a task artifact. localbenchmarks() { - local datadir + local datadir envnames envname req_env_vars DISTRO_NV PODBIN_NAME PRIV_NAME TEST_ENVIRON TEST_FLAVOR req_env_vars VM_IMAGE_NAME EC2_INST_TYPE datadir=$CIRRUS_WORKING_DIR/data mkdir -p $datadir + envnames=$(passthrough_envars | sort); ( echo "# Env. var basis for benchmarks benchmarks." - printenv | grep -Ev "$SECRET_ENV_RE" | sort + for envname in $envnames; do + printf "$envname=%q\n" "${!envname}" + done echo "# Machine details for data-comparison sake, not actual env. vars." # Checked above in req_env_vars From 45fb353f46c675011e327c05e9d90ea47a91c4b6 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Thu, 9 Feb 2023 15:39:15 -0500 Subject: [PATCH 2/2] Cirrus: Make benchmarks .env file easier to load The `benchmarks.env` file is intended for machine consumption. Including things like a `kB` unit label (like `$MEMTOTAL`) make items difficult to parse. Additionally, multi-value keys (like `$UNAME_RM`) make extra/unnecessary work for the interpreter. Simplify these items and include a data-schema version marker so an interpreter can be made aware/support future format changes. Signed-off-by: Chris Evich --- contrib/cirrus/lib.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh index 0f403ef1c8..6adec80add 100644 --- a/contrib/cirrus/lib.sh +++ b/contrib/cirrus/lib.sh @@ -346,10 +346,12 @@ localbenchmarks() { # Checked above in req_env_vars # shellcheck disable=SC2154 echo "\ +BENCH_ENV_VER=1 CPUTOTAL=$(grep -ce '^processor' /proc/cpuinfo) -INST_TYPE=$EC2_INST_TYPE # one day may include other cloud's VM types. -MEMTOTAL=$(awk -F: '$1 == "MemTotal" { print $2 }' $datadir/benchmarks.env make localbenchmarks | tee $datadir/benchmarks.raw