Skip to content

Commit eec1ee8

Browse files
authored
[SystemZ][z/OS] Enable lit testing for z/OS (#107631)
This patch fixes various errors to enable llvm-lit to run on z/OS
1 parent 78c1009 commit eec1ee8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

llvm/lib/Support/raw_ostream.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,10 @@ size_t raw_fd_ostream::preferred_buffer_size() const {
843843
if (IsWindowsConsole)
844844
return 0;
845845
return raw_ostream::preferred_buffer_size();
846+
#elif defined(__MVS__)
847+
// The buffer size on z/OS is defined with macro BUFSIZ, which can be
848+
// retrieved by invoking function raw_ostream::preferred_buffer_size().
849+
return raw_ostream::preferred_buffer_size();
846850
#else
847851
assert(FD >= 0 && "File not yet open!");
848852
struct stat statbuf;

llvm/utils/lit/lit/run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import multiprocessing
22
import os
3+
import platform
34
import time
45

56
import lit.Test
@@ -136,6 +137,6 @@ def _increase_process_limit(self):
136137
"Raised process limit from %d to %d" % (soft_limit, desired_limit)
137138
)
138139
except Exception as ex:
139-
# Warn, unless this is Windows, in which case this is expected.
140-
if os.name != "nt":
140+
# Warn, unless this is Windows or z/OS, in which case this is expected.
141+
if os.name != "nt" and platform.system() != "OS/390":
141142
self.lit_config.warning("Failed to raise process limit: %s" % ex)

llvm/utils/lit/lit/util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def killProcessAndChildrenIsSupported():
502502
otherwise is contains a string describing why the function is
503503
not supported.
504504
"""
505-
if platform.system() == "AIX":
505+
if platform.system() == "AIX" or platform.system() == "OS/390":
506506
return (True, "")
507507
try:
508508
import psutil # noqa: F401
@@ -528,6 +528,9 @@ def killProcessAndChildren(pid):
528528
"""
529529
if platform.system() == "AIX":
530530
subprocess.call("kill -kill $(ps -o pid= -L{})".format(pid), shell=True)
531+
elif platform.system() == "OS/390":
532+
# FIXME: Only the process is killed.
533+
subprocess.call("kill -KILL $(ps -s {} -o pid=)".format(pid), shell=True)
531534
else:
532535
import psutil
533536

0 commit comments

Comments
 (0)