dd7a4836e3
Summary: This patch allows the use of LIT's ShTest format in the libc++ test suite. ShTests have the suffix '.sh.cpp'. It also introduces a series of other changes. These changes are: - More functionality including parsing test metadata has been moved into LIT. - LibcxxTestFormat now supports multi-part suffixes. - the `CXXCompiler` functionality has been used to shrink the size of LibcxxTestFormat. - The recursive loading of the site config has been turned into `libcxx.test.config.loadSiteConfig` so it can be used with libc++abi. - Temporary files are now created in the build directory of libc++. This follows how it is down in ShTest. - `not.py` was added as a utility executable that mirrors the functionality of LLVM's `not` executable. - The first ShTest test was added under test/libcxx/double_include.sh.cpp Reviewers: jroelofs, danalbert Reviewed By: danalbert Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7073 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226844 91177308-0d34-0410-b5e6-96231b3b80d8
36 lines
793 B
Python
36 lines
793 B
Python
"""not.py is a utility for inverting the return code of commands.
|
|
It acts similar to llvm/utils/not.
|
|
ex: python /path/to/not.py ' echo hello
|
|
echo $? // (prints 1)
|
|
"""
|
|
|
|
import distutils.spawn
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main():
|
|
argv = list(sys.argv)
|
|
del argv[0]
|
|
if len(argv) > 0 and argv[0] == '--crash':
|
|
del argv[0]
|
|
expectCrash = True
|
|
else:
|
|
expectCrash = False
|
|
if len(argv) == 0:
|
|
return 1
|
|
prog = distutils.spawn.find_executable(argv[0])
|
|
if prog is None:
|
|
sys.stderr.write('Failed to find program %s' % argv[0])
|
|
return 1
|
|
rc = subprocess.call(argv)
|
|
if rc < 0:
|
|
return 0 if expectCrash else 1
|
|
if expectCrash:
|
|
return 1
|
|
return rc == 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
exit(main())
|