Notification time stamped 2023-03-01 01:08:00 UTC
From 4d945d4291393e052fec4d5b3a79d94b7bd6bbf3 Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell(a)gtmx.me>
Date: Mar 01 2023 00:29:18 +0000
Subject: Test RUSTFLAGS addition
---
diff --git a/tests/rustflags/main.fmf b/tests/rustflags/main.fmf
new file mode 100644
index 0000000..02226e2
--- /dev/null
+++ b/tests/rustflags/main.fmf
@@ -0,0 +1,7 @@
+summary: Test that conditional support for RUSTFLAGS works
+
+require:
+ - redhat-rpm-config
+ - rpm
+ - rust-packaging
+test: ./runtest.sh
diff --git a/tests/rustflags/runtest.sh b/tests/rustflags/runtest.sh
new file mode 100755
index 0000000..b6a3be0
--- /dev/null
+++ b/tests/rustflags/runtest.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/bash
+set -e -u -o pipefail
+
+# Allow for local testing
+rargs=()
+if [ -n "${MACROS_PATH:-}" ]; then
+ default_macros_path="$(rpm --showrc | grep 'Macro path' | awk -F ':
' '{print $2}')"
+ rargs+=("--macros" "${default_macros_path}:${MACROS_PATH}")
+fi
+
+build_rustflags="$(rpm -E '%{build_rustflags}')"
+# For good measure
+[ "${build_rustflags}" != "%{build_rustflags}" ]
+#
+flags="$(rpm "${rargs[@]}" -E '%set_build_flags')"
+
+echo 'Check that RUSTFLAGS is set after evaluating %set_build_flags'
+(
+ eval "${flags}"
+ # set -u will make this fail if $RUSTFLAGS isn't defined
+ [ "${RUSTFLAGS}" = "${build_rustflags}" ]
+)
https://src.fedoraproject.org/rpms/redhat-rpm-config/c/4d945d4291393e052f...