Skip to content

Commit 0c2913a

Browse files
[libcxx] Use %{temp} instead of %T (#162323)
Based on review feedback in #160026. This makes the substitution a lot more clear now that there is no documentation around %T. --------- Co-authored-by: Louis Dionne <[email protected]>
1 parent 9146ef5 commit 0c2913a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+79
-75
lines changed

libcxx/docs/TestingLibcxx.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ writing tests easier. See `libc++-specific Lit Directives`_ for more information
419419
- ``// FILE_DEPENDENCIES: file, directory, /path/to/file, ...``
420420
- The paths given to the ``FILE_DEPENDENCIES`` directive can specify directories or specific files upon which a given test depend. For example, a test that requires some test
421421
input stored in a data file would use this libc++-specific Lit directive. When a test file contains the ``FILE_DEPENDENCIES`` directive, Lit will collect the named files and copy
422-
them to the directory represented by the ``%T`` substitution before the test executes. The copy is performed from the directory represented by the ``%S`` substitution
422+
them to the directory represented by the ``%{temp}`` substitution before the test executes. The copy is performed from the directory represented by the ``%S`` substitution
423423
(i.e. the source directory of the test being executed) which makes it possible to use relative paths to specify the location of dependency files. After Lit copies
424-
all the dependent files to the directory specified by the ``%T`` substitution, that directory should contain *all* the necessary inputs to run. In other words,
425-
it should be possible to copy the contents of the directory specified by the ``%T`` substitution to a remote host where the execution of the test will actually occur.
424+
all the dependent files to the directory specified by the ``%{temp}`` substitution, that directory should contain *all* the necessary inputs to run. In other words,
425+
it should be possible to copy the contents of the directory specified by the ``%{temp}`` substitution to a remote host where the execution of the test will actually occur.
426426
* - ``ADDITIONAL_COMPILE_FLAGS``
427427
- ``// ADDITIONAL_COMPILE_FLAGS: flag1 flag2 ...``
428428
- The additional compiler flags specified by a space-separated list to the ``ADDITIONAL_COMPILE_FLAGS`` libc++-specific Lit directive will be added to the end of the ``%{compile_flags}``

libcxx/test/benchmarks/spec.gen.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
# REQUIRES: enable-spec-benchmarks
1010

11-
# RUN: mkdir -p %T
12-
# RUN: echo "%{cxx}" > %T/cxx.subs
13-
# RUN: echo "%{compile_flags}" > %T/compile_flags.subs
14-
# RUN: echo "%{flags}" > %T/flags.subs
15-
# RUN: echo "%{link_flags}" > %T/link_flags.subs
16-
# RUN: echo "%{spec_dir}" > %T/spec_dir.subs
17-
# RUN: %{python} %s %T
11+
# RUN: mkdir -p %{temp}
12+
# RUN: echo "%{cxx}" > %{temp}/cxx.subs
13+
# RUN: echo "%{compile_flags}" > %{temp}/compile_flags.subs
14+
# RUN: echo "%{flags}" > %{temp}/flags.subs
15+
# RUN: echo "%{link_flags}" > %{temp}/link_flags.subs
16+
# RUN: echo "%{spec_dir}" > %{temp}/spec_dir.subs
17+
# RUN: %{python} %s %{temp}
1818
# END.
1919

2020
import json
@@ -66,18 +66,18 @@
6666

6767
for benchmark in spec_benchmarks:
6868
print(f'#--- {benchmark}.sh.test')
69-
print(f'RUN: rm -rf %T') # clean up any previous (potentially incomplete) run
70-
print(f'RUN: mkdir %T')
71-
print(f'RUN: cp {spec_config} %T/spec-config.cfg')
72-
print(f'RUN: %{{spec_dir}}/bin/runcpu --config %T/spec-config.cfg --size train --output-root %T --rebuild {benchmark}')
73-
print(f'RUN: rm -rf %T/benchspec') # remove the temporary directory, which can become quite large
69+
print(f'RUN: rm -rf %{temp}') # clean up any previous (potentially incomplete) run
70+
print(f'RUN: mkdir %{temp}')
71+
print(f'RUN: cp {spec_config} %{temp}/spec-config.cfg')
72+
print(f'RUN: %{{spec_dir}}/bin/runcpu --config %{temp}/spec-config.cfg --size train --output-root %{temp} --rebuild {benchmark}')
73+
print(f'RUN: rm -rf %{temp}/benchspec') # remove the temporary directory, which can become quite large
7474

7575
# The `runcpu` command above doesn't fail even if the benchmark fails to run. To determine failure, parse the CSV
7676
# results and ensure there are no compilation errors or runtime errors in the status row. Also print the logs and
7777
# fail if there are no CSV files at all, which implies a SPEC error.
78-
print(f'RUN: %{{libcxx-dir}}/utils/parse-spec-results --extract "Base Status" --keep-failed %T/result/*.train.csv > %T/status || ! cat %T/result/*.log')
79-
print(f'RUN: ! grep -E "CE|RE" %T/status || ! cat %T/result/*.log')
78+
print(f'RUN: %{{libcxx-dir}}/utils/parse-spec-results --extract "Base Status" --keep-failed %{temp}/result/*.train.csv > %{temp}/status || ! cat %{temp}/result/*.log')
79+
print(f'RUN: ! grep -E "CE|RE" %{temp}/status || ! cat %{temp}/result/*.log')
8080

8181
# If there were no errors, parse the results into LNT-compatible format and print them.
82-
print(f'RUN: %{{libcxx-dir}}/utils/parse-spec-results %T/result/*.train.csv --output-format=lnt > %T/results.lnt')
83-
print(f'RUN: cat %T/results.lnt')
82+
print(f'RUN: %{{libcxx-dir}}/utils/parse-spec-results %{temp}/result/*.train.csv --output-format=lnt > %{temp}/results.lnt')
83+
print(f'RUN: cat %{temp}/results.lnt')

libcxx/test/configs/apple-libc++-shared.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ config.substitutions.append(('%{link_flags}',
3838
'-nostdlib++ -L %{lib-dir} -lc++ %{apple-system-shims}'
3939
))
4040
config.substitutions.append(('%{exec}',
41-
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib-dir} -- '
41+
'%{executor} --execdir %{temp} --env DYLD_LIBRARY_PATH=%{lib-dir} -- '
4242
))
4343

4444
config.stdlib = 'apple-libc++'

libcxx/test/configs/apple-libc++-system.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ config.substitutions.append(('%{link_flags}',
1919
'-nostdlib++ -L %{lib-dir} -lc++'
2020
))
2121
config.substitutions.append(('%{exec}',
22-
'%{executor} --execdir %T -- '
22+
'%{executor} --execdir %{temp} -- '
2323
))
2424

2525
config.stdlib = 'apple-libc++'

libcxx/test/configs/armv7m-picolibc-libc++.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ config.executor = (
3030
' --cpu cortex-m3')
3131
config.substitutions.append(('%{exec}',
3232
'%{executor}'
33-
' --execdir %T'
33+
' --execdir %{temp}'
3434
))
3535

3636
import os, site

libcxx/test/configs/ibm-libc++-shared.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ config.substitutions.append(('%{link_flags}',
1818
'-nostdlib++ -L %{lib-dir} -lc++ -lc++abi -latomic -Wl,-bbigtoc'
1919
))
2020
config.substitutions.append(('%{exec}',
21-
'%{executor} --execdir %T --env LIBPATH=%{lib-dir} -- '
21+
'%{executor} --execdir %{temp} --env LIBPATH=%{lib-dir} -- '
2222
))
2323

2424
# LIBCXX-AIX-FIXME is the feature name used to XFAIL the

libcxx/test/configs/llvm-libc++-android.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ config.substitutions.append(('%{link_flags}',
3636
config.substitutions.append(('%{exec}',
3737
'%{executor}' +
3838
' --job-limit-socket ' + libcxx.test.android.adb_job_limit_socket() +
39-
' --prepend-path-env LD_LIBRARY_PATH /data/local/tmp/libc++ --execdir %T -- '
39+
' --prepend-path-env LD_LIBRARY_PATH /data/local/tmp/libc++ --execdir %{temp} -- '
4040
))
4141

4242
libcxx.test.config.configure(

libcxx/test/configs/llvm-libc++-mingw.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ config.substitutions.append(('%{link_flags}',
1111
'-nostdlib++ -L %{lib-dir} -lc++'
1212
))
1313
config.substitutions.append(('%{exec}',
14-
'%{executor} --execdir %T --prepend_env PATH=%{install-prefix}/bin -- '
14+
'%{executor} --execdir %{temp} --prepend_env PATH=%{install-prefix}/bin -- '
1515
))
1616

1717
import os, site

libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ config.substitutions.append(('%{link_flags}',
2525
'-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib
2626
))
2727
config.substitutions.append(('%{exec}',
28-
'%{executor} --execdir %T --prepend_env PATH=%{install-prefix}/bin -- '
28+
'%{executor} --execdir %{temp} --prepend_env PATH=%{install-prefix}/bin -- '
2929
))
3030

3131
import os, site

libcxx/test/configs/llvm-libc++-shared-gcc.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ config.substitutions.append(('%{link_flags}',
1212
'-nostdlib++ -L %{lib-dir} -Wl,-rpath,%{lib-dir} -lc++ -lm'
1313
))
1414
config.substitutions.append(('%{exec}',
15-
'%{executor} --execdir %T -- '
15+
'%{executor} --execdir %{temp} -- '
1616
))
1717

1818
import os, site

0 commit comments

Comments
 (0)