llvm.org GIT mirror llvm / a27199d
[lit, python] Always add quotes around the python path in lit Summary: The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes. This change updates several configuration files which specify the path to python as a substitution and also remove quotes from existing tests. Reviewers: asmith, zturner, alexshap, jakehehrlich Reviewed By: zturner, alexshap, jakehehrlich Subscribers: mehdi_amini, nemanjai, eraman, kbarton, jakehehrlich, steven_wu, dexonsmith, stella.stamenova, delcypher, llvm-commits Differential Revision: https://reviews.llvm.org/D50206 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339073 91177308-0d34-0410-b5e6-96231b3b80d8 Stella Stamenova 1 year, 14 days ago
22 changed file(s) with 51 addition(s) and 49 deletion(s). Raw diff Collapse all Expand all
None ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext --compile-custom --compile-command="%python %/s.py arg1 arg2" --opt-command opt --output-prefix %t %s | FileCheck %s
0 ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext --compile-custom --compile-command="%/s.py arg1 arg2" --opt-command opt --output-prefix %t %s | FileCheck %s
11 ; REQUIRES: loadable_module
22
33 ; Test that arguments are correctly passed in --compile-command. The output
11 ; RUN: echo "import sys" > %t.py
22 ; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py
33 ; RUN: echo "exit(1)" >> %t.py
4 ; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s
4 ; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%python -opt-args %t.py | FileCheck %s
55 ; RUN: not --crash opt -load %llvmshlibdir/BugpointPasses%shlibext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
66 ; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%t.non.existent.opt.binary -opt-args %t.py 2>&1 | FileCheck %s --check-prefix=BAD-OPT
77
3737 ; utils/bisect) to locate the optimization that inlines the call to
3838 ; f2() in f3().
3939
40 ; RUN: '%python' %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \
40 ; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \
4141 ; RUN: --filecheckcmd=FileCheck --test=%s \
4242 ; RUN: --prefix=CHECK-BISECT-INLINE-HELPER \
4343 ; RUN: | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT
None // RUN: llvm-tblgen -dump-json %s | '%python' %S/JSON-check.py %s
0 // RUN: llvm-tblgen -dump-json %s | %python %S/JSON-check.py %s
11
22 // CHECK: data['!tablegen_json_version'] == 1
33
105105 ; RUN: rm -Rf %t.cache && mkdir %t.cache
106106 ; Create cache files with different sizes.
107107 ; Only 8B, 16B and 76B files should stay after pruning.
108 ; RUN: "%python" -c "with open(r'%t.cache/llvmcache-foo-1024', 'w') as file: file.truncate(1024)"
109 ; RUN: "%python" -c "with open(r'%t.cache/llvmcache-foo-16', 'w') as file: file.truncate(16)"
110 ; RUN: "%python" -c "with open(r'%t.cache/llvmcache-foo-8', 'w') as file: file.truncate(8)"
111 ; RUN: "%python" -c "with open(r'%t.cache/llvmcache-foo-76', 'w') as file: file.truncate(76)"
112 ; RUN: "%python" -c "with open(r'%t.cache/llvmcache-foo-77', 'w') as file: file.truncate(77)"
108 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-1024', 'w') as file: file.truncate(1024)"
109 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-16', 'w') as file: file.truncate(16)"
110 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-8', 'w') as file: file.truncate(8)"
111 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-76', 'w') as file: file.truncate(76)"
112 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-77', 'w') as file: file.truncate(77)"
113113 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-bytes 100
114114 ; RUN: ls %t.cache/llvmcache-foo-16
115115 ; RUN: ls %t.cache/llvmcache-foo-8
122122 ; RUN: rm -Rf %t.cache && mkdir %t.cache
123123 ; Create cache files with different sizes.
124124 ; Only 8B and 16B files should stay after pruning.
125 ; RUN: "%python" -c "print(' ' * 1023)" > %t.cache/llvmcache-foo-1024
126 ; RUN: "%python" -c "print(' ' * 15)" > %t.cache/llvmcache-foo-16
127 ; RUN: "%python" -c "print(' ' * 7)" > %t.cache/llvmcache-foo-8
128 ; RUN: "%python" -c "print(' ' * 75)" > %t.cache/llvmcache-foo-76
129 ; RUN: "%python" -c "print(' ' * 76)" > %t.cache/llvmcache-foo-77
125 ; RUN: %python -c "print(' ' * 1023)" > %t.cache/llvmcache-foo-1024
126 ; RUN: %python -c "print(' ' * 15)" > %t.cache/llvmcache-foo-16
127 ; RUN: %python -c "print(' ' * 7)" > %t.cache/llvmcache-foo-8
128 ; RUN: %python -c "print(' ' * 75)" > %t.cache/llvmcache-foo-76
129 ; RUN: %python -c "print(' ' * 76)" > %t.cache/llvmcache-foo-77
130130 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-files 2
131131 ; RUN: ls %t.cache/llvmcache-foo-16
132132 ; RUN: ls %t.cache/llvmcache-foo-8
3636 //
3737 // RUN: llvm-cov export %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -name=main 2>/dev/null > %t.export.json
3838 // RUN: FileCheck -input-file %t.export.json %S/Inputs/lineExecutionCounts.json
39 // RUN: cat %t.export.json | "%python" -c "import json, sys; json.loads(sys.stdin.read())"
39 // RUN: cat %t.export.json | %python -c "import json, sys; json.loads(sys.stdin.read())"
4040 //
4141 // RUN: llvm-cov export %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata 2>/dev/null -summary-only > %t.export-summary.json
4242 // RUN: not grep '"name":"main"' %t.export-summary.json
None # RUN: '%python' %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
0 # RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
11 # RUN: llvm-objcopy -R .text -R s0 -R s1 -R s2 -R s3 -R s4 -R s5 -R s6 %t %t2
22 # RUN: llvm-readobj -sections %t2 | FileCheck --check-prefix=SECS %s
33
None RUN: '%python' %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
0 RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
11 RUN: llvm-objcopy %t %t2
22 RUN: llvm-readobj -file-headers %t2 | FileCheck --check-prefix=EHDR %s
33 RUN: llvm-readobj -sections %t2 | FileCheck --check-prefix=SECS %s
0 # This test checks to see that a .symtab_shndx section is added to any binary
11 # that needs it, even if the original was removed.
2 RUN: '%python' %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
2 RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
33 RUN: llvm-objcopy -R .symtab_shndx %t %t2
44 RUN: llvm-readobj -sections %t2 | FileCheck %s
55
0 # This test makes sure that sections added at the end that don't have symbols
11 # defined in them don't trigger the creation of a large index table.
22
3 RUN: '%python' %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t.0
3 RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t.0
44 RUN: cat %p/Inputs/alloc-symtab.o > %t
55 RUN: llvm-objcopy -R .text -R s0 -R s1 -R s2 -R s3 -R s4 -R s5 -R s6 %t.0 %t2
66 RUN: llvm-objcopy -add-section=.s0=%t -add-section=.s1=%t -add-section=.s2=%t %t2 %t2
88 --relative-address.
99
1010 RUN: grep '^ADDR:' %s | sed -s 's/ADDR: //' \
11 RUN: | "%python" -c 'import sys;print("\n".join([hex(int(x, 16) - 0x400000) for x in sys.stdin]))' \
11 RUN: | %python -c 'import sys;print("\n".join([hex(int(x, 16) - 0x400000) for x in sys.stdin]))' \
1212 RUN: | llvm-symbolizer -obj="%p/Inputs/test.exe" -demangle=false --relative-address \
1313 RUN: | FileCheck %s --check-prefix=CHECK-NO-DEMANGLE
1414
33 int bar() { return foo(); }
44 int _start() { return bar(); }
55
6 RUN: "%python" -c "print('0x1000014c\n0x1000018c\n0x100001cc')" | llvm-symbolizer -obj=%p/Inputs/ppc64 | FileCheck %s
6 RUN: %python -c "print('0x1000014c\n0x1000018c\n0x100001cc')" | llvm-symbolizer -obj=%p/Inputs/ppc64 | FileCheck %s
77
88 CHECK: foo
99 CHECK: bar
298298 'count'), verbatim=True, unresolved='fatal'),
299299 ToolSubst(r'\| \bnot\b', command=FindTool('not'), verbatim=True, unresolved='fatal')]
300300
301 self.config.substitutions.append(('%python', sys.executable))
301 self.config.substitutions.append(('%python', "'%s'" % (sys.executable)))
302
302303 self.add_tool_substitutions(
303304 tool_patterns, [self.config.llvm_tools_dir])
304305
55 config.test_exec_root = None
66 config.environment['FOO'] = '1'
77 config.environment['BAR'] = '2'
8 config.substitutions.append(('%{python}', sys.executable))
8 config.substitutions.append(('%{python}', "'%s'" % (sys.executable)))
0 # Run a command that fails with error on stdout.
11 #
2 # RUN: "%{python}" %S/write-bad-encoding.py
2 # RUN: %{python} %S/write-bad-encoding.py
33 # RUN: false
44
55 config.test_exec_root = None
66 config.target_triple = 'x86_64-unknown-unknown'
77 config.available_features.add('a-present-feature')
8 config.substitutions.append(('%{python}', sys.executable))
8 config.substitutions.append(('%{python}', "'%s'" % (sys.executable)))
0 # Check handling of /dev/null in command line options
11 # On windows, it should be redirected to a temp file.
22 #
3 # RUN: "%{python}" %S/check_args.py --my_arg /dev/null | FileCheck %s --check-prefix=CHECK1
3 # RUN: %{python} %S/check_args.py --my_arg /dev/null | FileCheck %s --check-prefix=CHECK1
44 # CHECK1: OK
55
6 # RUN: "%{python}" %S/check_args.py --my_arg=/dev/null | FileCheck %s --check-prefix=CHECK2
6 # RUN: %{python} %S/check_args.py --my_arg=/dev/null | FileCheck %s --check-prefix=CHECK2
77 # CHECK2: OK
88
9 # RUN: "%{python}" %S/check_args.py -a /dev/null | FileCheck %s --check-prefix=CHECK3
9 # RUN: %{python} %S/check_args.py -a /dev/null | FileCheck %s --check-prefix=CHECK3
1010 # CHECK3: OK
1111
12 # RUN: "%{python}" %S/check_args.py -a=/dev/null | FileCheck %s --check-prefix=CHECK4
12 # RUN: %{python} %S/check_args.py -a=/dev/null | FileCheck %s --check-prefix=CHECK4
1313 # CHECK4: OK
33 config.test_format = lit.formats.ShTest()
44 config.test_source_root = None
55 config.test_exec_root = None
6 config.substitutions.append(('%{python}', sys.executable))
6 config.substitutions.append(('%{python}', "'%s'" % (sys.executable)))
1616 # Check stderr redirect (2> and 2>>).
1717 #
1818 # RUN: echo "not-present" > %t.stderr-write
19 # RUN: "%{python}" %S/write-to-stderr.py 2> %t.stderr-write
19 # RUN: %{python} %S/write-to-stderr.py 2> %t.stderr-write
2020 # RUN: FileCheck --check-prefix=STDERR-WRITE < %t.stderr-write %s
2121 #
2222 # STDERR-WRITE-NOT: not-present
2323 # STDERR-WRITE: a line on stderr
2424 #
25 # RUN: "%{python}" %S/write-to-stderr.py 2>> %t.stderr-write
25 # RUN: %{python} %S/write-to-stderr.py 2>> %t.stderr-write
2626 # RUN: FileCheck --check-prefix=STDERR-APPEND < %t.stderr-write %s
2727 #
2828 # STDERR-APPEND: a line on stderr
3232 # Check combined redirect (&>).
3333 #
3434 # RUN: echo "not-present" > %t.combined
35 # RUN: "%{python}" %S/write-to-stdout-and-stderr.py &> %t.combined
35 # RUN: %{python} %S/write-to-stdout-and-stderr.py &> %t.combined
3636 # RUN: FileCheck --check-prefix=COMBINED-WRITE < %t.combined %s
3737 #
3838 # COMBINED-WRITE-NOT: not-present
11 # Check force remove commands success whether the file does or doesn't exist.
22 #
33 # RUN: rm -f %t.write
4 # RUN: "%{python}" %S/check_path.py file %t.write > %t.out
4 # RUN: %{python} %S/check_path.py file %t.write > %t.out
55 # RUN: FileCheck --check-prefix=REMOVE-FILE < %t.out %s
66 # RUN: echo "create a temp file" > %t.write
7 # RUN: "%{python}" %S/check_path.py file %t.write > %t.out
7 # RUN: %{python} %S/check_path.py file %t.write > %t.out
88 # RUN: FileCheck --check-prefix=FILE-EXIST < %t.out %s
99 # RUN: rm -f %t.write
10 # RUN: "%{python}" %S/check_path.py file %t.write > %t.out
10 # RUN: %{python} %S/check_path.py file %t.write > %t.out
1111 # RUN: FileCheck --check-prefix=REMOVE-FILE < %t.out %s
1212 #
1313 # REMOVE-FILE: False
1818 #
1919 # Check the mkdir command with -p option.
2020 # RUN: rm -f -r %T/test
21 # RUN: "%{python}" %S/check_path.py dir %T/test > %t.out
21 # RUN: %{python} %S/check_path.py dir %T/test > %t.out
2222 # RUN: FileCheck --check-prefix=REMOVE-PARENT-DIR < %t.out %s
2323 # RUN: mkdir -p %T/test
24 # RUN: "%{python}" %S/check_path.py dir %T/test > %t.out
24 # RUN: %{python} %S/check_path.py dir %T/test > %t.out
2525 # RUN: FileCheck --check-prefix=MAKE-PARENT-DIR < %t.out %s
2626 # RUN: rm -f %T/test || true
2727 # RUN: rm -f -r %T/test
28 # RUN: "%{python}" %S/check_path.py dir %T/test > %t.out
28 # RUN: %{python} %S/check_path.py dir %T/test > %t.out
2929 # RUN: FileCheck --check-prefix=REMOVE-PARENT-DIR < %t.out %s
3030 #
3131 # MAKE-PARENT-DIR: True
3535 #
3636 # RUN: rm -rf %T/test1
3737 # RUN: mkdir %T/test1
38 # RUN: "%{python}" %S/check_path.py dir %T/test1 > %t.out
38 # RUN: %{python} %S/check_path.py dir %T/test1 > %t.out
3939 # RUN: FileCheck --check-prefix=MAKE-DIR < %t.out %s
4040 # RUN: cd %T/test1 && mkdir foo
41 # RUN: "%{python}" %S/check_path.py dir %T/test1 > %t.out
41 # RUN: %{python} %S/check_path.py dir %T/test1 > %t.out
4242 # RUN: FileCheck --check-prefix=MAKE-DIR < %t.out %s
4343 # RUN: cd %T && rm -rf %T/test1
44 # RUN: "%{python}" %S/check_path.py dir %T/test1 > %t.out
44 # RUN: %{python} %S/check_path.py dir %T/test1 > %t.out
4545 # RUN: FileCheck --check-prefix=REMOVE-DIR < %t.out %s
4646 #
4747 # MAKE-DIR: True
5151 #
5252 # RUN: rm -rf %T/test
5353 # RUN: mkdir -p %T/test/test1 %T/test/test2
54 # RUN: "%{python}" %S/check_path.py dir %T/test %T/test/test1 %T/test/test2 > %t.out
54 # RUN: %{python} %S/check_path.py dir %T/test %T/test/test1 %T/test/test2 > %t.out
5555 # RUN: FileCheck --check-prefix=DIRS-EXIST < %t.out %s
5656 # RUN: mkdir %T/test || true
5757 # RUN: echo "create a temp file" > %T/test/temp.write
5858 # RUN: echo "create a temp1 file" > %T/test/test1/temp1.write
5959 # RUN: echo "create a temp2 file" > %T/test/test2/temp2.write
60 # RUN: "%{python}" %S/check_path.py file %T/test/temp.write %T/test/test1/temp1.write %T/test/test2/temp2.write> %t.out
60 # RUN: %{python} %S/check_path.py file %T/test/temp.write %T/test/test1/temp1.write %T/test/test2/temp2.write> %t.out
6161 # RUN: FileCheck --check-prefix=FILES-EXIST < %t.out %s
6262 # RUN: rm -r -f %T/*
63 # RUN: "%{python}" %S/check_path.py dir %T/test > %t.out
63 # RUN: %{python} %S/check_path.py dir %T/test > %t.out
6464 # RUN: FileCheck --check-prefix=REMOVE-ALL < %t.out %s
6565 #
6666 # DIRS-EXIST: True
9191 # RUN: mkdir -p %T/testCat
9292 # RUN: echo "abcdefgh" > %T/testCat/temp.write
9393 # RUN: cat %T/testCat/temp.write > %T/testCat/tempcat.write
94 # RUN: "%{python}" %S/check_path.py file %T/testCat/tempcat.write > %T/testCat/path.out
94 # RUN: %{python} %S/check_path.py file %T/testCat/tempcat.write > %T/testCat/path.out
9595 # RUN: FileCheck --check-prefix=FILE-EXISTS < %T/testCat/path.out %s
9696 # RUN: FileCheck --check-prefix=CAT-OUTPUT < %T/testCat/tempcat.write %s
9797 # FILE-EXISTS: True
105105 # RUN: echo "efghijkl" > %T/testCat/temp2.write
106106 # RUN: echo "mnopqrst" > %T/testCat/temp3.write
107107 # RUN: cat %T/testCat/temp1.write %T/testCat/temp2.write %T/testCat/temp3.write > %T/testCat/tempmulticat.write
108 # RUN: "%{python}" %S/check_path.py file %T/testCat/tempmulticat.write > %T/testCat/path.out
108 # RUN: %{python} %S/check_path.py file %T/testCat/tempmulticat.write > %T/testCat/path.out
109109 # RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %T/testCat/path.out %s
110110 # RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT < %T/testCat/tempmulticat.write %s
111111 # MULTI-FILE-EXISTS: True
2828 config.target_triple = '(unused)'
2929 src_root = os.path.join(config.test_source_root, '..')
3030 config.environment['PYTHONPATH'] = src_root
31 config.substitutions.append(('%{python}', sys.executable))
31 config.substitutions.append(('%{python}', "'%s'" % (sys.executable)))
3939 src_root, 'tests', 'Inputs')))
4040 config.substitutions.append(('%{lit}', "%%{python} %s" % (
4141 os.path.join(lit_path, 'lit.py'),)))
42 config.substitutions.append(('%{python}', sys.executable))
42 config.substitutions.append(('%{python}', "'%s'" % (sys.executable)))
43
4344
4445 # Enable coverage.py reporting, assuming the coverage module has been installed
4546 # and sitecustomize.py in the virtualenv has been modified appropriately.