[clang] [SystemZ] Set source date epoch in clang lit tests for z/OS (PR #238545)
Sean Perry via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 3 13:59:28 PST 2026
https://github.com/perry-ca created https://github.com/llvm/llvm-project/pull/238545
All of these tests run two compiles and then compare the output. The IR for z/OS includes a timestamp. That can cause the compares to fail. Add the source epoch option to ensure the compares don't fail because of the time stamp.
>From 20caea1867c52425efa83043822295dd2958ff20 Mon Sep 17 00:00:00 2001
From: Sean Perry <perry at ca.ibm.com>
Date: Mon, 2 Nov 2026 22:42:24 -0500
Subject: [PATCH] [SystemZ] Set source date epoch in clang lit tests for z/OS
---
clang/test/DebugInfo/CXX/determinism.cpp | 4 ++--
clang/test/Frontend/ast-main.c | 4 ++--
clang/test/Frontend/ast-main.cpp | 4 ++--
clang/test/Frontend/ir-support.c | 10 +++++-----
clang/test/Modules/empty.modulemap | 4 ++--
clang/test/PCH/designated-init.c | 4 ++--
clang/test/VFS/output-file-permissions.c | 4 ++--
7 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/clang/test/DebugInfo/CXX/determinism.cpp b/clang/test/DebugInfo/CXX/determinism.cpp
index c0a70a09c95db0..f413f9bc16ed22 100644
--- a/clang/test/DebugInfo/CXX/determinism.cpp
+++ b/clang/test/DebugInfo/CXX/determinism.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -o %t1.ll %s
-// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -o %t2.ll %s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -emit-llvm -debug-info-kind=limited -o %t1.ll %s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -emit-llvm -debug-info-kind=limited -o %t2.ll %s
// RUN: diff %t1.ll %t2.ll
template <int N> struct C {
diff --git a/clang/test/Frontend/ast-main.c b/clang/test/Frontend/ast-main.c
index 6a64497f4109ca..ff5991c03c9c5b 100644
--- a/clang/test/Frontend/ast-main.c
+++ b/clang/test/Frontend/ast-main.c
@@ -1,6 +1,6 @@
-// RUN: env SDKROOT="/" %clang -emit-llvm -S -o - -x c - < %s | grep -v DIFile > %t1.ll
+// RUN: env SDKROOT="/" %clang -Xclang -source-date-epoch -Xclang 1613676318 -emit-llvm -S -o - -x c - < %s | grep -v DIFile > %t1.ll
// RUN: env SDKROOT="/" %clang -emit-ast -o %t.ast %s
-// RUN: env SDKROOT="/" %clang -emit-llvm -S -o - -x ast - < %t.ast | grep -v DIFile > %t2.ll
+// RUN: env SDKROOT="/" %clang -Xclang -source-date-epoch -Xclang 1613676318 -emit-llvm -S -o - -x ast - < %t.ast | grep -v DIFile > %t2.ll
// RUN: diff %t1.ll %t2.ll
int main(void) {
diff --git a/clang/test/Frontend/ast-main.cpp b/clang/test/Frontend/ast-main.cpp
index fc09e6437f93f1..ea4ce52e01a509 100644
--- a/clang/test/Frontend/ast-main.cpp
+++ b/clang/test/Frontend/ast-main.cpp
@@ -1,6 +1,6 @@
-// RUN: env SDKROOT="/" %clang -Wno-error=return-type -emit-llvm -S -o - -x c++ - < %s | grep -v DIFile > %t1.ll
+// RUN: env SDKROOT="/" %clang -Wno-error=return-type -Xclang -source-date-epoch -Xclang 1613676318 -emit-llvm -S -o - -x c++ - < %s | grep -v DIFile > %t1.ll
// RUN: env SDKROOT="/" %clang -Wno-error=return-type -fno-delayed-template-parsing -emit-ast -o %t.ast %s
-// RUN: env SDKROOT="/" %clang -Wno-error=return-type -emit-llvm -S -o - -x ast - < %t.ast | grep -v DIFile > %t2.ll
+// RUN: env SDKROOT="/" %clang -Wno-error=return-type -Xclang -source-date-epoch -Xclang 1613676318 -emit-llvm -S -o - -x ast - < %t.ast | grep -v DIFile > %t2.ll
// RUN: diff %t1.ll %t2.ll
// http://llvm.org/bugs/show_bug.cgi?id=15377
diff --git a/clang/test/Frontend/ir-support.c b/clang/test/Frontend/ir-support.c
index d0c7dfa418cad2..c69c04ee341e52 100644
--- a/clang/test/Frontend/ir-support.c
+++ b/clang/test/Frontend/ir-support.c
@@ -4,16 +4,16 @@
// We strip differing '.file' directives before comparing.
// Reference output:
-// RUN: %clang_cc1 -S -o - %s | grep -v '\.file' > %t.s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -S -o - %s | grep -v '\.file' > %t.s
// LLVM bitcode:
-// RUN: %clang_cc1 -emit-llvm-bc -o %t.bc %s
-// RUN: %clang_cc1 -S -o - %t.bc | grep -v '\.file' > %t.bc.s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -emit-llvm-bc -o %t.bc %s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -S -o - %t.bc | grep -v '\.file' > %t.bc.s
// RUN: diff %t.s %t.bc.s
// LLVM IR source code:
-// RUN: %clang_cc1 -emit-llvm -o %t.ll %s
-// RUN: %clang_cc1 -S -o - %t.ll | grep -v '\.file' > %t.ll.s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -emit-llvm -o %t.ll %s
+// RUN: %clang_cc1 -source-date-epoch 1613676318 -S -o - %t.ll | grep -v '\.file' > %t.ll.s
// RUN: diff %t.s %t.ll.s
int f(void) { return 0; }
diff --git a/clang/test/Modules/empty.modulemap b/clang/test/Modules/empty.modulemap
index 8cad8b67b91155..5cee31da19103f 100644
--- a/clang/test/Modules/empty.modulemap
+++ b/clang/test/Modules/empty.modulemap
@@ -1,12 +1,12 @@
// RUN: rm -rf %t
//
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
-// RUN: -fno-implicit-modules \
+// RUN: -fno-implicit-modules -source-date-epoch 1613676318 \
// RUN: -emit-module -fmodule-name=empty -o %t/base.pcm \
// RUN: %s
//
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
-// RUN: -fno-implicit-modules \
+// RUN: -fno-implicit-modules -source-date-epoch 1613676318 \
// RUN: -emit-module -fmodule-name=empty -o %t/check.pcm \
// RUN: %s
//
diff --git a/clang/test/PCH/designated-init.c b/clang/test/PCH/designated-init.c
index beb4dffe6144bf..7050bb82507c5e 100644
--- a/clang/test/PCH/designated-init.c
+++ b/clang/test/PCH/designated-init.c
@@ -1,7 +1,7 @@
// Test this without pch.
-// RUN: %clang_cc1 %s -include %s.h -emit-llvm -o %t.withoutpch.ll
+// RUN: %clang_cc1 -source-date-epoch 1613676318 %s -include %s.h -emit-llvm -o %t.withoutpch.ll
// Test with pch.
// RUN: %clang_cc1 %s.h -emit-pch -o %t.pch
-// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -o %t.withpch.ll
+// RUN: %clang_cc1 -source-date-epoch 1613676318 %s -include-pch %t.pch -emit-llvm -o %t.withpch.ll
// RUN: diff %t.withoutpch.ll %t.withpch.ll
diff --git a/clang/test/VFS/output-file-permissions.c b/clang/test/VFS/output-file-permissions.c
index 4628024c031155..17bfd7ad25e630 100644
--- a/clang/test/VFS/output-file-permissions.c
+++ b/clang/test/VFS/output-file-permissions.c
@@ -4,13 +4,13 @@
// rm -f %t-ref.o %t-readonly.o
// Create a reference file
-// RUN: %clang -c %s -o %t-ref.o
+// RUN: env SOURCE_DATE_EPOCH=1789091336 %clang -c %s -o %t-ref.o
// Compile something, mark the output as read-only and expect it to be replaced
// (permission bits of the file itself are irrelevant)
// RUN: touch %t-readonly.o
// RUN: chmod 000 %t-readonly.o
-// RUN: %clang -c %s -o %t-readonly.o
+// RUN: env SOURCE_DATE_EPOCH=1789091336 %clang -c %s -o %t-readonly.o
// RUN: cmp %t-ref.o %t-readonly.o
void foo() {}
More information about the cfe-commits
mailing list