[llvm] [lit] Allow passthrough of some QEMU_* environment variables to lit (PR #111373)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 05:51:21 PDT 2024


https://github.com/asb created https://github.com/llvm/llvm-project/pull/111373

This is an alternate implementation of a patch proposed by @preames in <https://reviews.llvm.org/D128840>. As noted there, when running non-native binaries with binfmt_misc and qemu-user you typically need to set some environment variables (at least, QEMU_LD_PREFIX), but lit strips them by default. This patch adds what I think are the two main ones to the list of those that aren't stripped. It does so in a place that applies to all lit test suites (rather than just LLVM's), and as can be seen from the other env vars in `pass_vars` I think there's already plenty of precedent for passing through environment variables known to be potentially useful to LLVM developers.

>From b5964f272582248b39841e9edd5d7b62bf585616 Mon Sep 17 00:00:00 2001
From: Alex Bradbury <asb at igalia.com>
Date: Mon, 7 Oct 2024 13:43:51 +0100
Subject: [PATCH] [lit] Allow passthrough of some QEMU_* environment variables
 to lit

This is an alternate implementation of a patch proposed by @preames in
<https://reviews.llvm.org/D128840>. As noted there, when running
non-native binaries with binfmt_misc and qemu-user you typically need to
set some environment variables (at least, QEMU_LD_PREFIX), but lit
strips them by default. This patch adds what I think are the two main
ones to the list of those that aren't stripped. It does so in a place
that applies to all lit test suites (rather than just LLVM's), and as
can be seen from the other env vars in `pass_vars` I think there's
already plenty of precedent for passing through environment variables
known to be potentially useful to LLVM developers.
---
 llvm/utils/lit/lit/TestingConfig.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py
index f81b07baeeaed0..b0d8e7149e553c 100644
--- a/llvm/utils/lit/lit/TestingConfig.py
+++ b/llvm/utils/lit/lit/TestingConfig.py
@@ -64,6 +64,8 @@ def fromdefaults(litConfig):
             "SOURCE_DATE_EPOCH",
             "GTEST_FILTER",
             "DFLTCC",
+            "QEMU_LD_PREFIX",
+            "QEMU_CPU",
         ]
 
         if sys.platform.startswith("aix"):



More information about the llvm-commits mailing list