Skip to content

Commit 6d5ae7e

Browse files
formatting changes
1 parent 907654d commit 6d5ae7e

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

libcxx/test/benchmarks/spec.gen.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,27 @@
6565
spec_benchmarks &= no_fortran
6666

6767
for benchmark in spec_benchmarks:
68-
print(f'#--- {benchmark}.sh.test')
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
68+
print(f"#--- {benchmark}.sh.test")
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(
73+
f"RUN: %{{spec_dir}}/bin/runcpu --config %{temp}/spec-config.cfg --size train --output-root %{temp} --rebuild {benchmark}"
74+
)
75+
print(
76+
f"RUN: rm -rf %{temp}/benchspec"
77+
) # remove the temporary directory, which can become quite large
7478

7579
# The `runcpu` command above doesn't fail even if the benchmark fails to run. To determine failure, parse the CSV
7680
# results and ensure there are no compilation errors or runtime errors in the status row. Also print the logs and
7781
# 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 %{temp}/result/*.train.csv > %{temp}/status || ! cat %{temp}/result/*.log')
82+
print(
83+
f'RUN: %{{libcxx-dir}}/utils/parse-spec-results --extract "Base Status" --keep-failed %{temp}/result/*.train.csv > %{temp}/status || ! cat %{temp}/result/*.log'
84+
)
7985
print(f'RUN: ! grep -E "CE|RE" %{temp}/status || ! cat %{temp}/result/*.log')
8086

8187
# 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 %{temp}/result/*.train.csv --output-format=lnt > %{temp}/results.lnt')
83-
print(f'RUN: cat %{temp}/results.lnt')
88+
print(
89+
f"RUN: %{{libcxx-dir}}/utils/parse-spec-results %{temp}/result/*.train.csv --output-format=lnt > %{temp}/results.lnt"
90+
)
91+
print(f"RUN: cat %{temp}/results.lnt")

libcxx/utils/libcxx/test/format.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,14 @@ def parseScript(test, preamble):
178178
"%dbg(MODULE std.compat) %{cxx} %{flags} "
179179
f"{compileFlags} "
180180
"-Wno-reserved-module-identifier -Wno-reserved-user-defined-literal "
181-
"-fmodule-file=std=%{temp}/std.pcm " # The std.compat module imports std.
181+
"-fmodule-file=std=%{temp}/std.pcm " # The std.compat module imports std.
182182
"--precompile -o %{temp}/std.compat.pcm -c %{module-dir}/std.compat.cppm",
183183
)
184184
moduleCompileFlags.extend(
185-
["-fmodule-file=std.compat=%{temp}/std.compat.pcm", "%{temp}/std.compat.pcm"]
185+
[
186+
"-fmodule-file=std.compat=%{temp}/std.compat.pcm",
187+
"%{temp}/std.compat.pcm",
188+
]
186189
)
187190

188191
# Make sure the std module is built before std.compat. Libc++'s
@@ -197,7 +200,9 @@ def parseScript(test, preamble):
197200
"-Wno-reserved-module-identifier -Wno-reserved-user-defined-literal "
198201
"--precompile -o %{temp}/std.pcm -c %{module-dir}/std.cppm",
199202
)
200-
moduleCompileFlags.extend(["-fmodule-file=std=%{temp}/std.pcm", "%{temp}/std.pcm"])
203+
moduleCompileFlags.extend(
204+
["-fmodule-file=std=%{temp}/std.pcm", "%{temp}/std.pcm"]
205+
)
201206

202207
# Add compile flags required for the modules.
203208
substitutions = config._appendToSubstitution(
@@ -355,9 +360,15 @@ def execute(self, test, litConfig):
355360
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{benchmark_flags} %{link_flags} -o %t.exe",
356361
]
357362
if "enable-benchmarks=run" in test.config.available_features:
358-
steps += ["%dbg(EXECUTED AS) %{exec} %t.exe --benchmark_out=%{temp}/benchmark-result.json --benchmark_out_format=json"]
359-
parse_results = os.path.join(LIBCXX_UTILS, 'parse-google-benchmark-results')
360-
steps += [f"{parse_results} %{temp}/benchmark-result.json --output-format=lnt > %{temp}/results.lnt"]
363+
steps += [
364+
"%dbg(EXECUTED AS) %{exec} %t.exe --benchmark_out=%{temp}/benchmark-result.json --benchmark_out_format=json"
365+
]
366+
parse_results = os.path.join(
367+
LIBCXX_UTILS, "parse-google-benchmark-results"
368+
)
369+
steps += [
370+
f"{parse_results} %{temp}/benchmark-result.json --output-format=lnt > %{temp}/results.lnt"
371+
]
361372
return self._executeShTest(test, litConfig, steps)
362373
elif re.search('[.]gen[.][^.]+$', filename): # This only happens when a generator test is not supported
363374
return self._executeShTest(test, litConfig, [])

0 commit comments

Comments
 (0)