[AIX][lit] Don't depend on psutil on AIX
Summary:
On AIX psutil can run into problems with permissions to read the process
tree, which causes problems for python timeout tests which need to kill off
a test and it's children.
This patch adds a workaround by invoking shell via subprocess and using a
platform specific option to ps to list all the descendant processes so we can
kill them. We add some checks so lit can tell whether timeout tests are
supported with out exposing whether we are utilizing the psutil
implementation or the alternative.
Reviewers: hubert.reinterpretcast, andusy, davide, delcypher
Reviewed By: delcypher
Subscribers: davide, delcypher, christof, lldb-commits, libcxx-commits, llvm-commits
Tags: #lldb, #libc, #llvm
Differential Revision: https://reviews.llvm.org/D64251
llvm-svn: 366912
2019-07-24 17:04:27 +02:00
|
|
|
# REQUIRES: lit-max-individual-test-time
|
2018-03-28 15:55:13 +02:00
|
|
|
|
2018-09-10 22:24:05 +02:00
|
|
|
# llvm.org/PR33944
|
2019-05-29 20:07:39 +02:00
|
|
|
# UNSUPPORTED: system-windows
|
2018-08-07 23:21:30 +02:00
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
###############################################################################
|
|
|
|
# Check tests can hit timeout when set
|
|
|
|
###############################################################################
|
2018-05-22 17:06:29 +02:00
|
|
|
|
2015-12-27 15:03:49 +01:00
|
|
|
# Test per test timeout using external shell
|
|
|
|
# RUN: not %{lit} \
|
|
|
|
# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
|
2020-10-08 01:52:19 +02:00
|
|
|
# RUN: -j 1 -v --debug --timeout 1 --param external=1 > %t.extsh.out 2> %t.extsh.err
|
2015-12-27 15:03:49 +01:00
|
|
|
# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.extsh.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.extsh.err %s
|
|
|
|
#
|
|
|
|
# CHECK-EXTSH-ERR: Using external shell
|
|
|
|
|
|
|
|
# Test per test timeout using internal shell
|
|
|
|
# RUN: not %{lit} \
|
|
|
|
# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
|
2020-10-08 01:52:19 +02:00
|
|
|
# RUN: -j 1 -v --debug --timeout 1 --param external=0 > %t.intsh.out 2> %t.intsh.err
|
2015-12-27 15:03:49 +01:00
|
|
|
# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s
|
2016-10-12 23:40:08 +02:00
|
|
|
|
2015-12-27 15:03:49 +01:00
|
|
|
# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
|
2016-10-12 23:40:08 +02:00
|
|
|
# CHECK-INTSH-OUT: command reached timeout: True
|
2015-12-27 15:03:49 +01:00
|
|
|
|
|
|
|
# CHECK-INTSH-ERR: Using internal shell
|
|
|
|
|
|
|
|
# Test per test timeout set via a config file rather than on the command line
|
|
|
|
# RUN: not %{lit} \
|
|
|
|
# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
|
|
|
|
# RUN: -j 1 -v --debug --param external=0 \
|
2020-10-08 01:52:19 +02:00
|
|
|
# RUN: --param set_timeout=1 > %t.cfgset.out 2> %t.cfgset.err
|
2015-12-27 15:03:49 +01:00
|
|
|
# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.cfgset.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s
|
|
|
|
#
|
|
|
|
# CHECK-CFGSET-ERR: Using internal shell
|
|
|
|
|
|
|
|
# CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py
|
2020-10-08 01:52:19 +02:00
|
|
|
# CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
|
|
|
|
# CHECK-OUT-COMMON: Timed Out: 1
|
2015-12-27 15:03:49 +01:00
|
|
|
|
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
###############################################################################
|
|
|
|
# Check tests can complete in with a timeout set
|
|
|
|
#
|
|
|
|
# `short.py` should execute quickly so we shouldn't wait anywhere near the
|
|
|
|
# 3600 second timeout.
|
|
|
|
###############################################################################
|
2015-12-27 15:03:49 +01:00
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
# Test per test timeout using external shell
|
|
|
|
# RUN: %{lit} \
|
2015-12-27 15:03:49 +01:00
|
|
|
# RUN: %{inputs}/shtest-timeout/short.py \
|
2020-10-08 01:52:19 +02:00
|
|
|
# RUN: -j 1 -v --debug --timeout 3600 --param external=1 > %t.pass.extsh.out 2> %t.pass.extsh.err
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON-SHORT < %t.pass.extsh.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.pass.extsh.err %s
|
2015-12-27 15:03:49 +01:00
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
# Test per test timeout using internal shell
|
|
|
|
# RUN: %{lit} \
|
|
|
|
# RUN: %{inputs}/shtest-timeout/short.py \
|
|
|
|
# RUN: -j 1 -v --debug --timeout 3600 --param external=0 > %t.pass.intsh.out 2> %t.pass.intsh.err
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON-SHORT < %t.pass.intsh.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.pass.intsh.err %s
|
2015-12-27 15:03:49 +01:00
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
# CHECK-OUT-COMMON-SHORT: PASS: per_test_timeout :: short.py
|
|
|
|
# CHECK-OUT-COMMON-SHORT: Passed: 1
|
2015-12-27 15:03:49 +01:00
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
# Test per test timeout via a config file and on the command line.
|
|
|
|
# The value set on the command line should override the config file.
|
|
|
|
# RUN: %{lit} \
|
|
|
|
# RUN: %{inputs}/shtest-timeout/short.py \
|
|
|
|
# RUN: -j 1 -v --debug --param external=0 \
|
|
|
|
# RUN: --param set_timeout=1 --timeout=3600 > %t.pass.cmdover.out 2> %t.pass.cmdover.err
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON-SHORT < %t.pass.cmdover.out %s
|
|
|
|
# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.pass.cmdover.err %s
|
2015-12-27 15:03:49 +01:00
|
|
|
|
2020-10-08 01:52:19 +02:00
|
|
|
# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds
|